FRR_USER="@enable_user@" # frr
FRR_GROUP="@enable_group@" # frr
FRR_VTY_GROUP="@enable_vty_group@" # frrvty
+FRR_DEFAULT_PROFILE="@DFLT_NAME@" # traditional / datacenter
# 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 babeld pimd ldpd nhrpd eigrpd sharpd pbrd staticd bfdd fabricd"
+DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld pimd ldpd nhrpd eigrpd sharpd pbrd staticd bfdd fabricd vrrpd"
MAX_INSTANCES=5
RELOAD_SCRIPT="$D_PATH/frr-reload.py"
# The Frr daemons creates the pidfile when starting.
start()
{
- ulimit -n $MAX_FDS
- if [ "$1" = "watchfrr" ]; then
+ local dmn inst
+ dmn="$1"
+ inst="$2"
+
+ ulimit -n $MAX_FDS > /dev/null 2> /dev/null
+ 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
-
+ eval "set - $watchfrr_options"
${SSD} \
--start \
- --pidfile=`pidfile $1` \
- --exec "$D_PATH/$1" \
+ --pidfile=`pidfile $dmn` \
+ --exec "$D_PATH/$dmn" \
-- \
- "${watchfrr_options[@]}"
+ "$@"
- 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
${SSD} \
--start \
- --pidfile=`pidfile $1-$2` \
- --exec "$D_PATH/$1" \
+ --pidfile=`pidfile $dmn-$inst` \
+ --exec "$D_PATH/$dmn" \
-- \
- `eval echo "$""$1""_options"` -n "$2"
+ `eval echo "$""$dmn""_options"` $frr_global_options -n "$inst"
else
- if ! check_daemon $1; then
+ if ! check_daemon $dmn; then
echo -n " (binary does not exist)"
return;
fi
if [ "$valgrind_enable" = "yes" ]; then
${SSD} \
--start \
- --pidfile=`pidfile $1` \
+ --pidfile=`pidfile $dmn` \
--exec "$valgrind" \
- -- --trace-children=no --leak-check=full --log-file=/var/log/frr/$1-valgrind.log $D_PATH/$1 \
- `eval echo "$""$1""_options"`
+ -- --trace-children=no --leak-check=full --log-file=/var/log/frr/$dmn-valgrind.log $D_PATH/$dmn \
+ `eval echo "$""$dmn""_options"` $frr_global_options
else
${SSD} \
--start \
- --pidfile=`pidfile $1` \
- --exec "$D_PATH/$1" \
+ --pidfile=`pidfile $dmn` \
+ --exec "$D_PATH/$dmn" \
-- \
- `eval echo "$""$1""_options"`
+ `eval echo "$""$dmn""_options"` $frr_global_options
fi
fi
# Start the staticd automatically
- if [ "$1" = "zebra" ]; then
+ if [ "$dmn" = "zebra" ]; then
echo -n "starting staticd since zebra is running"
if ! check_daemon staticd ; then
echo -n " (binary does not exist)"
--pidfile=`pidfile staticd` \
--exec "$D_PATH/staticd" \
-- \
- `eval echo "$"staticd"_options"`
+ `eval echo "$"staticd"_options"` $frr_global_options
fi
}
fi
# Check variable type
- if ! declare -p watchfrr_options | grep -q '^declare \-a'; then
- echo
- echo "ERROR: The variable watchfrr_options from /etc/frr/debian.cnf 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
# Load configuration
. "$C_PATH/daemons"
-. "$C_PATH/daemons.conf"
+if [ -e "$C_PATH/daemons.conf" ]; then
+ . "$C_PATH/daemons.conf"
+fi
# Read configuration variable file if it is present
[ -r /etc/default/frr ] && . /etc/default/frr
+if test -z "$frr_profile"; then
+ # try to autodetect config profile
+ if test -d /etc/cumulus; then
+ frr_profile=datacenter
+ # elif test ...; then
+ # -- add your distro/system here
+ elif test -n "$FRR_DEFAULT_PROFILE"; then
+ frr_profile="$FRR_DEFAULT_PROFILE"
+ fi
+fi
+test -n "$frr_profile" && frr_global_options="$frr_global_options -F $frr_profile"
+
MAX_INSTANCES=${MAX_INSTANCES:=5}
# Set priority of un-startable daemons to 'no' and substitute 'yes' to '0'
stop_prio 0 $dmn
fi
- if [ -z "$dmn" -o "$dmn" = "zebra" ]; then
- echo "Removing all routes made by FRR."
- # Specific values for each proto can be found
- # in /etc/iproute2/rt_protos as well as FRR
- # specific ones in /etc/iproute2/rt_protos.d
- # Additionally if a new protocol is added
- # we need to add it here as well as
- # in rt_netlink.h( follow the directions! )
- ip route flush proto 4
- ip route flush proto 11
- ip route flush proto 42
- 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
- ip route flush proto 195
- ip route flush proto 196
- ip route flush proto 197
- else
+ if [ -n "$dmn" -a "$dmn" != "zebra" ]; then
[ -n "$dmn" ] && eval "${dmn/-/_}=0"
start_watchfrr
fi