#
# chkconfig: 2345 15 85
#
-# description: FRRouting (FRR) is a routing suite for IP routing protocols
+# description: FRRouting (FRR) is a routing suite for IP routing protocols
# like BGP, OSPF, RIP and others. This script contols the main
# daemon "frr" as well as the individual protocol daemons.
#
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop the FRR Routing daemons
-# Description: FRRouting (FRR) is a routing suite for IP routing protocols
+# Description: FRRouting (FRR) is a routing suite for IP routing protocols
# like BGP, OSPF, RIP and others. This script contols the main
# daemon "frr" as well as the individual protocol daemons.
### END INIT INFO
# Local Daemon selection may be done by using /etc/frr/daemons.
# See /usr/share/doc/frr/README.Debian.gz for further information.
# Keep zebra first and do not list watchfrr!
-DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd pimd ldpd nhrpd"
+DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd pimd pbrd ldpd nhrpd eigrpd babeld staticd sharpd bfdd fabricd"
MAX_INSTANCES=5
RELOAD_SCRIPT=/usr/lib/frr/frr-reload.py
# The Frr daemons creates the pidfile when starting.
start()
{
+ local dmn inst
+ dmn="$1"
+ inst="$2"
+
ulimit -n $MAX_FDS > /dev/null 2> /dev/null
- if [ "$1" = "watchfrr" ]; then
+ if [ "$dmn" = "watchfrr" ]; then
# We may need to restart watchfrr if new daemons are added and/or
# removed
- if started "$1" ; then
+ if started "$dmn" ; then
stop watchfrr
else
# Echo only once. watchfrr is printed in the stop above
- echo -n " $1"
+ echo -n " $dmn"
fi
if [ -e /var/run/frr/watchfrr.started ] ; then
rm /var/run/frr/watchfrr.started
fi
- daemon --pidfile=`pidfile $1` "$D_PATH/$1" -d "${watchfrr_options[@]}"
+ # redhat /etc/init.d/functions daemon() re-expands args :(
+ # eval "set - $watchfrr_options"
+ daemon --pidfile=`pidfile $dmn` "$D_PATH/$dmn" -d "$watchfrr_options"
RETVAL=$?
[ $RETVAL -ne 0 ] && break
for i in `seq 1 10`;
fi
done
RETVAL=1
- elif [ -n "$2" ]; then
- echo -n " $1-$2"
- if ! check_daemon $1 $2 ; then
+ elif [ -n "$inst" ]; then
+ echo -n " $dmn-$inst"
+ if ! check_daemon $dmn $inst ; then
echo -n " (binary does not exist)"
return;
fi
- daemon --pidfile=`pidfile $1-$2` "$D_PATH/$1" -d `eval echo "$""$1""_options"` -n "$2"
+ daemon --pidfile=`pidfile $dmn-$inst` "$D_PATH/$dmn" -d `eval echo "$""$dmn""_options"` -n "$inst"
RETVAL=$?
else
- echo -n " $1 "
- if ! check_daemon $1; then
+ echo -n " $dmn "
+ if ! check_daemon $dmn; then
echo " (binary does not exist)"
return;
fi
- daemon --pidfile=`pidfile $1` "$D_PATH/$1" -d `eval echo "$""$1""_options"`
+ daemon --pidfile=`pidfile $dmn` "$D_PATH/$dmn" -d `eval echo "$""$dmn""_options"`
RETVAL=$?
fi
echo
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$1
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$dmn
return $RETVAL
}
fi
# Check variable type
- if ! declare -p watchfrr_options | grep -q '^declare \-a'; then
- echo
- echo "ERROR: The variable watchfrr_options from /etc/frr/daemons must be a BASH array!"
- echo "ERROR: Please convert config file and restart!"
- exit 1
+ if declare -p watchfrr_options | grep -q '^declare \-a'; then
+ # old array support
+ watchfrr_options="${watchfrr_options[@]}"
fi
# Which daemons have been started?
eval "inst_disable=\${${daemon_name}_${inst}}"
if [ -z ${inst_disable} ] || [ ${inst_disable} != 0 ]; then
if check_daemon $daemon_name $inst; then
- watchfrr_options+=("${daemon_name}-${inst}")
+ watchfrr_options="$watchfrr_options ${daemon_name}-${inst}"
fi
fi
done
else
if check_daemon $daemon_name; then
- watchfrr_options+=($daemon_name)
+ watchfrr_options="$watchfrr_options $daemon_name"
fi
fi
found_one=1
if [ -z "$dmn" -o "$dmn" = "zebra" ]; then
echo "Removing all routes made by zebra."
ip route flush proto zebra
+ # At least in CentOS/RHEL 6, iproute2 doesn't know
+ # about the new protocol names, so we have to flush them
+ # by number (it also doesn't support rt_protos.d
+ ip route flush proto 186
+ ip route flush proto 187
+ ip route flush proto 188
+ ip route flush proto 189
+ ip route flush proto 190
+ ip route flush proto 191
+ ip route flush proto 192
+ ip route flush proto 193
+ ip route flush proto 194
else
[ -n "$dmn" ] && eval "${dmn/-/_}=0"
start_watchfrr