From nobody Tue Sep 24 13:52:24 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XChBJ532Kz5Xpfr; Tue, 24 Sep 2024 13:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XChBJ4W0Lz45HF; Tue, 24 Sep 2024 13:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727185944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7r2hEaRI5ytqmltY7jPMCgYAF/FLerU25/YMYVugMbo=; b=DTo5upQx8Flg4pZDJY1oGsSDTeMBYO8ivYRshpbCLJlAVRNWqUK54+8uEmnvW00WJy+L/n mjtRQ4QZkL2UiFeO6OMaRYcn+OrFmERVCXH0X4rM81TNKx0GxzmcU91WvtopeSkKSiS1RI S4noCjXcTmNTeGo4A4F4Hp0/pvXuH5wN2929KD/KQXM3Hb+oXNJ7aJUKMtVkB4P5giP7if yY3xK2h0jKvimKfH4W43o3/nd9pC7XZabiMucFPzh0INxUWWm4dzS60jcC7aywmh8pqAby pNZK6Lg0HIJzZH3znfi5RpqTiqz0eYD2lufpwpJBp5WNXlyYsgogv6XM7Krb1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727185944; a=rsa-sha256; cv=none; b=VvXsVSQem8MXm1wlBmyLvvOAMv2964+y14ivaTmjH3Sy2pJ8Ia3UrxGwSsptCtfnyRDdjK q8fGV9YEqdgv93jhLNTvXJKg4A8/Cav0pv9omVcA4ydzCgIkSwQAcJ0qI5Gb7vJpZXFyel jrm0nBHgUETnL2BtUHm+xvSk2aFth3O6OjzYAWmzRDxzqUAKMZq6lNVxEcxHK4moPe0q6r PfqOufQ7s3NCK7YArnAAcFuGGnG0zB8RSP64a26fgtac6g7Ep9n7M2xWj2B+cjGXcN6C5E JaRLktQ/+zOqdOx0wGWwCypOSl1LQNu8m8DzSbOz78OpuEc3v29boJLSRSXFOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727185944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7r2hEaRI5ytqmltY7jPMCgYAF/FLerU25/YMYVugMbo=; b=Yf6OuVvrjq39mW3Uo7I17dT41yG2BQFeFdPR+Lv0HHuJS+WDu2lZ7uc/Hahymbemql+ufZ r0xP65Ja/TBEz1WIv+28SEAb2k+g32T4HbiOx9+yK1Uv+SXa0lp82v/cWBazqRHSbzacMe Rn6su8A2hl3QOHGZXWRRQ5YgP6jFLen5pyFBIhTmYkebXH9G9vwbX71kSy2ane8MAKkPoG zMJqOnpMaMCFzv7wO6RQecanDbrl8peN1YqxUNeJYJRCs3rjo8fKa3QnrQ2dplIyi1DjFi UK5i9Ei+liUMgX9jQVpU9sCUKK/IHCkMQnXKnl/zxqU4RaePLWHvfdXUE0q9SA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XChBJ41NtzXNb; Tue, 24 Sep 2024 13:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48ODqOBd050902; Tue, 24 Sep 2024 13:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48ODqOcj050899; Tue, 24 Sep 2024 13:52:24 GMT (envelope-from git) Date: Tue, 24 Sep 2024 13:52:24 GMT Message-Id: <202409241352.48ODqOcj050899@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Olivier Cochard Subject: git: 6a7dc56034b9 - main - net/frr9: Update to 9.1.2 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olivier X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a7dc56034b90164f034110c5517c66e7258b506 Auto-Submitted: auto-generated The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/ports/commit/?id=6a7dc56034b90164f034110c5517c66e7258b506 commit 6a7dc56034b90164f034110c5517c66e7258b506 Author: Olivier Cochard AuthorDate: 2024-09-24 12:56:45 +0000 Commit: Olivier Cochard CommitDate: 2024-09-24 13:46:43 +0000 net/frr9: Update to 9.1.2 The RC script was almost completely rewritten to align with upstream and match the new defaults: - Use integrated mode (only one configuration file); - Use watchfrr, which is responsible for starting, monitoring, and stopping daemons; - Use the upstream recommended flags for all daemons (vty bound to localhost). ChangeLog: https://github.com/FRRouting/frr/releases/tag/frr-9.1.2 Reported by: portscout --- net/frr9/Makefile | 5 +- net/frr9/distinfo | 6 +- net/frr9/files/frr.in | 234 ++++++++++++++++++++++++++++++--------------- net/frr9/files/watchfrr.in | 30 ------ 4 files changed, 161 insertions(+), 114 deletions(-) diff --git a/net/frr9/Makefile b/net/frr9/Makefile index 1f12d03af354..98bc65f70895 100644 --- a/net/frr9/Makefile +++ b/net/frr9/Makefile @@ -1,5 +1,5 @@ PORTNAME= frr -PORTVERSION= 9.1.1 +PORTVERSION= 9.1.2 DISTVERSIONPREFIX= frr- CATEGORIES= net .if defined(PYTHONTOOLS) @@ -9,7 +9,6 @@ PKGNAMESUFFIX= 9 .endif MAINTAINER= olivier@FreeBSD.org - COMMENT?= IP routing protocol suite including BGP, IS-IS, OSPF, BABEL and RIP WWW= https://frrouting.org/ @@ -129,7 +128,7 @@ SNMP_USES= ssl TCMALLOC_CONFIGURE_ENABLE= tcmalloc TCMALLOC_LIB_DEPENDS= libtcmalloc.so:devel/google-perftools -USE_RC_SUBR= frr watchfrr +USE_RC_SUBR= frr SHEBANG_FILES= yang/embedmodel.py diff --git a/net/frr9/distinfo b/net/frr9/distinfo index 60611c714de1..d80c83451239 100644 --- a/net/frr9/distinfo +++ b/net/frr9/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1719590101 -SHA256 (FRRouting-frr-frr-9.1.1_GH0.tar.gz) = 6eb254c72dca867fefffd5ded80a6c2d5ce8df223ce93263302db4b8bfbb19c4 -SIZE (FRRouting-frr-frr-9.1.1_GH0.tar.gz) = 10788437 +TIMESTAMP = 1727171441 +SHA256 (FRRouting-frr-frr-9.1.2_GH0.tar.gz) = a23ab9aba5c45d919f9c6d14febfad8a797b7f63272bde4009c70ff77aac3a77 +SIZE (FRRouting-frr-frr-9.1.2_GH0.tar.gz) = 10790677 diff --git a/net/frr9/files/frr.in b/net/frr9/files/frr.in index a62055d75d3e..092f2f5485fc 100644 --- a/net/frr9/files/frr.in +++ b/net/frr9/files/frr.in @@ -6,16 +6,39 @@ # Add the following line to /etc/rc.conf to enable frr: # frr_enable="YES" -# + +# FRR's daemon management concept: +# - watchfrr is used to manage (start/monitor/restart) all frr deamons; +# - vtysh used to daemons boot startup configuration; +# - mgmtd is the management plane. +# There are a minimum of 3 daemons running: watchfrr, zebra, mgmtd + +# Startup details with watchfrr enabled (default): +# 1. "service frr start" calls "service frr start watchfrr" +# 2. watchfrr once started calls "service frr restart all" +# 3. "restart all" need to loop the list of $frr_daemons to start each +# of then +# 4. vtysh -b is executed to load boot startup configuration + +# Startup detail with watchfrr disabled (deprecated mode): +# 1. "service frr start" call "service frr start all" and need to loop $frr_daemons + +# To select a limited set of daemons to run, use the frr_daemons. +# Order matters: keep mgmtd first, followed by zebra. +# Example to start only staticd and bgpd: +# frr_daemons="mgmtd zebra staticd bgpd" + # You may also wish to use the following variables to fine-tune startup: -# Enable Integrated configuration mode (using the single configuration file -# frr.conf in place of one file for each dameon) -# frr_vtysh_boot="YES" -# Selecting limited set of daemons to run -# frr_daemons="zebra mgmtd babeld bfdd bgpd eigrpd fabricd isisd ospfd ospf6d ripd ripngd staticd" +# To disable integrated configuration mode, to use one configuration file per +# daemons. +# This mode is deprecated and not compatible with watchfrr and mgmtd +# frr_vtysh_boot="NO" +# watchfrr_enable="NO" + # Global tuning # frr_flags="" -# Per daemon tuning may be done with daemon_name_flags +# frr_default_profile="datacenter" (default: traditional) +# Per daemon tuning may be done with daemon-name_flags # zebra_flags="-P 0" # bgpd_flags="-nrP 0" and so on # If you want to give the routing daemons a chance to catchup before @@ -28,7 +51,10 @@ # use the following variable to run ldconfig(8) in advance: # frr_extralibs_path="/usr/local/lib ..." # -# This RC script was adapted from the net/quagga port +# This RC script was adapted from: +# - FRR's tools/frrinit.sh.in (starting watchfrr) +# - FRR's tools/frrcommon.sh.in (starting frr daemons) +# - FRR's tools/etc/frr/daemons (default daemon flags) . /etc/rc.subr @@ -36,39 +62,34 @@ name=frr rcvar=${name}_enable start_postcmd=start_postcmd -stop_postcmd="rm -f $pidfile" -configtest_cmd=check_config -extra_commands=configtest command_args="-d" load_rc_config $name : ${frr_enable:="NO"} : ${frr_flags:=""} -: ${frr_daemons:="zebra mgmtd babeld bfdd bgpd eigrpd fabricd isisd ospfd ospf6d ripd ripngd staticd"} -: ${frr_vtysh_boot:="NO"} +: ${watchfrr_enable:="YES"} +: ${frr_daemons:="mgmtd zebra babeld bfdd bgpd eigrpd fabricd isisd ospfd ospf6d ripd ripngd staticd"} +: ${watchfrr_flags:="-r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30"} +: ${frr_default_profile:="traditional"} +: ${frr_vtysh_boot:="YES"} : ${frr_wait_for:=""} : ${frr_wait_seconds:="90"} +# Default daemons'flag restrict binding vty's to localhost +: ${zebra_flags:="-A 127.0.0.1"} +: ${mgmtd_flags:="-A 127.0.0.1"} +: ${babeld_flags:="-A 127.0.0.1"} +: ${bgpd_flags:="-A 127.0.0.1"} +: ${eigrpd_flags:="-A 127.0.0.1"} +: ${fabricd_flags:="-A 127.0.0.1"} +: ${isisd_flags:="-A 127.0.0.1"} +: ${ospfd_flags:="-A 127.0.0.1"} +: ${ospf6d_flags:="-A ::1"} +: ${ripd_flags:="-A 127.0.0.1"} +: ${ripngd_flags:="-A ::1"} +: ${staticd_flags:="-A 127.0.0.1"} +frr_flags="${frr_flags} -F ${frr_default_profile}" -check_config() -{ - echo "Checking $daemon.conf" - # pimd doesn't support -C - if [ "$daemon" = "pimd" -o "$daemon" = "staticd" ]; then - echo "confchk $daemon ignored" - else - $command $daemon_flags -C - result=$? - if [ "$result" -eq "0" ]; then - echo "OK" - else - echo "FAILED" - exit - fi - fi -} - -start_postcmd() -{ +start_postcmd() { local waited_for waited_for=0 # Wait only when last daemon has started. @@ -86,50 +107,61 @@ start_postcmd() fi } -do_cmd() -{ +do_cmd() { + # Entering here, global var dmn contains the daemon name + # $1 the daemon name (must be uniq and cannot be all) local ret + local cmd + local dmn ret=0 - frr_cmd=$1 - if checkyesno frr_vtysh_boot && ( [ ${frr_cmd} = "restart" ] || [ ${frr_cmd} = "start" ] ); then - echo "Checking intergrated config..." - daemon="vtysh" - daemon_flags="" - command=%%PREFIX%%/bin/${daemon} - if ! [ -f %%ETCDIR%%/vtysh.conf ]; then - touch %%ETCDIR%%/vtysh.conf + dmn=$1 + if [ -n "${dmn}" ] && [ "${dmn}" != "all" ]; then + command=%%PREFIX%%/sbin/${dmn} + pidfile=/var/run/frr/${dmn}.pid + eval flags=\$\{${dmn}_flags:-\"\"\} + flags="${flags} ${frr_flags}" + if [ "${dmn}" = "watchfrr" ]; then + # watchfrr is expecting all daemon names as flags + flags="${flags} ${watchfrr_daemons}" fi - check_config + name=${dmn} + _rc_restart_done=false + stop_postcmd="rm -f $pidfile" + run_rc_command "${frr_cmd}" || ret=1 + else + echo "Bug in do_cmd(): called without argument or with all" + ret=1 fi + return ${ret} +} + +vtysh_b () { + local ret + ret=0 + if checkyesno frr_vtysh_boot; then + %%PREFIX%%/bin/vtysh -b || ret=1 + fi + return ${ret} +} + +loop_do_cmd() { + local ret + local daemon + ret=0 for daemon in ${frr_daemons}; do - command=%%PREFIX%%/sbin/${daemon} - pidfile=/var/run/frr/${daemon}.pid - if ! checkyesno frr_vtysh_boot; then - required_files=%%ETCDIR%%/${daemon}.conf - if [ ${frr_cmd} = "restart" ] || [ ${frr_cmd} = "start" ]; then - check_config - fi - if [ ${frr_cmd} = "start" ] && ! [ -f ${required_files} ]; then - continue - fi - fi - if [ ${frr_cmd} = "stop" ] && [ -z "$(check_process ${command})" ]; then - continue - fi - eval flags=\$\{${daemon}_flags:-\"${frr_flags}\"\} - name=${daemon} - _rc_restart_done=false - run_rc_command "$1" || ret=1 + do_cmd ${daemon} || ret=1 done - if checkyesno frr_vtysh_boot && ( [ ${frr_cmd} = "restart" ] || [ ${frr_cmd} = "start" ] ); then - echo "Booting for integrated-vtysh-config..." - %%PREFIX%%/bin/vtysh -b + if ( [ ${frr_cmd} = "restart" ] || [ ${frr_cmd} = "start" ] ); then + vtysh_b || ret=1 fi return ${ret} } frr_cmd=$1 +# remove unsuported extra command +# Example: "service frr fast start" is replaced by "service frr start" + case "$1" in force*) frr_cmd=${frr_cmd#force} @@ -140,29 +172,75 @@ case "$1" in esac shift -if [ $# -ge 1 -a "$1" != "all" ]; then - frr_daemons="$*" +# If daemon specified, replace the full list by its name +# or with watchfrr if not disabled +# Example: extract "bgpd" from a "service frr start bgpd" +if [ $# -ge 1 ]; then + if [ "$1" != "all" ]; then + frr_daemons=$1 + fi +else + if checkyesno watchfrr_enable; then + watchfrr_daemons=${frr_daemons} + frr_daemons=watchfrr + fi fi case "${frr_cmd}" in start|quietstart) - if [ -n "${frr_extralibs_path}" ]; then - /sbin/ldconfig -m ${frr_extralibs_path} + if checkyesno frr_enable; then + if [ -n "${frr_extralibs_path}" ]; then + /sbin/ldconfig -m ${frr_extralibs_path} + fi + if [ -x %%PREFIX%%/etc/rc.d/watchfrr ]; then + echo "WARNING: Old rc.d/watchfrr detected, this file must be deleted" + fi + if checkyesno frr_vtysh_boot; then + echo "Checking intergrated config..." + if ! [ -f %%ETCDIR%%/vtysh.conf ]; then + mkdir -p %%ETCDIR%% + echo "service integrated-vtysh-config" > %%ETCDIR%%/vtysh.conf + fi + if ! [ -f %%ETCDIR%%/frr.conf ]; then + echo "log syslog informational" > %%ETCDIR%%/frr.conf + fi + chown -R frr:frr %%ETCDIR%% + fi + loop_do_cmd fi - # Why should I need to add this check ? - checkyesno frr_enable && do_cmd "start" ;; stop) - frr_daemons=$(reverse_list ${frr_daemons}) - do_cmd "stop" + if checkyesno frr_enable; then + # watchfrr do not stop all daemons, so need to stop it first + # then continuing with all others daemons + if [ "${frr_daemons}" = "watchfrr" ]; then + loop_do_cmd + frr_daemons=${watchfrr_daemons} + fi + frr_daemons=$(reverse_list ${frr_daemons}) + loop_do_cmd + fi ;; restart) - frr_daemons=$(reverse_list ${frr_daemons}) - do_cmd "stop" - frr_daemons=$(reverse_list ${frr_daemons}) - checkyesno frr_enable && do_cmd "start" + if checkyesno frr_enable; then + # watchfrr calls "service frr restart all" at startup + # to start all services + frr_daemons=$(reverse_list ${frr_daemons}) + frr_cmd=stop + loop_do_cmd + frr_daemons=$(reverse_list ${frr_daemons}) + frr_cmd=start + loop_do_cmd + fi + ;; + reload) + if ! [ -x %%PREFIX%%/sbin/frr-reload.py ]; then + echo "Please install frr-pythontools package. Required for reload" + exit 0 + fi + %%PREFIX%%/sbin/frr-reload.py --reload --confdir %%ETCDIR%% --rundir /var/run/frr %%ETCDIR%%/frr.conf ;; *) - do_cmd "${frr_cmd}" + loop_do_cmd ;; esac diff --git a/net/frr9/files/watchfrr.in b/net/frr9/files/watchfrr.in deleted file mode 100644 index f3a36434e7f6..000000000000 --- a/net/frr9/files/watchfrr.in +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# PROVIDE: watchfrr -# REQUIRE: NETWORKING frr -# KEYWORD: nojailvtnet shutdown - -# Add the following line to /etc/rc.conf to enable watchfrr: -# watchfrr_enable="YES" -# -# You may also wish to use the following variables to fine-tune startup: -# watchfrr_flags -# Example of flags usage: -# watchfrr_flags=" -d -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30 zebra ripd ripngd ospfd ospf6d bgpd isisd eigrpd babeld bfdd staticd" - -. /etc/rc.subr - -name=watchfrr -rcvar=${name}_enable - -load_rc_config $name - -stop_postcmd="rm -f $pidfile" - -watchfrr_enable=${watchfrr_enable:-"NO"} -watchfrr_flags=${watchfrr_flags:-"-d -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30 zebra babeld bfdd bgpd eigrpd fabricd isisd ospfd ospf6d ripd ripngd staticd"} - -command=%%PREFIX%%/sbin/watchfrr -pidfile=/var/run/frr/watchfrr.pid - -run_rc_command "$1"