summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/exabgp/files')
-rw-r--r--net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch22
-rw-r--r--net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch13
-rw-r--r--net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch44
-rw-r--r--net-misc/exabgp/files/exabgp.initd-r164
4 files changed, 143 insertions, 0 deletions
diff --git a/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch
new file mode 100644
index 000000000000..768fe80a8107
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch
@@ -0,0 +1,22 @@
+diff --git a/lib/exabgp/application/healthcheck.py b/lib/exabgp/application/healthcheck.py
+index a4f6b8d1..805cf8af 100644
+--- a/lib/exabgp/application/healthcheck.py
++++ b/lib/exabgp/application/healthcheck.py
+@@ -168,6 +168,7 @@
+ g.add_argument(
+ "--start-ip", metavar='N', type=int, default=0, help="index of the first IP in the list of IP addresses"
+ )
++ g.add_argument("--no-metric", action="store_true", default=False, help="don't send metrics when updating announcements")
+ g.add_argument(
+ "--up-metric", metavar='M', type=int, default=100, help="first IP get the metric M when the service is up"
+ )
+@@ -494,7 +495,8 @@
+ announce = "route {0} next-hop {1}".format(str(ip), options.next_hop or "self")
+
+ if command == "announce":
+- announce = "{0} med {1}".format(announce, metric)
++ if not options.no_metric:
++ announce = "{0} med {1}".format(announce, metric)
+ if options.local_preference >= 0:
+ announce = "{0} local-preference {1}".format(announce, options.local_preference)
+ if options.community or options.disabled_community:
diff --git a/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch
new file mode 100644
index 000000000000..a43e90a724e4
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/exabgp/logger.py b/lib/exabgp/logger.py
+index 41a1cf28..f87785a2 100644
+--- a/lib/exabgp/logger.py
++++ b/lib/exabgp/logger.py
+@@ -339,7 +339,7 @@ class Logger(object):
+ else:
+ src = source
+
+- log = self._option.get(src, True) and getattr(syslog, 'LOG_%s' % level) <= self.level
++ log = self._option.get(src, True) and getattr(syslog, 'LOG_%s' % level, logging.handlers.SysLogHandler.LOG_DAEMON) <= self.level
+
+ if not log:
+ return
diff --git a/net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch b/net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch
new file mode 100644
index 000000000000..fe09a58ed776
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch
@@ -0,0 +1,44 @@
+diff --git a/lib/exabgp/application/healthcheck.py b/lib/exabgp/application/healthcheck.py
+index a4f6b8d1..d8195074 100644
+--- a/lib/exabgp/application/healthcheck.py
++++ b/lib/exabgp/application/healthcheck.py
+@@ -159,7 +159,16 @@ def setup_logging(debug, silent, name, syslog_facility, syslog):
+ enable_syslog = syslog and not debug
+ # To syslog
+ if enable_syslog:
+- facility = getattr(logging.handlers.SysLogHandler, "LOG_{0}".format(syslog_facility.upper()))
++ if isinstance(syslog_facility, int) or syslog_facility.isdigit():
++ for log_facility, value in sorted(logging.handlers.SysLogHandler.facility_names.items(), key=lambda x: x[1]):
++ if value >= int(syslog_facility):
++ facility = log_facility
++ break
++ elif hasattr(logging.handlers.SysLogHandler, "LOG_{0}".format(syslog_facility.upper())):
++ facility = getattr(logging.handlers.SysLogHandler, "LOG_{0}".format(syslog_facility.upper()))
++ else:
++ facility = logging.handlers.SysLogHandler.LOG_DAEMON
++
+ sh = logging.handlers.SysLogHandler(address=str(syslog_address()), facility=facility)
+ if name:
+ healthcheck_name = "healthcheck-{0}".format(name)
+diff --git a/lib/exabgp/reactor/api/command/announce.py b/lib/exabgp/reactor/api/command/announce.py
+index 3c9091d2..e21cbe95 100644
+--- a/lib/exabgp/reactor/api/command/announce.py
++++ b/lib/exabgp/reactor/api/command/announce.py
+@@ -6,6 +6,7 @@ Created by Thomas Mangin on 2017-07-01.
+ Copyright (c) 2009-2017 Exa Networks. All rights reserved.
+ License: 3-clause BSD. (See the COPYRIGHT file)
+ """
++import logging
+
+ from exabgp.reactor.api.command.command import Command
+ from exabgp.reactor.api.command.limit import match_neighbors
+@@ -50,7 +51,8 @@ def announce_route(self, reactor, service, line):
+ change.nlri.action = OUT.ANNOUNCE
+ reactor.configuration.inject_change(peers, change)
+ self.log_message(
+- 'route added to %s : %s' % (', '.join(peers) if peers else 'all peers', change.extensive())
++ 'route added to %s : %s' % (', '.join(peers) if peers else 'all peers', change.extensive()),
++ level=logging.WARNING
+ )
+ yield False
+
diff --git a/net-misc/exabgp/files/exabgp.initd-r1 b/net-misc/exabgp/files/exabgp.initd-r1
new file mode 100644
index 000000000000..ec2f01704b8b
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp.initd-r1
@@ -0,0 +1,64 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# default arguments
+: "${EXABGP_ARGS:=--env=/etc/${RC_SVCNAME}/exabgp.env /etc/${RC_SVCNAME}/exabgp.conf}"
+
+command="capsh"
+command_args="
+ --uid=${EXABGP_USER:=exabgp}
+ --gid=${EXABGP_GROUP:=exabgp}
+ --caps='cap_net_admin+epi cap_setuid+ep-i cap_setgid+ep-i'
+ -- -c \"/usr/bin/exabgp ${EXABGP_ARGS}\""
+
+supervisor=supervise-daemon
+
+: "${pidfile:=/run/exabgp/${RC_SVCNAME}-supervisor.pid}"
+: "${output_log:=/var/log/${RC_SVCNAME}/exabgp.log}"
+: "${error_log:=/var/log/${RC_SVCNAME}/exabgp.log}"
+
+extra_started_commands="routes sessions"
+extra_commands="checkconfig"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath -q -d -m 0755 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ /run/exabgp || return
+
+ checkpath -q -p -m 0600 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ /run/exabgp/${RC_SVCNAME}.{in,out} || return
+
+ checkpath -q -d -m 0755 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ "/var/log/${RC_SVCNAME}" || return
+
+ checkconfig || return
+}
+
+stop_pre() {
+ # don't restart if the configuration is bad
+ if [ "${RC_CMD}" = restart ]; then
+ checkconfig || return
+ fi
+}
+
+checkconfig() {
+ ebegin "Checking configuration for ${RC_SVCNAME}"
+ exabgp -t ${EXABGP_ARGS}
+ eend ${?} "Invalid configuration"
+}
+
+sessions() {
+ ebegin "Querying sessions"
+ exabgpcli --env /etc/${RC_SVCNAME}/exabgp.env show neighbor summary
+ eend ${?} "exabgpcli failed"
+}
+
+routes() {
+ ebegin "Querying routes"
+ exabgpcli --env /etc/${RC_SVCNAME}/exabgp.env show adj-rib out
+ eend ${?} "exabgpcli failed"
+}