mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 21:33:55 +00:00
Merge remote-tracking branch 'origin/stable/3.0'
This commit is contained in:
commit
1876a731a4
@ -31,9 +31,9 @@ any packages**
|
|||||||
|
|
||||||
sudo addgroup --system --gid 92 frr
|
sudo addgroup --system --gid 92 frr
|
||||||
sudo addgroup --system --gid 85 frrvty
|
sudo addgroup --system --gid 85 frrvty
|
||||||
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
|
sudo adduser --system --ingroup frr --home /var/run/frr/ \
|
||||||
--gecos "FRR FRRouting suite" --shell /bin/false frr
|
--gecos "FRR suite" --shell /bin/false frr
|
||||||
sudo usermode
|
sudo usermod -a -G frrvty frr
|
||||||
|
|
||||||
### Download Source, configure and compile it
|
### Download Source, configure and compile it
|
||||||
(You may prefer different options on configure statement. These are just
|
(You may prefer different options on configure statement. These are just
|
||||||
@ -62,6 +62,7 @@ an example.)
|
|||||||
--enable-rtadv \
|
--enable-rtadv \
|
||||||
--enable-tcp-zebra \
|
--enable-tcp-zebra \
|
||||||
--enable-fpm \
|
--enable-fpm \
|
||||||
|
--enable-ldpd \
|
||||||
--with-pkg-git-version \
|
--with-pkg-git-version \
|
||||||
--with-pkg-extra-version=-MyOwnFRRVersion
|
--with-pkg-extra-version=-MyOwnFRRVersion
|
||||||
make
|
make
|
||||||
@ -69,6 +70,7 @@ an example.)
|
|||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
### Create empty FRR configuration files
|
### Create empty FRR configuration files
|
||||||
|
|
||||||
sudo install -m 755 -o frr -g frr -d /var/log/frr
|
sudo install -m 755 -o frr -g frr -d /var/log/frr
|
||||||
sudo install -m 775 -o frr -g frrvty -d /etc/frr
|
sudo install -m 775 -o frr -g frrvty -d /etc/frr
|
||||||
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
|
||||||
@ -79,6 +81,8 @@ an example.)
|
|||||||
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
|
||||||
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
|
||||||
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
|
||||||
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
|
||||||
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
|
||||||
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
|
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
|
||||||
|
|
||||||
### Enable IP & IPv6 forwarding
|
### Enable IP & IPv6 forwarding
|
||||||
@ -94,4 +98,4 @@ other settings)
|
|||||||
# based on Router Advertisements for this host
|
# based on Router Advertisements for this host
|
||||||
net.ipv6.conf.all.forwarding=1
|
net.ipv6.conf.all.forwarding=1
|
||||||
|
|
||||||
**Reboot** or use `sysctl` to apply the same config to the running system
|
**Reboot** or use `sysctl -p` to apply the same config to the running system
|
||||||
|
@ -70,6 +70,7 @@ them if you are not building on a x86_64 architecture
|
|||||||
sudo touch /etc/frr/ripngd.conf
|
sudo touch /etc/frr/ripngd.conf
|
||||||
sudo touch /etc/frr/pimd.conf
|
sudo touch /etc/frr/pimd.conf
|
||||||
sudo touch /etc/frr/ldpd.conf
|
sudo touch /etc/frr/ldpd.conf
|
||||||
|
sudo touch /etc/frr/nhrpd.conf
|
||||||
sudo chown -R frr:frr /etc/frr/
|
sudo chown -R frr:frr /etc/frr/
|
||||||
sudo touch /etc/frr/vtysh.conf
|
sudo touch /etc/frr/vtysh.conf
|
||||||
sudo chown frr:frrvt /etc/frr/vtysh.conf
|
sudo chown frr:frrvt /etc/frr/vtysh.conf
|
||||||
@ -111,7 +112,7 @@ Create a new file `/etc/modules-load.d/mpls.conf` with the following content:
|
|||||||
install -p -m 644 redhat/ospf6d.service /usr/lib/systemd/system/ospf6d.service
|
install -p -m 644 redhat/ospf6d.service /usr/lib/systemd/system/ospf6d.service
|
||||||
install -p -m 644 redhat/ripngd.service /usr/lib/systemd/system/ripngd.service
|
install -p -m 644 redhat/ripngd.service /usr/lib/systemd/system/ripngd.service
|
||||||
install -p -m 644 redhat/pimd.service /usr/lib/systemd/system/pimd.service
|
install -p -m 644 redhat/pimd.service /usr/lib/systemd/system/pimd.service
|
||||||
install -p -m 644 redhat/pimd.service /usr/lib/systemd/system/ldpd.service
|
install -p -m 644 redhat/ldpd.service /usr/lib/systemd/system/ldpd.service
|
||||||
install -p -m 644 redhat/frr.sysconfig /etc/sysconfig/frr
|
install -p -m 644 redhat/frr.sysconfig /etc/sysconfig/frr
|
||||||
install -p -m 644 redhat/frr.logrotate /etc/logrotate.d/frr
|
install -p -m 644 redhat/frr.logrotate /etc/logrotate.d/frr
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ an example)
|
|||||||
sudo touch /etc/frr/ripngd.conf
|
sudo touch /etc/frr/ripngd.conf
|
||||||
sudo touch /etc/frr/pimd.conf
|
sudo touch /etc/frr/pimd.conf
|
||||||
sudo touch /etc/frr/ldpd.conf
|
sudo touch /etc/frr/ldpd.conf
|
||||||
|
sudo touch /etc/frr/nhrpd.conf
|
||||||
sudo chown -R _frr:_frr /etc/frr
|
sudo chown -R _frr:_frr /etc/frr
|
||||||
sudo touch /etc/frr/vtysh.conf
|
sudo touch /etc/frr/vtysh.conf
|
||||||
sudo chown -R _frr:_frrvty /etc/frr/vtysh.conf
|
sudo chown -R _frr:_frrvty /etc/frr/vtysh.conf
|
||||||
|
@ -65,8 +65,9 @@ any packages**
|
|||||||
|
|
||||||
sudo groupadd -g 92 frr
|
sudo groupadd -g 92 frr
|
||||||
sudo groupadd -r -g 85 frrvty
|
sudo groupadd -r -g 85 frrvty
|
||||||
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
|
sudo adduser --system --ingroup frr --home /var/run/frr/ \
|
||||||
--gecos "FRR suite" --shell /sbin/nologin frr
|
--gecos "FRR suite" --shell /sbin/nologin frr
|
||||||
|
sudo usermod -a -G frrvty frr
|
||||||
|
|
||||||
### Download Source, configure and compile it
|
### Download Source, configure and compile it
|
||||||
(You may prefer different options on configure statement. These are just
|
(You may prefer different options on configure statement. These are just
|
||||||
@ -101,22 +102,19 @@ an example.)
|
|||||||
|
|
||||||
### Create empty FRR configuration files
|
### Create empty FRR configuration files
|
||||||
|
|
||||||
sudo mkdir /var/log/frr
|
sudo install -m 755 -o frr -g frr -d /var/log/frr
|
||||||
sudo chown frr:frr /var/log/frr
|
sudo install -m 775 -o frr -g frrvty -d /etc/frr
|
||||||
sudo mkdir /etc/frr
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
|
||||||
sudo touch /etc/frr/zebra.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
|
||||||
sudo touch /etc/frr/bgpd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
|
||||||
sudo touch /etc/frr/ospfd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
|
||||||
sudo touch /etc/frr/ospf6d.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
|
||||||
sudo touch /etc/frr/isisd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
|
||||||
sudo touch /etc/frr/ripd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
|
||||||
sudo touch /etc/frr/ripngd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
|
||||||
sudo touch /etc/frr/pimd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
|
||||||
sudo touch /etc/frr/ldpd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
|
||||||
sudo chown frr:frr /etc/frr/
|
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
|
||||||
sudo touch /etc/frr/vtysh.conf
|
|
||||||
sudo chown frr:frrvty /etc/frr/vtysh.conf
|
|
||||||
sudo chmod 640 /etc/frr/*.conf
|
|
||||||
|
|
||||||
### Enable IP & IPv6 forwarding
|
### Enable IP & IPv6 forwarding
|
||||||
|
|
||||||
@ -131,4 +129,4 @@ other settings)
|
|||||||
# based on Router Advertisements for this host
|
# based on Router Advertisements for this host
|
||||||
net.ipv6.conf.all.forwarding=1
|
net.ipv6.conf.all.forwarding=1
|
||||||
|
|
||||||
**Reboot** or use `sysctl` to apply the same config to the running system
|
**Reboot** or use `sysctl -p` to apply the same config to the running system
|
||||||
|
@ -25,8 +25,9 @@ any packages**
|
|||||||
|
|
||||||
sudo groupadd -g 92 frr
|
sudo groupadd -g 92 frr
|
||||||
sudo groupadd -r -g 85 frrvty
|
sudo groupadd -r -g 85 frrvty
|
||||||
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
|
sudo adduser --system --ingroup frr --home /var/run/frr/ \
|
||||||
--gecos "FRR suite" --shell /sbin/nologin frr
|
--gecos "FRR suite" --shell /sbin/nologin frr
|
||||||
|
sudo usermod -a -G frrvty frr
|
||||||
|
|
||||||
### Download Source, configure and compile it
|
### Download Source, configure and compile it
|
||||||
(You may prefer different options on configure statement. These are just
|
(You may prefer different options on configure statement. These are just
|
||||||
@ -53,6 +54,7 @@ an example.)
|
|||||||
--enable-rtadv \
|
--enable-rtadv \
|
||||||
--enable-tcp-zebra \
|
--enable-tcp-zebra \
|
||||||
--enable-fpm \
|
--enable-fpm \
|
||||||
|
--enable-ldpd \
|
||||||
--with-pkg-git-version \
|
--with-pkg-git-version \
|
||||||
--with-pkg-extra-version=-MyOwnFRRVersion
|
--with-pkg-extra-version=-MyOwnFRRVersion
|
||||||
make
|
make
|
||||||
@ -61,21 +63,19 @@ an example.)
|
|||||||
|
|
||||||
### Create empty FRR configuration files
|
### Create empty FRR configuration files
|
||||||
|
|
||||||
sudo mkdir /var/log/frr
|
sudo install -m 755 -o frr -g frr -d /var/log/frr
|
||||||
sudo chown frr:frr /var/log/frr
|
sudo install -m 775 -o frr -g frrvty -d /etc/frr
|
||||||
sudo mkdir /etc/frr
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
|
||||||
sudo touch /etc/frr/zebra.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
|
||||||
sudo touch /etc/frr/bgpd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
|
||||||
sudo touch /etc/frr/ospfd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
|
||||||
sudo touch /etc/frr/ospf6d.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
|
||||||
sudo touch /etc/frr/isisd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
|
||||||
sudo touch /etc/frr/ripd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
|
||||||
sudo touch /etc/frr/ripngd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
|
||||||
sudo touch /etc/frr/pimd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
|
||||||
sudo chown frr:frr /etc/frr/
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
|
||||||
sudo touch /etc/frr/vtysh.conf
|
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
|
||||||
sudo chown frr:frrvty /etc/frr/vtysh.conf
|
|
||||||
sudo chmod 640 /etc/frr/*.conf
|
|
||||||
|
|
||||||
### Enable IP & IPv6 forwarding
|
### Enable IP & IPv6 forwarding
|
||||||
|
|
||||||
@ -90,4 +90,4 @@ other settings)
|
|||||||
# based on Router Advertisements for this host
|
# based on Router Advertisements for this host
|
||||||
net.ipv6.conf.all.forwarding=1
|
net.ipv6.conf.all.forwarding=1
|
||||||
|
|
||||||
**Reboot** or use `sysctl` to apply the same config to the running system
|
**Reboot** or use `sysctl -p` to apply the same config to the running system
|
||||||
|
@ -26,8 +26,9 @@ any packages**
|
|||||||
|
|
||||||
sudo groupadd -g 92 frr
|
sudo groupadd -g 92 frr
|
||||||
sudo groupadd -r -g 85 frrvty
|
sudo groupadd -r -g 85 frrvty
|
||||||
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
|
sudo adduser --system --ingroup frr --home /var/run/frr/ \
|
||||||
--gecos "FRR suite" --shell /sbin/nologin frr
|
--gecos "FRR suite" --shell /sbin/nologin frr
|
||||||
|
sudo usermod -a -G frrvty frr
|
||||||
|
|
||||||
### Download Source, configure and compile it
|
### Download Source, configure and compile it
|
||||||
(You may prefer different options on configure statement. These are just
|
(You may prefer different options on configure statement. These are just
|
||||||
@ -62,22 +63,19 @@ an example.)
|
|||||||
|
|
||||||
### Create empty FRR configuration files
|
### Create empty FRR configuration files
|
||||||
|
|
||||||
sudo mkdir /var/log/frr
|
sudo install -m 755 -o frr -g frr -d /var/log/frr
|
||||||
sudo chown frr:frr /var/log/frr
|
sudo install -m 775 -o frr -g frrvty -d /etc/frr
|
||||||
sudo mkdir /etc/frr
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
|
||||||
sudo touch /etc/frr/zebra.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
|
||||||
sudo touch /etc/frr/bgpd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
|
||||||
sudo touch /etc/frr/ospfd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
|
||||||
sudo touch /etc/frr/ospf6d.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
|
||||||
sudo touch /etc/frr/isisd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
|
||||||
sudo touch /etc/frr/ripd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
|
||||||
sudo touch /etc/frr/ripngd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
|
||||||
sudo touch /etc/frr/pimd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
|
||||||
sudo touch /etc/frr/ldpd.conf
|
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
|
||||||
sudo chown frr:frr /etc/frr/
|
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
|
||||||
sudo touch /etc/frr/vtysh.conf
|
|
||||||
sudo chown frr:frrvty /etc/frr/vtysh.conf
|
|
||||||
sudo chmod 640 /etc/frr/*.conf
|
|
||||||
|
|
||||||
### Enable IP & IPv6 forwarding
|
### Enable IP & IPv6 forwarding
|
||||||
|
|
||||||
@ -111,4 +109,4 @@ Add the following lines to `/etc/modules-load.d/modules.conf`:
|
|||||||
mpls-router
|
mpls-router
|
||||||
mpls-iptunnel
|
mpls-iptunnel
|
||||||
|
|
||||||
**Reboot** or use `sysctl` to apply the same config to the running system
|
**Reboot** or use `sysctl -p` to apply the same config to the running system
|
||||||
|
21
lib/libfrr.c
21
lib/libfrr.c
@ -34,6 +34,7 @@ DEFINE_HOOK(frr_late_init, (struct thread_master *tm), (tm))
|
|||||||
|
|
||||||
const char frr_sysconfdir[] = SYSCONFDIR;
|
const char frr_sysconfdir[] = SYSCONFDIR;
|
||||||
const char frr_vtydir[] = DAEMON_VTY_DIR;
|
const char frr_vtydir[] = DAEMON_VTY_DIR;
|
||||||
|
const char frr_moduledir[] = MODULE_PATH;
|
||||||
|
|
||||||
char config_default[256];
|
char config_default[256];
|
||||||
static char pidfile_default[256];
|
static char pidfile_default[256];
|
||||||
@ -61,7 +62,8 @@ static void opt_extend(const struct optspec *os)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define OPTION_VTYSOCK 1000
|
#define OPTION_VTYSOCK 1000
|
||||||
|
#define OPTION_MODULEDIR 1002
|
||||||
|
|
||||||
static const struct option lo_always[] = {
|
static const struct option lo_always[] = {
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
@ -69,6 +71,7 @@ static const struct option lo_always[] = {
|
|||||||
{ "daemon", no_argument, NULL, 'd' },
|
{ "daemon", no_argument, NULL, 'd' },
|
||||||
{ "module", no_argument, NULL, 'M' },
|
{ "module", no_argument, NULL, 'M' },
|
||||||
{ "vty_socket", required_argument, NULL, OPTION_VTYSOCK },
|
{ "vty_socket", required_argument, NULL, OPTION_VTYSOCK },
|
||||||
|
{ "moduledir", required_argument, NULL, OPTION_MODULEDIR },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
static const struct optspec os_always = {
|
static const struct optspec os_always = {
|
||||||
@ -77,7 +80,8 @@ static const struct optspec os_always = {
|
|||||||
" -v, --version Print program version\n"
|
" -v, --version Print program version\n"
|
||||||
" -d, --daemon Runs in daemon mode\n"
|
" -d, --daemon Runs in daemon mode\n"
|
||||||
" -M, --module Load specified module\n"
|
" -M, --module Load specified module\n"
|
||||||
" --vty_socket Override vty socket path\n",
|
" --vty_socket Override vty socket path\n"
|
||||||
|
" --moduledir Override modules directory\n",
|
||||||
lo_always
|
lo_always
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -193,6 +197,7 @@ struct option_chain {
|
|||||||
struct option_chain *next;
|
struct option_chain *next;
|
||||||
const char *arg;
|
const char *arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct option_chain *modules = NULL, **modnext = &modules;
|
static struct option_chain *modules = NULL, **modnext = &modules;
|
||||||
static int errors = 0;
|
static int errors = 0;
|
||||||
|
|
||||||
@ -277,6 +282,14 @@ static int frr_opt(int opt)
|
|||||||
}
|
}
|
||||||
di->vty_sock_path = optarg;
|
di->vty_sock_path = optarg;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_MODULEDIR:
|
||||||
|
if (di->module_path) {
|
||||||
|
fprintf(stderr, "----moduledir option specified more than once!\n");
|
||||||
|
errors++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
di->module_path = optarg;
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (di->flags & FRR_NO_PRIVSEP)
|
if (di->flags & FRR_NO_PRIVSEP)
|
||||||
return 1;
|
return 1;
|
||||||
@ -319,6 +332,8 @@ struct thread_master *frr_init(void)
|
|||||||
struct option_chain *oc;
|
struct option_chain *oc;
|
||||||
struct frrmod_runtime *module;
|
struct frrmod_runtime *module;
|
||||||
char moderr[256];
|
char moderr[256];
|
||||||
|
const char *dir;
|
||||||
|
dir = di->module_path ? di->module_path : frr_moduledir;
|
||||||
|
|
||||||
srandom(time(NULL));
|
srandom(time(NULL));
|
||||||
|
|
||||||
@ -331,7 +346,7 @@ struct thread_master *frr_init(void)
|
|||||||
frrmod_init(di->module);
|
frrmod_init(di->module);
|
||||||
while (modules) {
|
while (modules) {
|
||||||
modules = (oc = modules)->next;
|
modules = (oc = modules)->next;
|
||||||
module = frrmod_load(oc->arg, moderr, sizeof(moderr));
|
module = frrmod_load(oc->arg, dir, moderr, sizeof(moderr));
|
||||||
if (!module) {
|
if (!module) {
|
||||||
fprintf(stderr, "%s\n", moderr);
|
fprintf(stderr, "%s\n", moderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -52,6 +52,7 @@ struct frr_daemon_info {
|
|||||||
const char *config_file;
|
const char *config_file;
|
||||||
const char *pid_file;
|
const char *pid_file;
|
||||||
const char *vty_path;
|
const char *vty_path;
|
||||||
|
const char *module_path;
|
||||||
|
|
||||||
const char *proghelp;
|
const char *proghelp;
|
||||||
void (*printhelp)(FILE *target);
|
void (*printhelp)(FILE *target);
|
||||||
@ -107,5 +108,6 @@ extern void frr_run(struct thread_master *master);
|
|||||||
extern char config_default[256];
|
extern char config_default[256];
|
||||||
extern const char frr_sysconfdir[];
|
extern const char frr_sysconfdir[];
|
||||||
extern const char frr_vtydir[];
|
extern const char frr_vtydir[];
|
||||||
|
extern const char frr_moduledir[];
|
||||||
|
|
||||||
#endif /* _ZEBRA_FRR_H */
|
#endif /* _ZEBRA_FRR_H */
|
||||||
|
@ -69,7 +69,7 @@ void frrmod_init(struct frrmod_runtime *modinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct frrmod_runtime *frrmod_load(const char *spec,
|
struct frrmod_runtime *frrmod_load(const char *spec,
|
||||||
char *err, size_t err_len)
|
const char *dir, char *err, size_t err_len)
|
||||||
{
|
{
|
||||||
void *handle = NULL;
|
void *handle = NULL;
|
||||||
char name[PATH_MAX], fullpath[PATH_MAX], *args;
|
char name[PATH_MAX], fullpath[PATH_MAX], *args;
|
||||||
@ -84,12 +84,12 @@ struct frrmod_runtime *frrmod_load(const char *spec,
|
|||||||
if (!strchr(name, '/')) {
|
if (!strchr(name, '/')) {
|
||||||
if (!handle && execname) {
|
if (!handle && execname) {
|
||||||
snprintf(fullpath, sizeof(fullpath), "%s/%s_%s.so",
|
snprintf(fullpath, sizeof(fullpath), "%s/%s_%s.so",
|
||||||
MODULE_PATH, execname, name);
|
dir, execname, name);
|
||||||
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
|
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
|
||||||
}
|
}
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
snprintf(fullpath, sizeof(fullpath), "%s/%s.so",
|
snprintf(fullpath, sizeof(fullpath), "%s/%s.so",
|
||||||
MODULE_PATH, name);
|
dir, name);
|
||||||
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
|
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ extern struct frrmod_runtime *frrmod_list;
|
|||||||
|
|
||||||
extern void frrmod_init(struct frrmod_runtime *modinfo);
|
extern void frrmod_init(struct frrmod_runtime *modinfo);
|
||||||
extern struct frrmod_runtime *frrmod_load(const char *spec,
|
extern struct frrmod_runtime *frrmod_load(const char *spec,
|
||||||
char *err, size_t err_len);
|
const char *dir, char *err, size_t err_len);
|
||||||
#if 0
|
#if 0
|
||||||
/* not implemented yet */
|
/* not implemented yet */
|
||||||
extern void frrmod_unload(struct frrmod_runtime *module);
|
extern void frrmod_unload(struct frrmod_runtime *module);
|
||||||
|
@ -393,6 +393,8 @@ void nhrp_interface_set_protection(struct interface *ifp, const char *profile, c
|
|||||||
|
|
||||||
if (nifp->ipsec_fallback_profile) free(nifp->ipsec_fallback_profile);
|
if (nifp->ipsec_fallback_profile) free(nifp->ipsec_fallback_profile);
|
||||||
nifp->ipsec_fallback_profile = fallback_profile ? strdup(fallback_profile) : NULL;
|
nifp->ipsec_fallback_profile = fallback_profile ? strdup(fallback_profile) : NULL;
|
||||||
|
|
||||||
|
notifier_call(&nifp->notifier_list, NOTIFY_INTERFACE_ADDRESS_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nhrp_interface_set_source(struct interface *ifp, const char *ifname)
|
void nhrp_interface_set_source(struct interface *ifp, const char *ifname)
|
||||||
|
@ -18,19 +18,6 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_NHS, "NHRP next hop server")
|
|||||||
DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries")
|
DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries")
|
||||||
|
|
||||||
static int nhrp_nhs_resolve(struct thread *t);
|
static int nhrp_nhs_resolve(struct thread *t);
|
||||||
|
|
||||||
struct nhrp_registration {
|
|
||||||
struct list_head reglist_entry;
|
|
||||||
struct thread *t_register;
|
|
||||||
struct nhrp_nhs *nhs;
|
|
||||||
struct nhrp_reqid reqid;
|
|
||||||
unsigned int timeout;
|
|
||||||
unsigned mark : 1;
|
|
||||||
union sockunion proto_addr;
|
|
||||||
struct nhrp_peer *peer;
|
|
||||||
struct notifier_block peer_notifier;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int nhrp_reg_send_req(struct thread *t);
|
static int nhrp_reg_send_req(struct thread *t);
|
||||||
|
|
||||||
static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
|
static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
|
||||||
@ -370,3 +357,18 @@ void nhrp_nhs_terminate(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nhrp_nhs_foreach(struct interface *ifp, afi_t afi, void (*cb)(struct nhrp_nhs *, struct nhrp_registration *, void *), void *ctx)
|
||||||
|
{
|
||||||
|
struct nhrp_interface *nifp = ifp->info;
|
||||||
|
struct nhrp_nhs *nhs;
|
||||||
|
struct nhrp_registration *reg;
|
||||||
|
|
||||||
|
list_for_each_entry(nhs, &nifp->afi[afi].nhslist_head, nhslist_entry) {
|
||||||
|
if (!list_empty(&nhs->reglist_head)) {
|
||||||
|
list_for_each_entry(reg, &nhs->reglist_head, reglist_entry)
|
||||||
|
cb(nhs, reg, ctx);
|
||||||
|
} else
|
||||||
|
cb(nhs, 0, ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -250,6 +250,8 @@ int nhrp_peer_check(struct nhrp_peer *p, int establish)
|
|||||||
return 0;
|
return 0;
|
||||||
if (p->requested)
|
if (p->requested)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (!nifp->ipsec_profile)
|
||||||
|
return 0;
|
||||||
if (sockunion_family(&vc->local.nbma) == AF_UNSPEC)
|
if (sockunion_family(&vc->local.nbma) == AF_UNSPEC)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -730,6 +732,15 @@ static void nhrp_packet_debug(struct zbuf *zb, const char *dir)
|
|||||||
reply ? buf[0] : buf[1]);
|
reply ? buf[0] : buf[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proto2afi(uint16_t proto)
|
||||||
|
{
|
||||||
|
switch (proto) {
|
||||||
|
case ETH_P_IP: return AFI_IP;
|
||||||
|
case ETH_P_IPV6: return AFI_IP6;
|
||||||
|
}
|
||||||
|
return AF_UNSPEC;
|
||||||
|
}
|
||||||
|
|
||||||
struct nhrp_route_info {
|
struct nhrp_route_info {
|
||||||
int local;
|
int local;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
@ -749,7 +760,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
|
|||||||
const char *info = NULL;
|
const char *info = NULL;
|
||||||
union sockunion *target_addr;
|
union sockunion *target_addr;
|
||||||
unsigned paylen, extoff, extlen, realsize;
|
unsigned paylen, extoff, extlen, realsize;
|
||||||
afi_t afi;
|
afi_t nbma_afi, proto_afi;
|
||||||
|
|
||||||
debugf(NHRP_DEBUG_KERNEL, "PACKET: Recv %s -> %s",
|
debugf(NHRP_DEBUG_KERNEL, "PACKET: Recv %s -> %s",
|
||||||
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
|
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
|
||||||
@ -777,20 +788,21 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
|
|||||||
pp.hdr = hdr;
|
pp.hdr = hdr;
|
||||||
pp.peer = p;
|
pp.peer = p;
|
||||||
|
|
||||||
afi = htons(hdr->afnum);
|
nbma_afi = htons(hdr->afnum);
|
||||||
|
proto_afi = proto2afi(htons(hdr->protocol_type));
|
||||||
if (hdr->type > ZEBRA_NUM_OF(packet_types) ||
|
if (hdr->type > ZEBRA_NUM_OF(packet_types) ||
|
||||||
hdr->version != NHRP_VERSION_RFC2332 ||
|
hdr->version != NHRP_VERSION_RFC2332 ||
|
||||||
afi >= AFI_MAX ||
|
nbma_afi >= AFI_MAX || proto_afi == AF_UNSPEC ||
|
||||||
packet_types[hdr->type].type == PACKET_UNKNOWN ||
|
packet_types[hdr->type].type == PACKET_UNKNOWN ||
|
||||||
htons(hdr->packet_size) > realsize) {
|
htons(hdr->packet_size) > realsize) {
|
||||||
zlog_info("From %s: error: packet type %d, version %d, AFI %d, size %d (real size %d)",
|
zlog_info("From %s: error: packet type %d, version %d, AFI %d, proto %x, size %d (real size %d)",
|
||||||
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
|
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
|
||||||
(int) hdr->type, (int) hdr->version, (int) afi,
|
(int) hdr->type, (int) hdr->version,
|
||||||
(int) htons(hdr->packet_size),
|
(int) nbma_afi, (int) htons(hdr->protocol_type),
|
||||||
(int) realsize);
|
(int) htons(hdr->packet_size), (int) realsize);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
pp.if_ad = &((struct nhrp_interface *)ifp->info)->afi[afi];
|
pp.if_ad = &((struct nhrp_interface *)ifp->info)->afi[proto_afi];
|
||||||
|
|
||||||
extoff = htons(hdr->extension_offset);
|
extoff = htons(hdr->extension_offset);
|
||||||
if (extoff) {
|
if (extoff) {
|
||||||
@ -806,7 +818,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
|
|||||||
extlen = zbuf_used(zb);
|
extlen = zbuf_used(zb);
|
||||||
zbuf_init(&pp.extensions, zbuf_pulln(zb, extlen), extlen, extlen);
|
zbuf_init(&pp.extensions, zbuf_pulln(zb, extlen), extlen, extlen);
|
||||||
|
|
||||||
if (!nifp->afi[afi].network_id) {
|
if (!nifp->afi[proto_afi].network_id) {
|
||||||
info = "nhrp not enabled";
|
info = "nhrp not enabled";
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
115
nhrpd/nhrp_vty.c
115
nhrpd/nhrp_vty.c
@ -504,6 +504,32 @@ DEFUN(if_nhrp_map, if_nhrp_map_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN(if_no_nhrp_map, if_no_nhrp_map_cmd,
|
||||||
|
"no " AFI_CMD " nhrp map <A.B.C.D|X:X::X:X>",
|
||||||
|
NO_STR
|
||||||
|
AFI_STR
|
||||||
|
NHRP_STR
|
||||||
|
"Nexthop Server configuration\n"
|
||||||
|
"IPv4 protocol address\n"
|
||||||
|
"IPv6 protocol address\n")
|
||||||
|
{
|
||||||
|
VTY_DECLVAR_CONTEXT(interface,ifp);
|
||||||
|
afi_t afi = cmd_to_afi(argv[1]);
|
||||||
|
union sockunion proto_addr;
|
||||||
|
struct nhrp_cache *c;
|
||||||
|
|
||||||
|
if (str2sockunion(argv[4]->arg, &proto_addr) < 0 ||
|
||||||
|
afi2family(afi) != sockunion_family(&proto_addr))
|
||||||
|
return nhrp_vty_return(vty, NHRP_ERR_PROTOCOL_ADDRESS_MISMATCH);
|
||||||
|
|
||||||
|
c = nhrp_cache_get(ifp, &proto_addr, 0);
|
||||||
|
if (!c || !c->map)
|
||||||
|
return nhrp_vty_return(vty, NHRP_ERR_ENTRY_NOT_FOUND);
|
||||||
|
|
||||||
|
nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN(if_nhrp_nhs, if_nhrp_nhs_cmd,
|
DEFUN(if_nhrp_nhs, if_nhrp_nhs_cmd,
|
||||||
AFI_CMD " nhrp nhs <A.B.C.D|X:X::X:X|dynamic> nbma <A.B.C.D|FQDN>",
|
AFI_CMD " nhrp nhs <A.B.C.D|X:X::X:X|dynamic> nbma <A.B.C.D|FQDN>",
|
||||||
AFI_STR
|
AFI_STR
|
||||||
@ -592,6 +618,56 @@ static void show_ip_nhrp_cache(struct nhrp_cache *c, void *pctx)
|
|||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void show_ip_nhrp_nhs(struct nhrp_nhs *n, struct nhrp_registration *reg, void *pctx)
|
||||||
|
{
|
||||||
|
struct info_ctx *ctx = pctx;
|
||||||
|
struct vty *vty = ctx->vty;
|
||||||
|
char buf[2][SU_ADDRSTRLEN];
|
||||||
|
|
||||||
|
if (!ctx->count) {
|
||||||
|
vty_out(vty, "%-8s %-24s %-16s %-16s%s",
|
||||||
|
"Iface",
|
||||||
|
"FQDN",
|
||||||
|
"NBMA",
|
||||||
|
"Protocol",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
ctx->count++;
|
||||||
|
|
||||||
|
vty_out(vty, "%-8s %-24s %-16s %-16s%s",
|
||||||
|
n->ifp->name,
|
||||||
|
n->nbma_fqdn,
|
||||||
|
(reg && reg->peer) ? sockunion2str(®->peer->vc->remote.nbma, buf[0], sizeof buf[0]) : "-",
|
||||||
|
sockunion2str(reg ? ®->proto_addr : &n->proto_addr, buf[1], sizeof buf[1]),
|
||||||
|
VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
|
||||||
|
{
|
||||||
|
struct info_ctx *ctx = pctx;
|
||||||
|
struct nhrp_cache *c;
|
||||||
|
struct vty *vty = ctx->vty;
|
||||||
|
char buf1[PREFIX_STRLEN], buf2[SU_ADDRSTRLEN];
|
||||||
|
|
||||||
|
if (!ctx->count) {
|
||||||
|
vty_out(vty, "%-8s %-24s %-24s %s%s",
|
||||||
|
"Type",
|
||||||
|
"Prefix",
|
||||||
|
"Via",
|
||||||
|
"Identity",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
ctx->count++;
|
||||||
|
|
||||||
|
c = s->cache;
|
||||||
|
vty_out(ctx->vty, "%-8s %-24s %-24s %s%s",
|
||||||
|
nhrp_cache_type_str[s->type],
|
||||||
|
prefix2str(s->p, buf1, sizeof buf1),
|
||||||
|
c ? sockunion2str(&c->remote_addr, buf2, sizeof buf2) : "",
|
||||||
|
(c && c->cur.peer) ? c->cur.peer->vc->remote.id : "",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
|
||||||
static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
|
static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
|
||||||
{
|
{
|
||||||
struct info_ctx *ctx = pctx;
|
struct info_ctx *ctx = pctx;
|
||||||
@ -631,38 +707,13 @@ static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
|
|||||||
vty_out(ctx->vty, "%s", VTY_NEWLINE);
|
vty_out(ctx->vty, "%s", VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
|
|
||||||
{
|
|
||||||
struct info_ctx *ctx = pctx;
|
|
||||||
struct nhrp_cache *c;
|
|
||||||
struct vty *vty = ctx->vty;
|
|
||||||
char buf1[PREFIX_STRLEN], buf2[SU_ADDRSTRLEN];
|
|
||||||
|
|
||||||
if (!ctx->count) {
|
|
||||||
vty_out(vty, "%-8s %-24s %-24s %s%s",
|
|
||||||
"Type",
|
|
||||||
"Prefix",
|
|
||||||
"Via",
|
|
||||||
"Identity",
|
|
||||||
VTY_NEWLINE);
|
|
||||||
}
|
|
||||||
ctx->count++;
|
|
||||||
|
|
||||||
c = s->cache;
|
|
||||||
vty_out(ctx->vty, "%-8s %-24s %-24s %s%s",
|
|
||||||
nhrp_cache_type_str[s->type],
|
|
||||||
prefix2str(s->p, buf1, sizeof buf1),
|
|
||||||
c ? sockunion2str(&c->remote_addr, buf2, sizeof buf2) : "",
|
|
||||||
(c && c->cur.peer) ? c->cur.peer->vc->remote.id : "",
|
|
||||||
VTY_NEWLINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
|
DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
|
||||||
"show " AFI_CMD " nhrp [cache|shortcut|opennhrp]",
|
"show " AFI_CMD " nhrp [cache|nhs|shortcut|opennhrp]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
AFI_STR
|
AFI_STR
|
||||||
"NHRP information\n"
|
"NHRP information\n"
|
||||||
"Forwarding cache information\n"
|
"Forwarding cache information\n"
|
||||||
|
"Next hop server information\n"
|
||||||
"Shortcut information\n"
|
"Shortcut information\n"
|
||||||
"opennhrpctl style cache dump\n")
|
"opennhrpctl style cache dump\n")
|
||||||
{
|
{
|
||||||
@ -676,13 +727,16 @@ DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
|
|||||||
if (argc <= 3 || argv[3]->text[0] == 'c') {
|
if (argc <= 3 || argv[3]->text[0] == 'c') {
|
||||||
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
|
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
|
||||||
nhrp_cache_foreach(ifp, show_ip_nhrp_cache, &ctx);
|
nhrp_cache_foreach(ifp, show_ip_nhrp_cache, &ctx);
|
||||||
} else if (argv[3]->text[0] == 'o') {
|
} else if (argv[3]->text[0] == 'n') {
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
|
||||||
|
nhrp_nhs_foreach(ifp, ctx.afi, show_ip_nhrp_nhs, &ctx);
|
||||||
|
} else if (argv[3]->text[0] == 's') {
|
||||||
|
nhrp_shortcut_foreach(ctx.afi, show_ip_nhrp_shortcut, &ctx);
|
||||||
|
} else {
|
||||||
vty_out(vty, "Status: ok%s%s", VTY_NEWLINE, VTY_NEWLINE);
|
vty_out(vty, "Status: ok%s%s", VTY_NEWLINE, VTY_NEWLINE);
|
||||||
ctx.count++;
|
ctx.count++;
|
||||||
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
|
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
|
||||||
nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx);
|
nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx);
|
||||||
} else {
|
|
||||||
nhrp_shortcut_foreach(ctx.afi, show_ip_nhrp_shortcut, &ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx.count) {
|
if (!ctx.count) {
|
||||||
@ -919,6 +973,7 @@ void nhrp_config_init(void)
|
|||||||
install_element(INTERFACE_NODE, &if_nhrp_reg_flags_cmd);
|
install_element(INTERFACE_NODE, &if_nhrp_reg_flags_cmd);
|
||||||
install_element(INTERFACE_NODE, &if_no_nhrp_reg_flags_cmd);
|
install_element(INTERFACE_NODE, &if_no_nhrp_reg_flags_cmd);
|
||||||
install_element(INTERFACE_NODE, &if_nhrp_map_cmd);
|
install_element(INTERFACE_NODE, &if_nhrp_map_cmd);
|
||||||
|
install_element(INTERFACE_NODE, &if_no_nhrp_map_cmd);
|
||||||
install_element(INTERFACE_NODE, &if_nhrp_nhs_cmd);
|
install_element(INTERFACE_NODE, &if_nhrp_nhs_cmd);
|
||||||
install_element(INTERFACE_NODE, &if_no_nhrp_nhs_cmd);
|
install_element(INTERFACE_NODE, &if_no_nhrp_nhs_cmd);
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,18 @@ struct nhrp_nhs {
|
|||||||
struct list_head reglist_head;
|
struct list_head reglist_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct nhrp_registration {
|
||||||
|
struct list_head reglist_entry;
|
||||||
|
struct thread *t_register;
|
||||||
|
struct nhrp_nhs *nhs;
|
||||||
|
struct nhrp_reqid reqid;
|
||||||
|
unsigned int timeout;
|
||||||
|
unsigned mark : 1;
|
||||||
|
union sockunion proto_addr;
|
||||||
|
struct nhrp_peer *peer;
|
||||||
|
struct notifier_block peer_notifier;
|
||||||
|
};
|
||||||
|
|
||||||
#define NHRP_IFF_SHORTCUT 0x0001
|
#define NHRP_IFF_SHORTCUT 0x0001
|
||||||
#define NHRP_IFF_REDIRECT 0x0002
|
#define NHRP_IFF_REDIRECT 0x0002
|
||||||
#define NHRP_IFF_REG_NO_UNIQUE 0x0100
|
#define NHRP_IFF_REG_NO_UNIQUE 0x0100
|
||||||
@ -311,6 +323,7 @@ int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr,
|
|||||||
int nhrp_nhs_del(struct interface *ifp, afi_t afi, union sockunion *proto_addr, const char *nbma_fqdn);
|
int nhrp_nhs_del(struct interface *ifp, afi_t afi, union sockunion *proto_addr, const char *nbma_fqdn);
|
||||||
int nhrp_nhs_free(struct nhrp_nhs *nhs);
|
int nhrp_nhs_free(struct nhrp_nhs *nhs);
|
||||||
void nhrp_nhs_terminate(void);
|
void nhrp_nhs_terminate(void);
|
||||||
|
void nhrp_nhs_foreach(struct interface *ifp, afi_t afi, void (*cb)(struct nhrp_nhs *, struct nhrp_registration *, void *), void *ctx);
|
||||||
|
|
||||||
void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp);
|
void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp);
|
||||||
void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix *p, struct interface *ifp, const union sockunion *nexthop, uint32_t mtu);
|
void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix *p, struct interface *ifp, const union sockunion *nexthop, uint32_t mtu);
|
||||||
|
28
nhrpd/vici.c
28
nhrpd/vici.c
@ -220,6 +220,23 @@ static void parse_sa_message(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void parse_cmd_response(
|
||||||
|
struct vici_message_ctx *ctx,
|
||||||
|
enum vici_type_t msgtype,
|
||||||
|
const struct blob *key, const struct blob *val)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
|
||||||
|
switch (msgtype) {
|
||||||
|
case VICI_KEY_VALUE:
|
||||||
|
if (blob_equal(key, "errmsg") && blob2buf(val, buf, sizeof(buf)))
|
||||||
|
zlog_err("VICI: strongSwan: %s", buf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void vici_recv_sa(struct vici_conn *vici, struct zbuf *msg, int event)
|
static void vici_recv_sa(struct vici_conn *vici, struct zbuf *msg, int event)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
@ -265,11 +282,14 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg)
|
|||||||
else if (blob_equal(&name, "child-state-destroying"))
|
else if (blob_equal(&name, "child-state-destroying"))
|
||||||
vici_recv_sa(vici, msg, 2);
|
vici_recv_sa(vici, msg, 2);
|
||||||
break;
|
break;
|
||||||
|
case VICI_CMD_RESPONSE:
|
||||||
|
vici_parse_message(vici, msg, parse_cmd_response, 0);
|
||||||
|
break;
|
||||||
case VICI_EVENT_UNKNOWN:
|
case VICI_EVENT_UNKNOWN:
|
||||||
|
case VICI_CMD_UNKNOWN:
|
||||||
zlog_err("VICI: StrongSwan does not support mandatory events (unpatched?)");
|
zlog_err("VICI: StrongSwan does not support mandatory events (unpatched?)");
|
||||||
break;
|
break;
|
||||||
case VICI_EVENT_CONFIRM:
|
case VICI_EVENT_CONFIRM:
|
||||||
case VICI_CMD_RESPONSE:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
zlog_notice("VICI: Unrecognized message type %d", msgtype);
|
zlog_notice("VICI: Unrecognized message type %d", msgtype);
|
||||||
@ -449,9 +469,9 @@ void vici_request_vc(const char *profile, union sockunion *src, union sockunion
|
|||||||
vici_submit_request(
|
vici_submit_request(
|
||||||
vici, "initiate",
|
vici, "initiate",
|
||||||
VICI_KEY_VALUE, "child", strlen(profile), profile,
|
VICI_KEY_VALUE, "child", strlen(profile), profile,
|
||||||
VICI_KEY_VALUE, "timeout", 2, "-1",
|
VICI_KEY_VALUE, "timeout", (size_t) 2, "-1",
|
||||||
VICI_KEY_VALUE, "async", 1, "1",
|
VICI_KEY_VALUE, "async", (size_t) 1, "1",
|
||||||
VICI_KEY_VALUE, "init-limits", 1, prio ? "0" : "1",
|
VICI_KEY_VALUE, "init-limits", (size_t) 1, prio ? "0" : "1",
|
||||||
VICI_KEY_VALUE, "my-host", strlen(buf[0]), buf[0],
|
VICI_KEY_VALUE, "my-host", strlen(buf[0]), buf[0],
|
||||||
VICI_KEY_VALUE, "other-host", strlen(buf[1]), buf[1],
|
VICI_KEY_VALUE, "other-host", strlen(buf[1]), buf[1],
|
||||||
VICI_END);
|
VICI_END);
|
||||||
|
@ -315,6 +315,14 @@ DEFUN (no_router_ospf6,
|
|||||||
ROUTER_STR
|
ROUTER_STR
|
||||||
OSPF6_STR)
|
OSPF6_STR)
|
||||||
{
|
{
|
||||||
|
if (ospf6 == NULL)
|
||||||
|
vty_out (vty, "OSPFv3 is not configured%s", VNL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ospf6_delete (ospf6);
|
||||||
|
ospf6 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* return to config node . */
|
/* return to config node . */
|
||||||
VTY_PUSH_CONTEXT_NULL(CONFIG_NODE);
|
VTY_PUSH_CONTEXT_NULL(CONFIG_NODE);
|
||||||
|
|
||||||
|
@ -47,8 +47,10 @@ Installing the snap
|
|||||||
|
|
||||||
Connect the priviledged `network-control` plug to the snap:
|
Connect the priviledged `network-control` plug to the snap:
|
||||||
|
|
||||||
snap connect frr:network-control ubuntu-core:network-control
|
snap connect frr:network-control core:network-control
|
||||||
|
|
||||||
|
See README.usage.md for more details on setting up and using the snap
|
||||||
|
|
||||||
DONE.
|
DONE.
|
||||||
|
|
||||||
The Snap will be auto-started and running.
|
The Snap will be auto-started and running.
|
||||||
|
@ -3,7 +3,7 @@ Using the FRRouting Snap
|
|||||||
|
|
||||||
After installing the Snap, the priviledged plug need to be connected:
|
After installing the Snap, the priviledged plug need to be connected:
|
||||||
|
|
||||||
snap connect frr:network-control ubuntu-core:network-control
|
snap connect frr:network-control core:network-control
|
||||||
|
|
||||||
Enabling/Disabling FRRouting Daemons
|
Enabling/Disabling FRRouting Daemons
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
@ -30,6 +30,8 @@ Commands defined by this snap
|
|||||||
options
|
options
|
||||||
- `frr.readme`:
|
- `frr.readme`:
|
||||||
Returns this document `cat README_usage.md`
|
Returns this document `cat README_usage.md`
|
||||||
|
- `frr.set`:
|
||||||
|
Allows to enable `FPM` module. See FPM section below
|
||||||
|
|
||||||
and for debugging defined at this time (May get removed later - do not
|
and for debugging defined at this time (May get removed later - do not
|
||||||
depend on them). These are mainly intended to debug the Snap
|
depend on them). These are mainly intended to debug the Snap
|
||||||
@ -53,25 +55,88 @@ depend on them). These are mainly intended to debug the Snap
|
|||||||
- `frr.ldpd-debug`:
|
- `frr.ldpd-debug`:
|
||||||
Starts ldpd daemon in foreground
|
Starts ldpd daemon in foreground
|
||||||
|
|
||||||
|
MPLS (LDP)
|
||||||
|
----------
|
||||||
|
The MPLS forwarding requires a Linux Kernel version 4.5 or newer and
|
||||||
|
specific MPLS kernel modules loaded. It will be auto-detected by
|
||||||
|
FRR. You can check the detected setup with the `show mpls status`
|
||||||
|
command from within `frr.vtysh`
|
||||||
|
|
||||||
|
The following kernel modules `mpls-router` and `mpls-iptunnel`
|
||||||
|
need to be loaded. On Ubuntu 16.04, this can be done by editing
|
||||||
|
'/etc/modules-load.d/modules.conf' and add the following lines:
|
||||||
|
|
||||||
|
# Load MPLS Kernel Modules
|
||||||
|
mpls-router
|
||||||
|
mpls-iptunnel
|
||||||
|
|
||||||
|
For other distributions, please check the documentation on loading
|
||||||
|
modules. You need to either reboot or use `modprobe` to manually load
|
||||||
|
the modules as well before MPLS will be available.
|
||||||
|
|
||||||
|
In addition to this, the MPLS Label-Processing needs to be enabled
|
||||||
|
with `sysctl` on the required interfaces. Assuming the interfaces
|
||||||
|
are named `eth0`, `eth1` and `eth2`, then the additional lines in
|
||||||
|
`/etc/sysctl.conf` will enable it on a Ubuntu 16.04 system:
|
||||||
|
|
||||||
|
# Enable MPLS Label processing on all interfaces
|
||||||
|
net.mpls.conf.eth0.input=1
|
||||||
|
net.mpls.conf.eth1.input=1
|
||||||
|
net.mpls.conf.eth2.input=1
|
||||||
|
net.mpls.platform_labels=100000
|
||||||
|
|
||||||
|
These settings require either a reboot or a manual configuration with
|
||||||
|
`sysctl` as well.
|
||||||
|
|
||||||
|
FPM Module
|
||||||
|
----------
|
||||||
|
The `frr.set` allows to turn FPM module on or off.
|
||||||
|
|
||||||
|
frr.set fpm {disable|protobuf|netlink}
|
||||||
|
|
||||||
|
Disables FPM or enables FPM with selected mode
|
||||||
|
|
||||||
|
By default, the FPM module is disabled, but installed with netlink and
|
||||||
|
protobuf support. To enable the FPM module, use the `frr.set fpm protobuf`
|
||||||
|
or `frr.set fpm netlink` command. The command will only enable the mode
|
||||||
|
for the next restart of zebra. Please reboot or restart zebra after
|
||||||
|
changing the mode to become effective.
|
||||||
|
|
||||||
FAQ
|
FAQ
|
||||||
---
|
---
|
||||||
- frr.vtysh displays `--MORE--` on long output. How to suppress this?
|
- frr.vtysh displays `--MORE--` on long output. How to suppress this?
|
||||||
- Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add
|
- Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add
|
||||||
`export VTYSH_PAGER=cat` to the end of your `.profile`)
|
`export VTYSH_PAGER=cat` to the end of your `.profile`)
|
||||||
|
|
||||||
|
- ospfd / ospf6d are not running after installation
|
||||||
|
- Installing a new snap starts the daemons, but at this time they
|
||||||
|
may not have the required priviledged access. Make sure you
|
||||||
|
issue the `snap connect` command as given above (can be verified
|
||||||
|
with `snap interfaces`) and **THEN** restart the daemons (or
|
||||||
|
reboot the system).
|
||||||
|
This is a limitation of any snap package at this time which
|
||||||
|
requires priviledged interfaces (ie to manipulate routing tables)
|
||||||
|
|
||||||
Sourcecode available
|
Sourcecode available
|
||||||
====================
|
====================
|
||||||
|
|
||||||
The source for this SNAP is available as part of the FRRouting
|
The source for this SNAP is available as part of the FRRouting
|
||||||
Source Code Distribution.
|
Source Code Distribution under `GPLv2 or later`
|
||||||
|
|
||||||
https://github.com/frrouting/frr.git
|
<https://github.com/frrouting/frr.git>
|
||||||
|
|
||||||
Instructions for rebuilding the snap are in `README.snap_build.md`
|
Instructions for rebuilding the snap are in `snapcraft/README.snap_build.md`
|
||||||
|
|
||||||
|
*Please checkout the desired branch before following the instructions
|
||||||
|
as they may have changed between versions of FRR*
|
||||||
|
|
||||||
|
Official Webpage for FRR
|
||||||
|
========================
|
||||||
|
|
||||||
|
Official webpage for FRR is at <https://www.frrouting.org/>
|
||||||
|
|
||||||
Feedback welcome
|
Feedback welcome
|
||||||
================
|
================
|
||||||
|
|
||||||
Please send Feedback about this snap to Martin Winter at
|
Please send Feedback about this snap to Martin Winter at
|
||||||
`mwinter@opensourcerouting.org`
|
`mwinter@opensourcerouting.org`
|
||||||
|
|
||||||
|
0
snapcraft/defaults/nhrpd.conf.default
Normal file
0
snapcraft/defaults/nhrpd.conf.default
Normal file
@ -11,4 +11,5 @@ install:
|
|||||||
install -D -m 0755 isisd-service $(DESTDIR)/bin/
|
install -D -m 0755 isisd-service $(DESTDIR)/bin/
|
||||||
install -D -m 0755 pimd-service $(DESTDIR)/bin/
|
install -D -m 0755 pimd-service $(DESTDIR)/bin/
|
||||||
install -D -m 0755 ldpd-service $(DESTDIR)/bin/
|
install -D -m 0755 ldpd-service $(DESTDIR)/bin/
|
||||||
|
install -D -m 0755 nhrpd-service $(DESTDIR)/bin/
|
||||||
|
install -D -m 0755 set-options $(DESTDIR)/bin/
|
||||||
|
12
snapcraft/scripts/nhrpd-service
Normal file
12
snapcraft/scripts/nhrpd-service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e -x
|
||||||
|
|
||||||
|
if ! [ -e $SNAP_DATA/nhrpd.conf ]; then
|
||||||
|
cp $SNAP/etc/frr/nhrpd.conf.default $SNAP_DATA/nhrpd.conf
|
||||||
|
fi
|
||||||
|
exec $SNAP/sbin/nhrpd \
|
||||||
|
-f $SNAP_DATA/nhrpd.conf \
|
||||||
|
--pid_file $SNAP_DATA/nhrpd.pid \
|
||||||
|
--socket $SNAP_DATA/zsock \
|
||||||
|
--vty_socket $SNAP_DATA
|
40
snapcraft/scripts/set-options
Executable file
40
snapcraft/scripts/set-options
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
fpm)
|
||||||
|
case $2 in
|
||||||
|
disable)
|
||||||
|
rm -f $SNAP_DATA/fpm.conf
|
||||||
|
echo "FPM module disabled. Please restart FRR"
|
||||||
|
;;
|
||||||
|
protobuf)
|
||||||
|
echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf
|
||||||
|
echo "FPM enabled and set to protobuf mode. Please restart FRR"
|
||||||
|
;;
|
||||||
|
netlink)
|
||||||
|
echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf
|
||||||
|
echo "FPM enabled and set to netlink mode. Please restart FRR"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage:"
|
||||||
|
echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
|
||||||
|
echo ""
|
||||||
|
echo " Disables FPM module or enables it with specified mode"
|
||||||
|
echo " Mode will be saved for next restart of zebra, but zebra"
|
||||||
|
echo " is not automatically restarted"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage:"
|
||||||
|
echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
|
||||||
|
echo ""
|
||||||
|
echo " Disables FPM or enables FPM with selected mode"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
@ -8,9 +8,13 @@ fi
|
|||||||
if ! [ -e $SNAP_DATA/vtysh.conf ]; then
|
if ! [ -e $SNAP_DATA/vtysh.conf ]; then
|
||||||
cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
|
cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
|
||||||
fi
|
fi
|
||||||
|
EXTRA_OPTIONS=""
|
||||||
|
if [ -e $SNAP_DATA/fpm.conf ]; then
|
||||||
|
EXTRA_OPTIONS="`cat $SNAP_DATA/fpm.conf`"
|
||||||
|
fi
|
||||||
exec $SNAP/sbin/zebra \
|
exec $SNAP/sbin/zebra \
|
||||||
-f $SNAP_DATA/zebra.conf \
|
-f $SNAP_DATA/zebra.conf \
|
||||||
--pid_file $SNAP_DATA/zebra.pid \
|
--pid_file $SNAP_DATA/zebra.pid \
|
||||||
--socket $SNAP_DATA/zsock \
|
--socket $SNAP_DATA/zsock \
|
||||||
--vty_socket $SNAP_DATA
|
--vty_socket $SNAP_DATA \
|
||||||
|
--moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS
|
||||||
|
@ -83,6 +83,15 @@ apps:
|
|||||||
- network
|
- network
|
||||||
- network-bind
|
- network-bind
|
||||||
- network-control
|
- network-control
|
||||||
|
nhrpd:
|
||||||
|
command: bin/nhrpd-service
|
||||||
|
daemon: simple
|
||||||
|
plugs:
|
||||||
|
- network
|
||||||
|
- network-bind
|
||||||
|
- network-control
|
||||||
|
set:
|
||||||
|
command: bin/set-options
|
||||||
zebra-debug:
|
zebra-debug:
|
||||||
command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
|
command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
|
||||||
plugs:
|
plugs:
|
||||||
@ -132,12 +141,18 @@ apps:
|
|||||||
- network-bind
|
- network-bind
|
||||||
- network-control
|
- network-control
|
||||||
ldpd-debug:
|
ldpd-debug:
|
||||||
command: sbin/ldpd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA
|
command: sbin/ldpd -f $SNAP_DATA/ldpd.conf --pid_file $SNAP_DATA/ldpd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA
|
||||||
plugs:
|
plugs:
|
||||||
- network
|
- network
|
||||||
- network-bind
|
- network-bind
|
||||||
- network-control
|
- network-control
|
||||||
|
nhrpd-debug:
|
||||||
|
command: sbin/nhrpd -f $SNAP_DATA/nhrpd.conf --pid_file $SNAP_DATA/nhrpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
|
||||||
|
plugs:
|
||||||
|
- network
|
||||||
|
- network-bind
|
||||||
|
- network-control
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
frr:
|
frr:
|
||||||
build-packages:
|
build-packages:
|
||||||
@ -148,7 +163,6 @@ parts:
|
|||||||
- gawk
|
- gawk
|
||||||
- libreadline-dev
|
- libreadline-dev
|
||||||
- texinfo
|
- texinfo
|
||||||
- dejagnu
|
|
||||||
- libncurses5-dev
|
- libncurses5-dev
|
||||||
- texlive-latex-base
|
- texlive-latex-base
|
||||||
- texlive-generic-recommended
|
- texlive-generic-recommended
|
||||||
@ -161,6 +175,11 @@ parts:
|
|||||||
- chrpath
|
- chrpath
|
||||||
- pkg-config
|
- pkg-config
|
||||||
- libjson-c-dev
|
- libjson-c-dev
|
||||||
|
- libc-ares-dev
|
||||||
|
- bison
|
||||||
|
- flex
|
||||||
|
- python3-dev
|
||||||
|
- protobuf-c-compiler
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- coreutils
|
- coreutils
|
||||||
- iproute2
|
- iproute2
|
||||||
@ -192,6 +211,8 @@ parts:
|
|||||||
- --enable-group=root
|
- --enable-group=root
|
||||||
- --enable-pimd
|
- --enable-pimd
|
||||||
- --enable-ldpd
|
- --enable-ldpd
|
||||||
|
- --enable-fpm
|
||||||
|
- --enable-protobuf
|
||||||
- --enable-configfile-mask=0640
|
- --enable-configfile-mask=0640
|
||||||
- --enable-logfile-mask=0640
|
- --enable-logfile-mask=0640
|
||||||
- --localstatedir=/var/run
|
- --localstatedir=/var/run
|
||||||
@ -212,6 +233,7 @@ parts:
|
|||||||
ripd.conf.default: etc/frr/ripd.conf.default
|
ripd.conf.default: etc/frr/ripd.conf.default
|
||||||
ripngd.conf.default: etc/frr/ripngd.conf.default
|
ripngd.conf.default: etc/frr/ripngd.conf.default
|
||||||
ldpd.conf.default: etc/frr/ldpd.conf.default
|
ldpd.conf.default: etc/frr/ldpd.conf.default
|
||||||
|
nhrpd.conf.default: etc/frr/nhrpd.conf.default
|
||||||
vtysh.conf.default: etc/frr/vtysh.conf.default
|
vtysh.conf.default: etc/frr/vtysh.conf.default
|
||||||
frr-scripts:
|
frr-scripts:
|
||||||
plugin: make
|
plugin: make
|
||||||
|
@ -2163,7 +2163,7 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
vtysh_log_syslog,
|
vtysh_log_syslog,
|
||||||
vtysh_log_syslog_cmd,
|
vtysh_log_syslog_cmd,
|
||||||
"log syslog <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
|
"log syslog [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Set syslog logging level\n"
|
"Set syslog logging level\n"
|
||||||
LOG_LEVEL_DESC)
|
LOG_LEVEL_DESC)
|
||||||
|
Loading…
Reference in New Issue
Block a user