summaryrefslogtreecommitdiff
path: root/net-misc/frr
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/frr')
-rw-r--r--net-misc/frr/Manifest3
-rw-r--r--net-misc/frr/files/frr-openrc-v2301
-rw-r--r--net-misc/frr/frr-8.5.2-r1.ebuild (renamed from net-misc/frr/frr-8.5.2.ebuild)3
3 files changed, 305 insertions, 2 deletions
diff --git a/net-misc/frr/Manifest b/net-misc/frr/Manifest
index ec5d2d3758a0..9d5c72507ebd 100644
--- a/net-misc/frr/Manifest
+++ b/net-misc/frr/Manifest
@@ -2,11 +2,12 @@ AUX frr-7.5-ipctl-forwarding.patch 731 BLAKE2B 9c97d7fdc7b7facb59a73f4b693c285eb
AUX frr-8.4.1-logrotate.patch 2487 BLAKE2B f3eb9b9ce25dd9dd796668ecef5dfeb51b5f3ea3428ef4c03bd78becaf26deb5cb59aa56918fdc3c0230a8905d7edf4a12582ab4e6f7d297e3c94c62b7468b0c SHA512 8658dd1280d201d9f3a7f8caa6c5bf513133a3928ba97334202b0fed84dc03f12c82d76cbb8aeae3f363024d2373161c9bda74e1d9a27a085071c524c9941ad0
AUX frr-8.4.2-musl-gcc12.patch 525 BLAKE2B 8aa00d5a41445e6a035e77481bf6dc3cf45380d7fe91e0d884cc32a19f3594d8822376837d87988803950ca3bb90914a387767b9d766bfb8784567c989e1160e SHA512 1d3ebc40533037aad992d64f207ecc6ebbe599bedfa3f83cd0e4820e3579daea50ffcc8376bc24154ce0fe1cac9002de6e43665f8addfdf38554e82fd502e8fe
AUX frr-openrc-v1 7078 BLAKE2B d5c0276540fa09318f6e92575dd7e03f3bc6ebfce186d062c2d65fa49c502b3b4de0fd32914ce7c4708bb6f6188296f75d387e0384c142381bb77cfb706c7e1c SHA512 8e6f0e58863402f0169b8a7625d049bf85db60bebe40a42dfb450a1bddfcd6f8f436002de6c1ff599c8f848e4ba85a70e4058cb55a9a49fafb1e69a8e7eb9f57
+AUX frr-openrc-v2 7079 BLAKE2B abbad56f0715b79ba5ba24df373ccb8ab63caa12b04d892693b060c771d47323fd7fcebd9b5688720d4aded23fcb79a36e89a7734b315b0862d16e5ce08d8b10 SHA512 5744c433fd983a56abb8f45e34229b3ab3a03c3e9d5532e2b30a31f3e875076fb56b81a06e661dba7df9f76e463190e831c82ae79deefe1add22d7f0365098ce
AUX frr.pam 969 BLAKE2B 227dc91f51fab504229fa5489486fed1aa393d33c024849724ea3fb934e3fd78ee6c9147240133d458ec52021f13e8a27a2d8a0b4625415007c4595222b815ee SHA512 9a169d58232eba7481aee83d92b4e104b6c4ca95e5b31befe29117fbcebc187ad87c061f37ec7c571ff5702101a329ae0c113cf714e2d0dcd39ca4212734a9ed
DIST frr-8.4.2.tar.gz 9893223 BLAKE2B 670fb131c2959b0ce4f3133ef38caeb7832275844b16f8582a693033f5466ad0eb98ab45ed9615e0a121ab80bf034edafe7ee816c47d767bd8a13b52f3138eac SHA512 1ee9d17ef3b85c5c10df624a6560bcacb2b5daa3d6231e457f06d9eb6e5ccf375064a46e809d851c23cb6daf7a4299d1f25be589992ef729e80f9bad41a8d7f7
DIST frr-8.5.2.tar.gz 10076639 BLAKE2B 2e2aca4e42757f66c9ca4725826c6cc1d611930490eed2a175ca5b56910f2c09a9d842b2a9370a64a9fdac6a6314bd4573be609d14dbf956049d9fbf49310404 SHA512 1afa6ca1a41096aa47dc2fc39ab87290b3cbf634a1632e7910a5b69d2816998fbccbca616f261a410aa146a21dd26d12b7e6812da4ec08545b1500f8b546b972
DIST frr-8.5.tar.gz 10068379 BLAKE2B ed7aa538997bdbfde0370f36a8980ad3ae882a2325cdc7c3b2bdba9d6a43cd9ca04ff96b94b7827e06593a15c104cdadbd2632e136eb2d68e7ed87095a9294a4 SHA512 13e2ea8642fc00b565e9a36d2d59abe5d0e11caf646199cd928184fda2de004bda9892ae8a2f91870d5ac218bb127725663b693e4d764e5b21c942bb20b8d66f
EBUILD frr-8.4.2.ebuild 3570 BLAKE2B b6ef8c95358d86b9f718431a973ec5ada292987acb3320d6cd1b246499f796605f93fe049f86edd41efcca9b35c220de374fe4e4d00b4908c5709caef7abec4d SHA512 db52208f81b22a3848b81042b9fcaa6740270816e7049c74bee6f83cce7a4020fdf9a80d46c899ace646b64eb3e448abb5f8f19ce3be6fff033562d404dd0f78
-EBUILD frr-8.5.2.ebuild 3527 BLAKE2B 5cf9bc7c4b68d50208f522287ae4ae08f8c5efab7e4d467c5ed25b098eb768e4489d3f07364d45c8f5ad992066df14275e1e36ac9735d4e4990c07fcfd1f6c17 SHA512 4c2d8c0f39ce1a1e568453d2820bb7e78cfad084de8edfd4124ec84fce7ccadacf41f8aedb9dca79b92837f0468e5523e031c1877e710e22645609a21773f2c7
+EBUILD frr-8.5.2-r1.ebuild 3548 BLAKE2B 9372c8734217d6da8c6c671c816084c6b57d23584ce8c397594235937692336c306ffc35512a58e8ade7ff44cc20b490c9fae3b4c32533425e7b39cf6a9d7232 SHA512 e600c591558467b931c3edbaf9c892ed4f061b6e2816e455aba5ed2348a84a4c97990afb85677d37cbf6764c56d331e48cb799d97006c5c064088d66e40b7d08
EBUILD frr-8.5.ebuild 3526 BLAKE2B 2210b996097b1407b908468386dc884ace2ba0ca80b1d10784ced7b0e7279052b2d7bf3d4920a01528f92674034c8666dfc4f4ec5f44b1045e3c86e858fd6bac SHA512 f01080a8bc3dc26b230ad76aea48160978d59098f1fc98c370aa5c7aa52594a7ab4fdfe3337107bc9e5964e5c9414056b40c2fd4c3b67a8359c5a0928d7801db
MISC metadata.xml 1109 BLAKE2B dca4e56f03e8e8f5ea21770d0e9b7ec96178558396b39a6d8a1ed887f9058abdda07e3a7b750c408e7227e44f71e174d50681cf29343f5c30b481eaf2cd45077 SHA512 37b3354880d810b34493b13e788c668fa64bc3f36350aa7465273bba26f1a68348dc7803a8c6528129aa86b028c992d4246411749e36b194e83800224ff23462
diff --git a/net-misc/frr/files/frr-openrc-v2 b/net-misc/frr/files/frr-openrc-v2
new file mode 100644
index 000000000000..24e326ed84a7
--- /dev/null
+++ b/net-misc/frr/files/frr-openrc-v2
@@ -0,0 +1,301 @@
+#!/sbin/openrc-run
+#
+# FRR OpenRC init script.
+#
+# Copyright (C) 2020 Rafael F. Zalamena
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; only version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+description="FRR initialization script."
+
+# FRR variables.
+frr_dir="/usr/lib/frr"
+frr_state_dir="/run/frr"
+config_file="/etc/frr/frr.conf"
+daemon_file="/etc/frr/daemons"
+daemon_db="/run/frrdb"
+vty_config_file="/etc/frr/vtysh.conf"
+frr_reload="$frr_dir/frr-reload.py"
+frr_reload_log="$frr_state_dir/reload.log"
+
+# Don't change profile here, use $daemon_file. This is the default.
+frr_profile="traditional"
+
+# watchfrr variables.
+watchfrr_daemons=''
+watchfrr_pidfile="$frr_state_dir/watchfrr.pid"
+
+#
+# Helpers.
+#
+_check_daemon_binary() {
+ local daemon=$1
+
+ [ -x "$frr_dir/$daemon" ] && return 0
+
+ eerror "No binary found for $daemon in $frr_dir"
+ return 1
+}
+
+_load_daemon_list() {
+ # Load FRR daemons configuration file.
+ while read line <&3 ; do
+ case $line in
+ ""|"#"*)
+ # Skip empty/commented lines.
+ continue
+ ;;
+
+ *d=*|*_instances=*|*_options=*|*_wrap=*)
+ # Load daemon options.
+ eval "$line"
+ ;;
+
+ MAX_FDS=*|frr_profile=*|vtysh_enable=*)
+ # Load misc configuration.
+ eval "$line"
+ ;;
+ esac
+ done 3< $daemon_file
+
+ # `zebra` and `staticd` are mandatory.
+ _check_daemon_binary 'zebra' || return 1
+ _check_daemon_binary 'staticd' || return 1
+ watchfrr_daemons='zebra staticd'
+
+ # Create the watchfrr command line.
+ for daemon in \
+ babeld bfdd bgpd eigrpd fabricd isisd ldpd nhrpd ospfd ospf6d pbrd \
+ pimd ripd ripngd sharpd vrrpd \
+ ; do
+ # Trick to read variable name with variable.
+ cdaemon=$(eval echo \$$daemon)
+ cdaemon_instances=$(eval echo \$${daemon}_instances)
+
+ # Add daemon to command line if specified.
+ if [ ! -z $cdaemon ] && [ $cdaemon = 'yes' ]; then
+ _check_daemon_binary $daemon || return 1
+
+ # Multi instance daemon handling.
+ if [ ! -z $cdaemon_instances ]; then
+ for instance in $(echo $cdaemon_instances | tr ',' ' '); do
+ watchfrr_daemons="$watchfrr_daemons $daemon-$instance"
+ done
+ continue
+ fi
+
+ # Single instance daemon handling.
+ watchfrr_daemons="$watchfrr_daemons $daemon"
+ continue
+ fi
+ done
+}
+
+_frr_start() {
+ # Apply MAX_FDS configuration if set.
+ if [ ! -z $MAX_FDS ]; then
+ veinfo " Setting maximum file descriptors to ${MAX_FDS}"
+ prlimit -n $MAX_FDS >/dev/null 2>/dev/null
+ fi
+
+ # Save started daemons to state database.
+ rm -f -- $daemon_db
+ for daemon in $watchfrr_daemons; do
+ echo $daemon >> $daemon_db
+ veinfo " Starting $daemon..."
+ done
+
+ veinfo " Starting watchfrr..."
+
+ # Start watchfrr which will start all configured daemons.
+ eval $all_wrap $frr_dir/watchfrr -d -F $frr_profile $watchfrr_daemons
+
+ veinfo " Loading configuration..."
+
+ # After starting the daemons, lets load the configuration.
+ if [ $vtysh_enable = 'yes' ]; then
+ vtysh -b -n
+ else
+ veinfo " Configuration loading disabled (vtysh_enable=$vtysh_enable)"
+ fi
+}
+
+_get_pid() {
+ local daemon=$1
+ local pid_file="$frr_state_dir/$daemon.pid"
+
+ # Test for file existence.
+ if [ ! -r "$pid_file" ]; then
+ eerror "Failed to find or read $daemon pid file"
+ return 1
+ fi
+
+ # Get PID if any.
+ pid=$(cat $pid_file)
+ if [ -z $pid ]; then
+ eerror "$daemon PID file empty"
+ return 1
+ fi
+
+ return 0
+}
+
+_stop_daemon() {
+ local daemon=$1
+ local pid_file="$frr_state_dir/$daemon.pid"
+
+ # Get daemon pid.
+ _get_pid $daemon
+
+ # Ask daemon to quit.
+ kill -2 "$pid"
+
+ # Test if daemon is still running.
+ attempts=1200
+ while kill -0 "$pid" 2>/dev/null; do
+ sleep 0.5
+ [ $((attempts - 1)) -gt 0 ] || break
+ done
+
+ # Tell user about our situation.
+ if kill -0 "$pid" 2>/dev/null ; then
+ eerror "Failed to stop $daemon (PID=${pid})"
+ return 1
+ else
+ rm -f -- $pid_file
+ fi
+}
+
+_frr_stop() {
+ local failures=0
+
+ # Stop watchfrr first so it doesn't restart anyone.
+ veinfo " Stopping watchfrr..."
+ _stop_daemon watchfrr || failures=1
+
+ # Read started daemon database.
+ while read line <&3 ; do
+ case $line in
+ ""|"#"*)
+ # Skip empty/commented lines.
+ continue
+ ;;
+
+ *)
+ # Get daemon name.
+ veinfo " Stopping $line..."
+ _stop_daemon $line || failures=1
+ ;;
+ esac
+ done 3< $daemon_db
+
+ # Remove daemon database file.
+ rm -f -- $daemon_db
+
+ return $failures
+}
+
+_check_watchfrr() {
+ _get_pid watchfrr || return 1
+ return 0
+}
+
+#
+# Main.
+#
+depend() {
+ # We need root to write logs.
+ need localmount
+ # Optionally wait for network to start.
+ use net
+ # Expect /run to be ready.
+ after bootmisc
+}
+
+start_pre() {
+ # Check configuration file readability.
+ checkpath -f -m 0640 -o frr:frr $vty_config_file
+ checkpath -f -m 0640 -o frr:frr $daemon_file
+ checkpath -f -m 0640 -o frr:frr $config_file
+
+ # Check run state directory.
+ checkpath -d -o frr $frr_state_dir
+
+ # Load daemon list and peform checks.
+ _load_daemon_list
+}
+
+start() {
+ # Load daemon list.
+ _load_daemon_list
+
+ # Handle restarts.
+ if [ "$RC_CMD" = 'restart' ]; then
+ ebegin 'Reloading FRR configuration'
+ else
+ ebegin 'Starting FRR'
+ fi
+
+ # Start FRR.
+ _frr_start
+
+ # New daemons and watchfrr started, apply new configuration.
+ if [ "$RC_CMD" = 'restart' ]; then
+ "$frr_reload" --reload "$config_file" 2>/run/frr/reload.log
+ [ $? -ne 0 ] && ewarn " Failed to reload (check $frr_reload_log)"
+ # NOTE: we can't return bad status otherwise OpenRC will think we
+ # failed to start, lets print a helpful message instead.
+ fi
+
+ eend 0
+}
+
+stop() {
+ local failures=0
+
+ # Handle restarts.
+ if [ "$RC_CMD" = 'restart' ]; then
+ # Load daemon list.
+ _load_daemon_list
+
+ # We must restart 'watchfrr' in order to start new daemons.
+ veinfo " Stopping watchfrr..."
+ _stop_daemon watchfrr
+
+ # Stop daemons that are no longer in configuration file.
+ for daemon in $(ls -1 /run/frr/*.pid | cut -d '.' -f 1); do
+ # Filter daemon name.
+ daemon=$(basename "$daemon")
+
+ # Skip watchfrr.
+ [ "$daemon" = 'watchfrr' ] && continue
+
+ echo "$watchfrr_daemons" | grep "$daemon" >/dev/null
+ if [ $? -ne 0 ]; then
+ veinfo " Stopping $daemon..."
+ _stop_daemon $daemon
+ fi
+ done
+
+ return 0
+ fi
+
+ ebegin 'Stopping FRR'
+ _frr_stop || failures=1
+ eend $failures 'some daemons failed to stop'
+}
+
+status() {
+ _check_watchfrr || return 1
+}
diff --git a/net-misc/frr/frr-8.5.2.ebuild b/net-misc/frr/frr-8.5.2-r1.ebuild
index dedac1e7cf84..3d4d9aba14d7 100644
--- a/net-misc/frr/frr-8.5.2.ebuild
+++ b/net-misc/frr/frr-8.5.2-r1.ebuild
@@ -48,6 +48,7 @@ RDEPEND="
${COMMON_DEPEND}
$(python_gen_cond_dep 'dev-python/ipaddr[${PYTHON_USEDEP}]')
!net-misc/quagga
+ sys-apps/util-linux
"
PATCHES=(
@@ -142,7 +143,7 @@ src_install() {
# Install init scripts
systemd_dounit tools/frr.service
- newinitd "${FILESDIR}"/frr-openrc-v1 frr
+ newinitd "${FILESDIR}"/frr-openrc-v2 frr
# Conflict files, installed by net-libs/libsmi, bug #758383
rm "${ED}"/usr/share/yang/ietf-interfaces.yang || die