2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
quagga.py: defines routing services provided by Quagga.
|
|
|
|
"""
|
2020-06-18 20:54:36 +01:00
|
|
|
from typing import Optional, Tuple
|
|
|
|
|
2020-01-07 22:08:29 +00:00
|
|
|
import netaddr
|
2013-08-29 15:21:13 +01:00
|
|
|
|
2019-09-28 06:31:56 +01:00
|
|
|
from core.emane.nodes import EmaneNet
|
2019-09-26 21:00:12 +01:00
|
|
|
from core.emulator.enumerations import LinkTypes
|
2020-06-18 20:54:36 +01:00
|
|
|
from core.nodes.base import CoreNode
|
|
|
|
from core.nodes.interface import CoreInterface
|
2019-09-26 21:00:12 +01:00
|
|
|
from core.nodes.network import PtpNet, WlanNode
|
|
|
|
from core.nodes.physical import Rj45Node
|
2019-04-30 07:31:47 +01:00
|
|
|
from core.services.coreservices import CoreService
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2020-06-23 05:39:29 +01:00
|
|
|
QUAGGA_STATE_DIR: str = "/var/run/quagga"
|
|
|
|
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
class Zebra(CoreService):
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "zebra"
|
|
|
|
group: str = "Quagga"
|
|
|
|
dirs: Tuple[str, ...] = ("/usr/local/etc/quagga", "/var/run/quagga")
|
|
|
|
configs: Tuple[str, ...] = (
|
2017-08-02 22:07:56 +01:00
|
|
|
"/usr/local/etc/quagga/Quagga.conf",
|
|
|
|
"quaggaboot.sh",
|
2019-09-10 23:10:24 +01:00
|
|
|
"/usr/local/etc/quagga/vtysh.conf",
|
2017-08-02 22:07:56 +01:00
|
|
|
)
|
2020-06-18 20:54:36 +01:00
|
|
|
startup: Tuple[str, ...] = ("sh quaggaboot.sh zebra",)
|
|
|
|
shutdown: Tuple[str, ...] = ("killall zebra",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof zebra",)
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_config(cls, node: CoreNode, filename: str) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Return the Quagga.conf or quaggaboot.sh file contents.
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
if filename == cls.configs[0]:
|
2020-06-18 20:54:36 +01:00
|
|
|
return cls.generate_quagga_conf(node)
|
2018-06-15 22:03:27 +01:00
|
|
|
elif filename == cls.configs[1]:
|
2020-06-18 20:54:36 +01:00
|
|
|
return cls.generate_quagga_boot(node)
|
2018-06-15 22:03:27 +01:00
|
|
|
elif filename == cls.configs[2]:
|
2020-06-18 20:54:36 +01:00
|
|
|
return cls.generate_vtysh_conf(node)
|
2013-08-29 15:21:13 +01:00
|
|
|
else:
|
2019-09-10 23:10:24 +01:00
|
|
|
raise ValueError(
|
|
|
|
"file name (%s) is not a known configuration: %s", filename, cls.configs
|
|
|
|
)
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_vtysh_conf(cls, node: CoreNode) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Returns configuration file text.
|
|
|
|
"""
|
2016-01-06 18:40:34 +00:00
|
|
|
return "service integrated-vtysh-config\n"
|
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_conf(cls, node: CoreNode) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2017-06-20 02:09:28 +01:00
|
|
|
Returns configuration file text. Other services that depend on zebra
|
2020-06-18 20:54:36 +01:00
|
|
|
will have hooks that are invoked here.
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
2013-08-29 15:21:13 +01:00
|
|
|
# we could verify here that filename == Quagga.conf
|
|
|
|
cfg = ""
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in node.get_ifaces():
|
|
|
|
cfg += "interface %s\n" % iface.name
|
2013-08-29 15:21:13 +01:00
|
|
|
# include control interfaces in addressing but not routing daemons
|
2020-06-18 20:54:36 +01:00
|
|
|
if getattr(iface, "control", False):
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += " "
|
2020-06-19 18:54:58 +01:00
|
|
|
cfg += "\n ".join(map(cls.addrstr, iface.ips()))
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += "\n"
|
|
|
|
continue
|
|
|
|
cfgv4 = ""
|
|
|
|
cfgv6 = ""
|
|
|
|
want_ipv4 = False
|
|
|
|
want_ipv6 = False
|
2018-06-21 22:56:30 +01:00
|
|
|
for s in node.services:
|
2018-06-22 16:16:59 +01:00
|
|
|
if cls.name not in s.dependencies:
|
2013-08-29 15:21:13 +01:00
|
|
|
continue
|
2020-06-18 20:54:36 +01:00
|
|
|
if not (isinstance(s, QuaggaService) or issubclass(s, QuaggaService)):
|
|
|
|
continue
|
2020-06-16 17:30:16 +01:00
|
|
|
iface_config = s.generate_quagga_iface_config(node, iface)
|
2018-06-15 22:03:27 +01:00
|
|
|
if s.ipv4_routing:
|
2013-08-29 15:21:13 +01:00
|
|
|
want_ipv4 = True
|
2018-06-15 22:03:27 +01:00
|
|
|
if s.ipv6_routing:
|
2013-08-29 15:21:13 +01:00
|
|
|
want_ipv6 = True
|
2020-06-16 17:30:16 +01:00
|
|
|
cfgv6 += iface_config
|
2013-08-29 15:21:13 +01:00
|
|
|
else:
|
2020-06-16 17:30:16 +01:00
|
|
|
cfgv4 += iface_config
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
if want_ipv4:
|
|
|
|
cfg += " "
|
2020-06-19 16:50:36 +01:00
|
|
|
cfg += "\n ".join(map(cls.addrstr, iface.ip4s))
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += "\n"
|
|
|
|
cfg += cfgv4
|
|
|
|
if want_ipv6:
|
|
|
|
cfg += " "
|
2020-06-19 16:50:36 +01:00
|
|
|
cfg += "\n ".join(map(cls.addrstr, iface.ip6s))
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += "\n"
|
|
|
|
cfg += cfgv6
|
|
|
|
cfg += "!\n"
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2018-06-21 22:56:30 +01:00
|
|
|
for s in node.services:
|
2018-06-22 16:16:59 +01:00
|
|
|
if cls.name not in s.dependencies:
|
2013-08-29 15:21:13 +01:00
|
|
|
continue
|
2020-06-18 20:54:36 +01:00
|
|
|
if not (isinstance(s, QuaggaService) or issubclass(s, QuaggaService)):
|
|
|
|
continue
|
2020-06-16 17:30:16 +01:00
|
|
|
cfg += s.generate_quagga_config(node)
|
2013-08-29 15:21:13 +01:00
|
|
|
return cfg
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@staticmethod
|
2020-06-19 16:50:36 +01:00
|
|
|
def addrstr(ip: netaddr.IPNetwork) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
helper for mapping IP addresses to zebra config statements
|
|
|
|
"""
|
2020-06-19 16:50:36 +01:00
|
|
|
address = str(ip.ip)
|
|
|
|
if netaddr.valid_ipv4(address):
|
|
|
|
return "ip address %s" % ip
|
|
|
|
elif netaddr.valid_ipv6(address):
|
|
|
|
return "ipv6 address %s" % ip
|
2013-08-29 15:21:13 +01:00
|
|
|
else:
|
2020-06-19 16:50:36 +01:00
|
|
|
raise ValueError("invalid address: %s", ip)
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_boot(cls, node: CoreNode) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Generate a shell script used to boot the Quagga daemons.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
quagga_bin_search = node.session.options.get_config(
|
|
|
|
"quagga_bin_search", default='"/usr/local/bin /usr/bin /usr/lib/quagga"'
|
|
|
|
)
|
|
|
|
quagga_sbin_search = node.session.options.get_config(
|
|
|
|
"quagga_sbin_search", default='"/usr/local/sbin /usr/sbin /usr/lib/quagga"'
|
|
|
|
)
|
2013-08-29 15:21:13 +01:00
|
|
|
return """\
|
|
|
|
#!/bin/sh
|
|
|
|
# auto-generated by zebra service (quagga.py)
|
|
|
|
QUAGGA_CONF=%s
|
|
|
|
QUAGGA_SBIN_SEARCH=%s
|
|
|
|
QUAGGA_BIN_SEARCH=%s
|
|
|
|
QUAGGA_STATE_DIR=%s
|
|
|
|
|
|
|
|
searchforprog()
|
|
|
|
{
|
|
|
|
prog=$1
|
|
|
|
searchpath=$@
|
|
|
|
ret=
|
|
|
|
for p in $searchpath; do
|
|
|
|
if [ -x $p/$prog ]; then
|
|
|
|
ret=$p
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo $ret
|
|
|
|
}
|
|
|
|
|
|
|
|
confcheck()
|
|
|
|
{
|
|
|
|
CONF_DIR=`dirname $QUAGGA_CONF`
|
|
|
|
# if /etc/quagga exists, point /etc/quagga/Quagga.conf -> CONF_DIR
|
|
|
|
if [ "$CONF_DIR" != "/etc/quagga" ] && [ -d /etc/quagga ] && [ ! -e /etc/quagga/Quagga.conf ]; then
|
|
|
|
ln -s $CONF_DIR/Quagga.conf /etc/quagga/Quagga.conf
|
|
|
|
fi
|
|
|
|
# if /etc/quagga exists, point /etc/quagga/vtysh.conf -> CONF_DIR
|
|
|
|
if [ "$CONF_DIR" != "/etc/quagga" ] && [ -d /etc/quagga ] && [ ! -e /etc/quagga/vtysh.conf ]; then
|
|
|
|
ln -s $CONF_DIR/vtysh.conf /etc/quagga/vtysh.conf
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
bootdaemon()
|
|
|
|
{
|
|
|
|
QUAGGA_SBIN_DIR=$(searchforprog $1 $QUAGGA_SBIN_SEARCH)
|
|
|
|
if [ "z$QUAGGA_SBIN_DIR" = "z" ]; then
|
|
|
|
echo "ERROR: Quagga's '$1' daemon not found in search path:"
|
|
|
|
echo " $QUAGGA_SBIN_SEARCH"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2016-02-17 18:33:19 +00:00
|
|
|
flags=""
|
|
|
|
|
|
|
|
if [ "$1" = "xpimd" ] && \\
|
|
|
|
grep -E -q '^[[:space:]]*router[[:space:]]+pim6[[:space:]]*$' $QUAGGA_CONF; then
|
|
|
|
flags="$flags -6"
|
|
|
|
fi
|
|
|
|
|
2017-01-13 14:38:23 +00:00
|
|
|
$QUAGGA_SBIN_DIR/$1 $flags -d
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "ERROR: Quagga's '$1' daemon failed to start!:"
|
|
|
|
return 1
|
|
|
|
fi
|
2013-08-29 15:21:13 +01:00
|
|
|
}
|
|
|
|
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
bootquagga()
|
2013-08-29 15:21:13 +01:00
|
|
|
{
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
QUAGGA_BIN_DIR=$(searchforprog 'vtysh' $QUAGGA_BIN_SEARCH)
|
2013-08-29 15:21:13 +01:00
|
|
|
if [ "z$QUAGGA_BIN_DIR" = "z" ]; then
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
echo "ERROR: Quagga's 'vtysh' program not found in search path:"
|
|
|
|
echo " $QUAGGA_BIN_SEARCH"
|
2013-08-29 15:21:13 +01:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2017-03-31 18:59:58 +01:00
|
|
|
# fix /var/run/quagga permissions
|
|
|
|
id -u quagga 2>/dev/null >/dev/null
|
|
|
|
if [ "$?" = "0" ]; then
|
|
|
|
chown quagga $QUAGGA_STATE_DIR
|
|
|
|
fi
|
|
|
|
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
bootdaemon "zebra"
|
2013-08-29 15:21:13 +01:00
|
|
|
for r in rip ripng ospf6 ospf bgp babel; do
|
2019-09-11 05:01:51 +01:00
|
|
|
if grep -q "^router \\<${r}\\>" $QUAGGA_CONF; then
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
bootdaemon "${r}d"
|
2013-08-29 15:21:13 +01:00
|
|
|
fi
|
|
|
|
done
|
2016-02-17 18:33:19 +00:00
|
|
|
|
|
|
|
if grep -E -q '^[[:space:]]*router[[:space:]]+pim6?[[:space:]]*$' $QUAGGA_CONF; then
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
bootdaemon "xpimd"
|
2016-02-17 18:33:19 +00:00
|
|
|
fi
|
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
$QUAGGA_BIN_DIR/vtysh -b
|
|
|
|
}
|
|
|
|
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
if [ "$1" != "zebra" ]; then
|
|
|
|
echo "WARNING: '$1': all Quagga daemons are launched by the 'zebra' service!"
|
2013-08-29 15:21:13 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
daemon: streamline Quagga startup
Currently, all Quagga daemons are started concurrently by their
respective CORE services, using "quaggaboot.sh" generated by the
'zebra' service. However, all routing services depend on 'zebra'
already running, and 'vtysh' depends on ALL other Quagga services
before it can push configuration from the common "Quagga.conf" to
all running daemons (see "waitforvtyfiles()" in "quaggaboot.sh").
The spinwait+timeout based implementation of "waitforvtyfiles()"
may, depending on load, give up too early and fail to configure
all Quagga daemons.
This patch streamlines the way Quagga daemons are started, by
launching them all from the 'zebra' service. The correct sequence
is to first launch the 'zebra' daemon itself, then proceed with
all routing daemons, and finish with a call to "vtysh -b" which
configures all running daemons.
The list of all applicable daemons to launch is obtained using
'grep' from Quagga.conf, in the same way "waitforvtyfiles()" used
to discover which *.vty files to look for in /var/run/quagga/.
The startup command for all services other than 'zebra' becomes
empty, and "quaggaboot.sh" issues a warning on attempts to have
it launch any other daemon.
Signed-off-by: Gabriel Somlo <glsomlo@cert.org>
2017-01-12 21:40:45 +00:00
|
|
|
confcheck
|
|
|
|
bootquagga
|
2019-09-10 23:10:24 +01:00
|
|
|
""" % (
|
|
|
|
cls.configs[0],
|
|
|
|
quagga_sbin_search,
|
|
|
|
quagga_bin_search,
|
2020-06-23 05:39:29 +01:00
|
|
|
QUAGGA_STATE_DIR,
|
2019-09-10 23:10:24 +01:00
|
|
|
)
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
class QuaggaService(CoreService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Parent class for Quagga services. Defines properties and methods
|
|
|
|
common to Quagga's routing daemons.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: Optional[str] = None
|
|
|
|
group: str = "Quagga"
|
|
|
|
dependencies: Tuple[str, ...] = (Zebra.name,)
|
|
|
|
meta: str = "The config file for this service can be found in the Zebra service."
|
|
|
|
ipv4_routing: bool = False
|
|
|
|
ipv6_routing: bool = False
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@staticmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def router_id(node: CoreNode) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to return the first IPv4 address of a node as its router ID.
|
|
|
|
"""
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in node.get_ifaces(control=False):
|
2020-06-19 16:50:36 +01:00
|
|
|
ip4 = iface.get_ip4()
|
|
|
|
if ip4:
|
|
|
|
return str(ip4.ip)
|
2020-06-18 20:54:36 +01:00
|
|
|
return f"0.0.0.{node.id:d}"
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@staticmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def rj45check(iface: CoreInterface) -> bool:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to detect whether interface is connected an external RJ45
|
2013-08-29 15:21:13 +01:00
|
|
|
link.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2020-06-16 17:30:16 +01:00
|
|
|
if iface.net:
|
|
|
|
for peer_iface in iface.net.get_ifaces():
|
|
|
|
if peer_iface == iface:
|
2013-08-29 15:21:13 +01:00
|
|
|
continue
|
2020-06-16 17:30:16 +01:00
|
|
|
if isinstance(peer_iface.node, Rj45Node):
|
2013-08-29 15:21:13 +01:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_config(cls, node: CoreNode, filename: str) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
return ""
|
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_iface_config(cls, node: CoreNode, iface: CoreInterface) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
return ""
|
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
class Ospfv2(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The OSPFv2 service provides IPv4 routing for wired networks. It does
|
|
|
|
not build its own configuration file but has hooks for adding to the
|
|
|
|
unified Quagga.conf file.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "OSPFv2"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall ospfd",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof ospfd",)
|
|
|
|
ipv4_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@staticmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def mtu_check(iface: CoreInterface) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to detect MTU mismatch and add the appropriate OSPF
|
2013-08-29 15:21:13 +01:00
|
|
|
mtu-ignore command. This is needed when e.g. a node is linked via a
|
|
|
|
GreTap device.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2020-06-16 17:30:16 +01:00
|
|
|
if iface.mtu != 1500:
|
2013-08-29 15:21:13 +01:00
|
|
|
# a workaround for PhysicalNode GreTap, which has no knowledge of
|
|
|
|
# the other nodes/nets
|
|
|
|
return " ip ospf mtu-ignore\n"
|
2020-06-16 17:30:16 +01:00
|
|
|
if not iface.net:
|
2013-08-29 15:21:13 +01:00
|
|
|
return ""
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in iface.net.get_ifaces():
|
|
|
|
if iface.mtu != iface.mtu:
|
2013-08-29 15:21:13 +01:00
|
|
|
return " ip ospf mtu-ignore\n"
|
|
|
|
return ""
|
|
|
|
|
|
|
|
@staticmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def ptp_check(iface: CoreInterface) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to detect whether interface is connected to a notional
|
2013-08-29 15:21:13 +01:00
|
|
|
point-to-point link.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2020-06-16 17:30:16 +01:00
|
|
|
if isinstance(iface.net, PtpNet):
|
2013-08-29 15:21:13 +01:00
|
|
|
return " ip ospf network point-to-point\n"
|
|
|
|
return ""
|
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg = "router ospf\n"
|
2020-06-18 20:54:36 +01:00
|
|
|
rtrid = cls.router_id(node)
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += " router-id %s\n" % rtrid
|
|
|
|
# network 10.0.0.0/24 area 0
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in node.get_ifaces(control=False):
|
2020-06-19 16:50:36 +01:00
|
|
|
for ip4 in iface.ip4s:
|
|
|
|
cfg += f" network {ip4} area 0\n"
|
2017-04-25 16:45:34 +01:00
|
|
|
cfg += "!\n"
|
2013-08-29 15:21:13 +01:00
|
|
|
return cfg
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_iface_config(cls, node: CoreNode, iface: CoreInterface) -> str:
|
|
|
|
cfg = cls.mtu_check(iface)
|
2013-08-29 15:21:13 +01:00
|
|
|
# external RJ45 connections will use default OSPF timers
|
2020-06-16 17:30:16 +01:00
|
|
|
if cls.rj45check(iface):
|
2018-10-10 17:58:18 +01:00
|
|
|
return cfg
|
2020-06-18 20:54:36 +01:00
|
|
|
cfg += cls.ptp_check(iface)
|
2020-04-30 21:23:00 +01:00
|
|
|
return (
|
|
|
|
cfg
|
|
|
|
+ """\
|
2018-10-10 17:58:18 +01:00
|
|
|
ip ospf hello-interval 2
|
|
|
|
ip ospf dead-interval 6
|
|
|
|
ip ospf retransmit-interval 5
|
|
|
|
"""
|
2020-04-30 21:23:00 +01:00
|
|
|
)
|
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
class Ospfv3(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The OSPFv3 service provides IPv6 routing for wired networks. It does
|
|
|
|
not build its own configuration file but has hooks for adding to the
|
|
|
|
unified Quagga.conf file.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "OSPFv3"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall ospf6d",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof ospf6d",)
|
|
|
|
ipv4_routing: bool = True
|
|
|
|
ipv6_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@staticmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def min_mtu(iface: CoreInterface) -> int:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to discover the minimum MTU of interfaces linked with the
|
2013-08-29 15:21:13 +01:00
|
|
|
given interface.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2020-06-16 17:30:16 +01:00
|
|
|
mtu = iface.mtu
|
|
|
|
if not iface.net:
|
2013-08-29 15:21:13 +01:00
|
|
|
return mtu
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in iface.net.get_ifaces():
|
|
|
|
if iface.mtu < mtu:
|
|
|
|
mtu = iface.mtu
|
2013-08-29 15:21:13 +01:00
|
|
|
return mtu
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def mtu_check(cls, iface: CoreInterface) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to detect MTU mismatch and add the appropriate OSPFv3
|
2013-08-29 15:21:13 +01:00
|
|
|
ifmtu command. This is needed when e.g. a node is linked via a
|
|
|
|
GreTap device.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2020-06-18 20:54:36 +01:00
|
|
|
minmtu = cls.min_mtu(iface)
|
2020-06-16 17:30:16 +01:00
|
|
|
if minmtu < iface.mtu:
|
2013-08-29 15:21:13 +01:00
|
|
|
return " ipv6 ospf6 ifmtu %d\n" % minmtu
|
|
|
|
else:
|
|
|
|
return ""
|
|
|
|
|
|
|
|
@staticmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def ptp_check(iface: CoreInterface) -> str:
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
Helper to detect whether interface is connected to a notional
|
2013-08-29 15:21:13 +01:00
|
|
|
point-to-point link.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2020-06-16 17:30:16 +01:00
|
|
|
if isinstance(iface.net, PtpNet):
|
2013-08-29 15:21:13 +01:00
|
|
|
return " ipv6 ospf6 network point-to-point\n"
|
|
|
|
return ""
|
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg = "router ospf6\n"
|
2020-06-18 20:54:36 +01:00
|
|
|
rtrid = cls.router_id(node)
|
2020-01-09 23:34:54 +00:00
|
|
|
cfg += " instance-id 65\n"
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += " router-id %s\n" % rtrid
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in node.get_ifaces(control=False):
|
|
|
|
cfg += " interface %s area 0.0.0.0\n" % iface.name
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += "!\n"
|
|
|
|
return cfg
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_iface_config(cls, node: CoreNode, iface: CoreInterface) -> str:
|
|
|
|
return cls.mtu_check(iface)
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Ospfv3mdr(Ospfv3):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The OSPFv3 MANET Designated Router (MDR) service provides IPv6
|
|
|
|
routing for wireless networks. It does not build its own
|
|
|
|
configuration file but has hooks for adding to the
|
|
|
|
unified Quagga.conf file.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "OSPFv3MDR"
|
|
|
|
ipv4_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_iface_config(cls, node: CoreNode, iface: CoreInterface) -> str:
|
|
|
|
cfg = cls.mtu_check(iface)
|
2020-06-16 17:30:16 +01:00
|
|
|
if iface.net is not None and isinstance(iface.net, (WlanNode, EmaneNet)):
|
2019-09-10 23:10:24 +01:00
|
|
|
return (
|
|
|
|
cfg
|
|
|
|
+ """\
|
2013-08-29 15:21:13 +01:00
|
|
|
ipv6 ospf6 hello-interval 2
|
|
|
|
ipv6 ospf6 dead-interval 6
|
|
|
|
ipv6 ospf6 retransmit-interval 5
|
|
|
|
ipv6 ospf6 network manet-designated-router
|
2020-01-09 23:34:54 +00:00
|
|
|
ipv6 ospf6 twohoprefresh 3
|
2013-08-29 15:21:13 +01:00
|
|
|
ipv6 ospf6 adjacencyconnectivity uniconnected
|
|
|
|
ipv6 ospf6 lsafullness mincostlsa
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
)
|
2013-12-16 18:52:41 +00:00
|
|
|
else:
|
|
|
|
return cfg
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Bgp(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The BGP service provides interdomain routing.
|
|
|
|
Peers must be manually configured, with a full mesh for those
|
|
|
|
having the same AS number.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "BGP"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall bgpd",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof bgpd",)
|
|
|
|
custom_needed: bool = True
|
|
|
|
ipv4_routing: bool = True
|
|
|
|
ipv6_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg = "!\n! BGP configuration\n!\n"
|
|
|
|
cfg += "! You should configure the AS number below,\n"
|
|
|
|
cfg += "! along with this router's peers.\n!\n"
|
2019-04-27 06:07:51 +01:00
|
|
|
cfg += "router bgp %s\n" % node.id
|
2020-06-18 20:54:36 +01:00
|
|
|
rtrid = cls.router_id(node)
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += " bgp router-id %s\n" % rtrid
|
|
|
|
cfg += " redistribute connected\n"
|
|
|
|
cfg += "! neighbor 1.2.3.4 remote-as 555\n!\n"
|
|
|
|
return cfg
|
|
|
|
|
|
|
|
|
|
|
|
class Rip(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The RIP service provides IPv4 routing for wired networks.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "RIP"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall ripd",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof ripd",)
|
|
|
|
ipv4_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg = """\
|
|
|
|
router rip
|
|
|
|
redistribute static
|
|
|
|
redistribute connected
|
|
|
|
redistribute ospf
|
|
|
|
network 0.0.0.0/0
|
|
|
|
!
|
|
|
|
"""
|
|
|
|
return cfg
|
|
|
|
|
|
|
|
|
|
|
|
class Ripng(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The RIP NG service provides IPv6 routing for wired networks.
|
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "RIPNG"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall ripngd",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof ripngd",)
|
|
|
|
ipv6_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg = """\
|
|
|
|
router ripng
|
|
|
|
redistribute static
|
|
|
|
redistribute connected
|
|
|
|
redistribute ospf6
|
|
|
|
network ::/0
|
|
|
|
!
|
|
|
|
"""
|
|
|
|
return cfg
|
|
|
|
|
|
|
|
|
|
|
|
class Babel(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
|
|
|
The Babel service provides a loop-avoiding distance-vector routing
|
2013-08-29 15:21:13 +01:00
|
|
|
protocol for IPv6 and IPv4 with fast convergence properties.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "Babel"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall babeld",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof babeld",)
|
|
|
|
ipv6_routing: bool = True
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg = "router babel\n"
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in node.get_ifaces(control=False):
|
|
|
|
cfg += " network %s\n" % iface.name
|
2013-08-29 15:21:13 +01:00
|
|
|
cfg += " redistribute static\n redistribute connected\n"
|
|
|
|
return cfg
|
2017-04-25 16:45:34 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_iface_config(cls, node: CoreNode, iface: CoreInterface) -> str:
|
2020-06-16 17:30:16 +01:00
|
|
|
if iface.net and iface.net.linktype == LinkTypes.WIRELESS:
|
2013-08-29 15:21:13 +01:00
|
|
|
return " babel wireless\n no babel split-horizon\n"
|
|
|
|
else:
|
|
|
|
return " babel wired\n babel split-horizon\n"
|
|
|
|
|
|
|
|
|
2016-02-17 18:33:19 +00:00
|
|
|
class Xpimd(QuaggaService):
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2016-02-17 18:33:19 +00:00
|
|
|
PIM multicast routing based on XORP.
|
2017-04-25 16:45:34 +01:00
|
|
|
"""
|
2019-09-10 23:10:24 +01:00
|
|
|
|
2020-06-18 20:54:36 +01:00
|
|
|
name: str = "Xpimd"
|
|
|
|
shutdown: Tuple[str, ...] = ("killall xpimd",)
|
|
|
|
validate: Tuple[str, ...] = ("pidof xpimd",)
|
|
|
|
ipv4_routing: bool = True
|
2016-02-17 18:33:19 +00:00
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_config(cls, node: CoreNode) -> str:
|
2019-09-10 23:10:24 +01:00
|
|
|
ifname = "eth0"
|
2020-06-16 17:30:16 +01:00
|
|
|
for iface in node.get_ifaces():
|
|
|
|
if iface.name != "lo":
|
|
|
|
ifname = iface.name
|
2016-02-17 18:33:19 +00:00
|
|
|
break
|
2019-09-10 23:10:24 +01:00
|
|
|
cfg = "router mfea\n!\n"
|
|
|
|
cfg += "router igmp\n!\n"
|
|
|
|
cfg += "router pim\n"
|
|
|
|
cfg += " !ip pim rp-address 10.0.0.1\n"
|
|
|
|
cfg += " ip pim bsr-candidate %s\n" % ifname
|
|
|
|
cfg += " ip pim rp-candidate %s\n" % ifname
|
|
|
|
cfg += " !ip pim spt-threshold interval 10 bytes 80000\n"
|
2016-02-17 18:33:19 +00:00
|
|
|
return cfg
|
|
|
|
|
|
|
|
@classmethod
|
2020-06-18 20:54:36 +01:00
|
|
|
def generate_quagga_iface_config(cls, node: CoreNode, iface: CoreInterface) -> str:
|
2019-09-10 23:10:24 +01:00
|
|
|
return " ip mfea\n ip igmp\n ip pim\n"
|