From 902726b81f80f0e471f886757e95a51e34f4dc78 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 4 Apr 2017 20:36:16 -0400 Subject: [PATCH 01/48] doc: Cleanup 'Build the Software' The frrouting.org web page: https://frrouting.org/manual/Build-the-Software.html#Build-the-Software is built from doc/install.texi. The output on this page is a bit missleading, let's clean it up some. Signed-off-by: Donald Sharp --- doc/install.texi | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/doc/install.texi b/doc/install.texi index 8c501ed45d..595898277a 100644 --- a/doc/install.texi +++ b/doc/install.texi @@ -218,18 +218,14 @@ routing utility. It contains @command{ifconfig}, @command{route}, After configuring the software, you will need to compile it for your system. Simply issue the command @command{make} in the root of the source -directory and the software will be compiled. If you have *any* problems -at this stage, be certain to send a bug report @xref{Bug Reports}. +directory and the software will be compiled. Cliff Note versions of +different compilation examples can be found in the doc/Building_FRR_on_XXX.md +files. If you have *any* problems at this stage, be certain to send a +bug report @xref{Bug Reports}. @example -% ./configure -. -. -. -./configure output -. -. -. +% ./bootstrap.sh +% ./configure % make @end example @c A - End of node, Building the Software From 2a3a819a9c2b2c9700e6228e7352e53b3562776c Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 12 Apr 2017 16:00:43 -0700 Subject: [PATCH 02/48] snapcraft: Improve README.usage.md based on feedback received - Fix snap connect (it's now called core, not ubuntu-core) - Add section on MPLS configuration - Add FAQ topic on ospfd/ospf6d crashing before privs are assigned to snap - Add pointer to official webpage Signed-off-by: Martin Winter --- snapcraft/README.usage.md | 59 +++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md index aaff59438a..c678c8805c 100644 --- a/snapcraft/README.usage.md +++ b/snapcraft/README.usage.md @@ -3,7 +3,7 @@ Using the FRRouting Snap 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 ------------------------------------------- @@ -53,25 +53,74 @@ depend on them). These are mainly intended to debug the Snap - `frr.ldpd-debug`: 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. + FAQ --- - frr.vtysh displays `--MORE--` on long output. How to suppress this? - Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add `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 ==================== 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 + -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 Feedback welcome ================ Please send Feedback about this snap to Martin Winter at `mwinter@opensourcerouting.org` - From 7caef08c842f616c65bf2d30b622828507fb2db1 Mon Sep 17 00:00:00 2001 From: Phil Huang Date: Thu, 13 Apr 2017 18:11:28 +0800 Subject: [PATCH 03/48] Add user `frr` into group `frrvty` Signed-off-by: Phil Huang --- doc/Building_FRR_on_Debian8.md | 8 ++++---- doc/Building_FRR_on_Ubuntu1204.md | 5 +++-- doc/Building_FRR_on_Ubuntu1404.md | 5 +++-- doc/Building_FRR_on_Ubuntu1604.md | 5 +++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/Building_FRR_on_Debian8.md b/doc/Building_FRR_on_Debian8.md index 81d58827d3..f14930334e 100644 --- a/doc/Building_FRR_on_Debian8.md +++ b/doc/Building_FRR_on_Debian8.md @@ -31,9 +31,9 @@ any packages** sudo addgroup --system --gid 92 frr sudo addgroup --system --gid 85 frrvty - sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \ - --gecos "FRR FRRouting suite" --shell /bin/false frr - sudo usermode + sudo adduser --system --ingroup frr --home /var/run/frr/ \ + --gecos "FRR suite" --shell /bin/false frr + sudo usermod -a -G frrvty frr ### Download Source, configure and compile it (You may prefer different options on configure statement. These are just @@ -95,4 +95,4 @@ other settings) # based on Router Advertisements for this host 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 diff --git a/doc/Building_FRR_on_Ubuntu1204.md b/doc/Building_FRR_on_Ubuntu1204.md index 6e6374c2f8..d39c34f525 100644 --- a/doc/Building_FRR_on_Ubuntu1204.md +++ b/doc/Building_FRR_on_Ubuntu1204.md @@ -65,8 +65,9 @@ any packages** sudo groupadd -g 92 frr 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 + sudo usermod -a -G frrvty frr ### Download Source, configure and compile it (You may prefer different options on configure statement. These are just @@ -133,4 +134,4 @@ other settings) # based on Router Advertisements for this host 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 diff --git a/doc/Building_FRR_on_Ubuntu1404.md b/doc/Building_FRR_on_Ubuntu1404.md index 6db3f426b4..3c4e518fba 100644 --- a/doc/Building_FRR_on_Ubuntu1404.md +++ b/doc/Building_FRR_on_Ubuntu1404.md @@ -25,8 +25,9 @@ any packages** sudo groupadd -g 92 frr 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 + sudo usermod -a -G frrvty frr ### Download Source, configure and compile it (You may prefer different options on configure statement. These are just @@ -91,4 +92,4 @@ other settings) # based on Router Advertisements for this host 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 diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/Building_FRR_on_Ubuntu1604.md index 8e71cc1eee..2a6a30f961 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/Building_FRR_on_Ubuntu1604.md @@ -26,8 +26,9 @@ any packages** sudo groupadd -g 92 frr 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 + sudo usermod -a -G frrvty frr ### Download Source, configure and compile it (You may prefer different options on configure statement. These are just @@ -113,4 +114,4 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: mpls-router 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 From be9665641df19efdfe08b941fef4507956fff97c Mon Sep 17 00:00:00 2001 From: Phil Huang Date: Thu, 13 Apr 2017 21:20:53 +0800 Subject: [PATCH 04/48] Clean installation guide with Debian/Ubuntu Signed-off-by: Phil Huang --- doc/Building_FRR_on_Debian8.md | 3 +++ doc/Building_FRR_on_Ubuntu1204.md | 28 ++++++++++++---------------- doc/Building_FRR_on_Ubuntu1404.md | 28 +++++++++++++--------------- doc/Building_FRR_on_Ubuntu1604.md | 28 ++++++++++++---------------- 4 files changed, 40 insertions(+), 47 deletions(-) diff --git a/doc/Building_FRR_on_Debian8.md b/doc/Building_FRR_on_Debian8.md index f14930334e..0084433721 100644 --- a/doc/Building_FRR_on_Debian8.md +++ b/doc/Building_FRR_on_Debian8.md @@ -63,6 +63,7 @@ an example.) --enable-rtadv \ --enable-tcp-zebra \ --enable-fpm \ + --enable-ldpd \ --with-pkg-git-version \ --with-pkg-extra-version=-MyOwnFRRVersion make @@ -70,6 +71,7 @@ an example.) sudo make install ### Create empty FRR configuration files + 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 640 -o frr -g frr /dev/null /etc/frr/zebra.conf @@ -80,6 +82,7 @@ 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/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/ldpd.conf sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf ### Enable IP & IPv6 forwarding diff --git a/doc/Building_FRR_on_Ubuntu1204.md b/doc/Building_FRR_on_Ubuntu1204.md index d39c34f525..7766ff548b 100644 --- a/doc/Building_FRR_on_Ubuntu1204.md +++ b/doc/Building_FRR_on_Ubuntu1204.md @@ -104,22 +104,18 @@ an example.) ### Create empty FRR configuration files - sudo mkdir /var/log/frr - sudo chown frr:fee /var/log/frr - sudo mkdir /etc/frr - sudo touch /etc/frr/etc/zebra.conf - sudo touch /etc/frr/etc/bgpd.conf - sudo touch /etc/frr/etc/ospfd.conf - sudo touch /etc/frr/etc/ospf6d.conf - sudo touch /etc/frr/etc/isisd.conf - sudo touch /etc/frr/etc/ripd.conf - sudo touch /etc/frr/etc/ripngd.conf - sudo touch /etc/frr/etc/pimd.conf - sudo touch /etc/frr/etc/ldpd.conf - sudo chown frr:frr /etc/frr/ - sudo touch /etc/frr/etc/vtysh.conf - sudo chown frr:frrvty /etc/frr/etc/vtysh.conf - sudo chmod 640 /etc/frr/*.conf + 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 640 -o frr -g frr /dev/null /etc/frr/zebra.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.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/pimd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf + sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf ### Enable IP & IPv6 forwarding diff --git a/doc/Building_FRR_on_Ubuntu1404.md b/doc/Building_FRR_on_Ubuntu1404.md index 3c4e518fba..43b20e7143 100644 --- a/doc/Building_FRR_on_Ubuntu1404.md +++ b/doc/Building_FRR_on_Ubuntu1404.md @@ -55,6 +55,7 @@ an example.) --enable-rtadv \ --enable-tcp-zebra \ --enable-fpm \ + --enable-ldpd \ --with-pkg-git-version \ --with-pkg-extra-version=-MyOwnFRRVersion make @@ -63,21 +64,18 @@ an example.) ### Create empty FRR configuration files - sudo mkdir /var/log/frr - sudo chown frr:fee /var/log/frr - sudo mkdir /etc/frr - sudo touch /etc/frr/etc/zebra.conf - sudo touch /etc/frr/etc/bgpd.conf - sudo touch /etc/frr/etc/ospfd.conf - sudo touch /etc/frr/etc/ospf6d.conf - sudo touch /etc/frr/etc/isisd.conf - sudo touch /etc/frr/etc/ripd.conf - sudo touch /etc/frr/etc/ripngd.conf - sudo touch /etc/frr/etc/pimd.conf - sudo chown frr:frr /etc/frr/ - sudo touch /etc/frr/etc/vtysh.conf - sudo chown frr:frrvty /etc/frr/etc/vtysh.conf - sudo chmod 640 /etc/frr/*.conf + 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 640 -o frr -g frr /dev/null /etc/frr/zebra.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.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/pimd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf + sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf ### Enable IP & IPv6 forwarding diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/Building_FRR_on_Ubuntu1604.md index 2a6a30f961..b213a90858 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/Building_FRR_on_Ubuntu1604.md @@ -65,22 +65,18 @@ an example.) ### Create empty FRR configuration files - sudo mkdir /var/log/frr - sudo chown frr:fee /var/log/frr - sudo mkdir /etc/frr - sudo touch /etc/frr/etc/zebra.conf - sudo touch /etc/frr/etc/bgpd.conf - sudo touch /etc/frr/etc/ospfd.conf - sudo touch /etc/frr/etc/ospf6d.conf - sudo touch /etc/frr/etc/isisd.conf - sudo touch /etc/frr/etc/ripd.conf - sudo touch /etc/frr/etc/ripngd.conf - sudo touch /etc/frr/etc/pimd.conf - sudo touch /etc/frr/etc/ldpd.conf - sudo chown frr:frr /etc/frr/ - sudo touch /etc/frr/etc/vtysh.conf - sudo chown frr:frrvty /etc/frr/etc/vtysh.conf - sudo chmod 640 /etc/frr/*.conf + 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 640 -o frr -g frr /dev/null /etc/frr/zebra.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.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/pimd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf + sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf ### Enable IP & IPv6 forwarding From 5cf5f2033b3fbbf6ab84dd6095c26f461e4e75b7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 14 Apr 2017 20:05:48 -0400 Subject: [PATCH 05/48] bgpd: Fix 'set as-path prepend last-as 10' The route-map compilation function was comparing < 10 instead of <= 10. While the cli was accepting 1-10. Fix: ! route-map FOO permit 44 set as-path prepend last-as 10 ! Signed-off-by: Donald Sharp --- bgpd/bgp_routemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d0cce4a955..78ecb91abf 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1362,7 +1362,7 @@ route_set_aspath_prepend_compile (const char *arg) { unsigned int num; - if (sscanf(arg, "last-as %u", &num) == 1 && num > 0 && num < 10) + if (sscanf(arg, "last-as %u", &num) == 1 && num > 0 && num <= 10) return (void*)(uintptr_t)num; return route_aspath_compile(arg); From 8399fd9d36f46ae8f30ea8850b2eb1e50329c2a6 Mon Sep 17 00:00:00 2001 From: Hung-Wei Chiu Date: Thu, 27 Apr 2017 11:10:36 +0800 Subject: [PATCH 06/48] Update Building_FRR_on_Ubuntu1604.md 1. Modify the configure prefix (since there some hard coded path in **/usr/lib/frr/fr** 2. Install the systemd service config --- doc/Building_FRR_on_Ubuntu1604.md | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/Building_FRR_on_Ubuntu1604.md index b213a90858..b3bcdf9f96 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/Building_FRR_on_Ubuntu1604.md @@ -39,6 +39,7 @@ an example.) git checkout stable/2.0 ./bootstrap.sh ./configure \ + --prefix=/usr \ --enable-exampledir=/usr/share/doc/frr/examples/ \ --localstatedir=/var/run/frr \ --sbindir=/usr/lib/frr \ @@ -111,3 +112,39 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: mpls-iptunnel **Reboot** or use `sysctl -p` to apply the same config to the running system + + +### Install The Systemd Service + + sudo install -m 644 tools/frr.service /etc/systemd/system/frr.service + sudo install -m 644 cumulus/etc/default/frr /etc/default/frr + sudo install -m 644 cumulus/etc/frr/daemons /etc/frr/daemons + sudo install -m 644 cumulus/etc/frr/debian.conf /etc/frr/debian.conf + sudo install -m 644 cumulus/etc/frr/Frr.conf /etc/frr/Frr.conf + sudo install -m 644 -o frr -g frr cumulus/etc/frr/vtysh.conf /etc/frr/vtysh.conf + + +### Enable Daemons + +Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. +For example. + + zebra=yes + bgpd=yes + ospfd=yes + ospf6d=yes + ripd=yes + ripngd=yes + isisd=yes + +### Enable the Systemd Serivce +Edit `/etc/systemd/system/frr.service` and remove the line **OnFailure=heartbeat-failed@%n.service** +For example. + + [Unit] + Description=Cumulus Linux FRR + After=syslog.target networking.service +     +### Start the Systemd Service +- systemctl start frr +- use `syttemctl status frr` to check its status. From 8a77d75b8ae54d1f52739d0689933e7a0d90fb72 Mon Sep 17 00:00:00 2001 From: Hung-Wei Chiu Date: Thu, 27 Apr 2017 11:22:15 +0800 Subject: [PATCH 07/48] Update Building_FRR_on_Ubuntu1604.md Fix typo --- doc/Building_FRR_on_Ubuntu1604.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/Building_FRR_on_Ubuntu1604.md index b3bcdf9f96..7848ff68ab 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/Building_FRR_on_Ubuntu1604.md @@ -114,7 +114,7 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: **Reboot** or use `sysctl -p` to apply the same config to the running system -### Install The Systemd Service +### Install the systemd service sudo install -m 644 tools/frr.service /etc/systemd/system/frr.service sudo install -m 644 cumulus/etc/default/frr /etc/default/frr @@ -123,8 +123,7 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: sudo install -m 644 cumulus/etc/frr/Frr.conf /etc/frr/Frr.conf sudo install -m 644 -o frr -g frr cumulus/etc/frr/vtysh.conf /etc/frr/vtysh.conf - -### Enable Daemons +### Enable daemons Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. For example. @@ -137,7 +136,7 @@ For example. ripngd=yes isisd=yes -### Enable the Systemd Serivce +### Enable the systemd serivce Edit `/etc/systemd/system/frr.service` and remove the line **OnFailure=heartbeat-failed@%n.service** For example. @@ -145,6 +144,6 @@ For example. Description=Cumulus Linux FRR After=syslog.target networking.service     -### Start the Systemd Service +### Start the systemd service - systemctl start frr -- use `syttemctl status frr` to check its status. +- use `systemctl status frr` to check its status. From 500e13fea32db9b9adcf3c7df30ba4bc14341897 Mon Sep 17 00:00:00 2001 From: Hung-Wei Chiu Date: Thu, 27 Apr 2017 23:14:23 +0800 Subject: [PATCH 08/48] Update 14.04 docs to support init.d service 1. Configure the prefix to /usr (frr script hard-code those path in /etc/init.d/frr) 2. Install the service file to /etc/init.d --- doc/Building_FRR_on_Ubuntu1404.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/Building_FRR_on_Ubuntu1404.md b/doc/Building_FRR_on_Ubuntu1404.md index 43b20e7143..7e21df8614 100644 --- a/doc/Building_FRR_on_Ubuntu1404.md +++ b/doc/Building_FRR_on_Ubuntu1404.md @@ -38,6 +38,7 @@ an example.) git checkout stable/2.0 ./bootstrap.sh ./configure \ + --prefix=/usr \ --enable-exampledir=/usr/share/doc/frr/examples/ \ --localstatedir=/var/run/frr \ --sbindir=/usr/lib/frr \ @@ -91,3 +92,29 @@ other settings) net.ipv6.conf.all.forwarding=1 **Reboot** or use `sysctl -p` to apply the same config to the running system +### Install the init.d service + + sudo install -m 755 tools/frr /etc/init.d/frr + sudo install -m 644 cumulus/etc/frr/daemons /etc/frr/daemons + sudo install -m 644 cumulus/etc/frr/debian.conf /etc/frr/debian.conf + sudo install -m 644 -o frr -g frr cumulus/etc/frr/vtysh.conf /etc/frr/vtysh.conf + + +### Enable daemons + +Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. +For example. + + zebra=yes + bgpd=yes + ospfd=yes + ospf6d=yes + ripd=yes + ripngd=yes + isisd=yes + +### Start the init.d service +- /etc/init.d/frr start +- use `/etc/init.d/frr status` to check its status. + + From 362de4a621878d3907f37aaaa560b2934c3c33a5 Mon Sep 17 00:00:00 2001 From: Hung-Wei Chiu Date: Thu, 27 Apr 2017 23:30:56 +0800 Subject: [PATCH 09/48] update doc of ubuntu 12.04 1. modify the prefix to /usr (which is hard-code in /etc/init.d/frr) 2. install init.d related files. --- doc/Building_FRR_on_Ubuntu1204.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/Building_FRR_on_Ubuntu1204.md b/doc/Building_FRR_on_Ubuntu1204.md index 7766ff548b..f13052a1bb 100644 --- a/doc/Building_FRR_on_Ubuntu1204.md +++ b/doc/Building_FRR_on_Ubuntu1204.md @@ -78,6 +78,7 @@ an example.) git checkout stable/2.0 ./bootstrap.sh ./configure \ + --prefix=/usr \ --enable-exampledir=/usr/share/doc/frr/examples/ \ --localstatedir=/var/run/frr \ --sbindir=/usr/lib/frr \ @@ -131,3 +132,26 @@ other settings) net.ipv6.conf.all.forwarding=1 **Reboot** or use `sysctl -p` to apply the same config to the running system + +### Install the init.d service + + sudo install -m 755 tools/frr /etc/init.d/frr + sudo install -m 644 cumulus/etc/frr/daemons /etc/frr/daemons + sudo install -m 644 cumulus/etc/frr/debian.conf /etc/frr/debian.conf + sudo install -m 644 -o frr -g frr cumulus/etc/frr/vtysh.conf /etc/frr/vtysh.conf + +### Enable daemons +Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. +For example. + + zebra=yes + bgpd=yes + ospfd=yes + ospf6d=yes + ripd=yes + ripngd=yes + isisd=yes + +### Start the init.d service +- /etc/init.d/frr start +- use `/etc/init.d/frr status` to check its status. From d8d58e98397d8442ec68f8d715b64d5e6000b903 Mon Sep 17 00:00:00 2001 From: Hung-Weic Chiu Date: Sat, 29 Apr 2017 14:20:15 +0000 Subject: [PATCH 10/48] Fix the memory leak - free the memory for all cases. Signed-off-by: Hung-Weic Chiu --- lib/csv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/csv.c b/lib/csv.c index 7df9292647..95e3e97768 100644 --- a/lib/csv.c +++ b/lib/csv.c @@ -177,6 +177,9 @@ csv_decode_record(csv_record_t *rec) field = strpbrk(curr, ","); } field = strstr(curr, "\n"); + if (!field) { + return; + } fld = malloc(sizeof(csv_field_t)); if (field && fld) { fld->field = curr; @@ -239,6 +242,10 @@ csv_encode (csv_t *csv, rec = malloc(sizeof(csv_record_t)); if (!rec) { log_error("record malloc failed\n"); + if (!buf) { + free(str); + } + va_end(list); return (NULL); } csv_init_record(rec); From 5d6cc38ca36538583ff4c464c46a7c6de08608b6 Mon Sep 17 00:00:00 2001 From: Hung-Weic Chiu Date: Sat, 29 Apr 2017 15:02:31 +0000 Subject: [PATCH 11/48] Fix the "Use-after-free" of clang SA. - Set the pointer to NULL after free it, otherwise the pointer will be accessed again. (since not null) Signed-off-by: Hung-Weic Chiu --- lib/imsg-buffer.c | 4 +++- lib/imsg.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/imsg-buffer.c b/lib/imsg-buffer.c index a486fc17c1..f7b9f63778 100644 --- a/lib/imsg-buffer.c +++ b/lib/imsg-buffer.c @@ -209,8 +209,10 @@ msgbuf_clear(struct msgbuf *msgbuf) { struct ibuf *buf; - while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) + while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) { ibuf_dequeue(msgbuf, buf); + TAILQ_FIRST(&msgbuf->bufs) = NULL; + } } int diff --git a/lib/imsg.c b/lib/imsg.c index 246430cdd5..df3cdf510c 100644 --- a/lib/imsg.c +++ b/lib/imsg.c @@ -310,6 +310,7 @@ imsg_get_fd(struct imsgbuf *ibuf) fd = ifd->fd; TAILQ_REMOVE(&ibuf->fds, ifd, entry); free(ifd); + TAILQ_FIRST(&ibuf->fds) = NULL; return (fd); } From 3a6570a1f145c49155d72a815441025085dd45ad Mon Sep 17 00:00:00 2001 From: Hung-Weic Chiu Date: Sat, 29 Apr 2017 15:25:32 +0000 Subject: [PATCH 12/48] Fix the "Dead assignment" of clang SA. - Remove duplicated assignemt. - Remove unused initialized. Signed-off-by: Hung-Weic Chiu --- ospfd/ospf_apiserver.c | 2 +- ospfd/ospf_vty.c | 9 --------- pimd/pim_register.c | 4 ++-- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index aac8ef4b8b..620dacb157 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -2459,7 +2459,7 @@ ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr) { struct msg *msg; struct in_addr ifaddr = { .s_addr = 0L }; - struct in_addr nbraddr = { .s_addr = 0L }; + struct in_addr nbraddr; assert (nbr); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 5faf2850d9..38e006e928 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6758,7 +6758,6 @@ DEFUN (no_ip_ospf_cost, int ret; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 1) @@ -6827,7 +6826,6 @@ DEFUN (no_ip_ospf_cost2, int ret; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); /* According to the semantics we are mimicking "no ip ospf cost N" is @@ -7067,7 +7065,6 @@ DEFUN (no_ip_ospf_dead_interval, struct ospf_interface *oi; struct route_node *rn; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 2) @@ -7242,7 +7239,6 @@ DEFUN (no_ip_ospf_hello_interval, int ret; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 2) @@ -7520,7 +7516,6 @@ DEFUN (no_ip_ospf_priority, int ret; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 2) @@ -7667,7 +7662,6 @@ DEFUN (no_ip_ospf_retransmit_interval, struct ospf_if_params *params; int addr_index; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc >= 1) @@ -7739,7 +7733,6 @@ DEFUN (no_ip_ospf_retransmit_interval_sec, struct interface *ifp = vty->index; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); UNSET_IF_PARAM (params, retransmit_interval); @@ -7824,7 +7817,6 @@ DEFUN (no_ip_ospf_transmit_delay, struct ospf_if_params *params; int addr_index; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc >= 1) @@ -7897,7 +7889,6 @@ DEFUN (no_ip_ospf_transmit_delay_sec, struct interface *ifp = vty->index; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); UNSET_IF_PARAM (params, transmit_delay); diff --git a/pimd/pim_register.c b/pimd/pim_register.c index ce3ac1a433..7844bd3399 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -160,8 +160,8 @@ pim_register_recv (struct interface *ifp, int sentRegisterStop = 0; struct ip *ip_hdr; //size_t hlen; - struct in_addr group = { .s_addr = 0 }; - struct in_addr source = { .s_addr = 0 }; + struct in_addr group; + struct in_addr source; //uint8_t *msg; uint32_t *bits; From c604467a081a332848bf486a207649d79abbe3fd Mon Sep 17 00:00:00 2001 From: Hung-Weic Chiu Date: Sat, 29 Apr 2017 15:34:18 +0000 Subject: [PATCH 13/48] Fix the "Uninitialized argument value" of clang SA. Signed-off-by: Hung-Weic Chiu --- cumulus/start-stop-daemon.c | 1 + ospfd/ospf_vty.c | 2 +- zebra/zserv.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cumulus/start-stop-daemon.c b/cumulus/start-stop-daemon.c index 4d447d9051..a3d3c3dd33 100644 --- a/cumulus/start-stop-daemon.c +++ b/cumulus/start-stop-daemon.c @@ -811,6 +811,7 @@ run_stop_schedule(void) anykilled = 0; retry_nr = 0; + n_killed = 0; if (schedule == NULL) { do_stop(signal_nr, quietmode, &n_killed, &n_notkilled, 0); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 38e006e928..2724df98a0 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -7059,7 +7059,7 @@ DEFUN (no_ip_ospf_dead_interval, "Address of interface") { struct interface *ifp = vty->index; - struct in_addr addr; + struct in_addr addr = { .s_addr = 0L}; int ret; struct ospf_if_params *params; struct ospf_interface *oi; diff --git a/zebra/zserv.c b/zebra/zserv.c index 8618e5c371..39fc226ea7 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1519,7 +1519,7 @@ zread_ipv6_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) struct stream *s; struct zapi_ipv6 api; struct in6_addr nexthop; - union g_addr *pnexthop; + union g_addr *pnexthop = NULL; unsigned long ifindex; struct prefix p; From 4da93320c7332aaa894c9ec32cff43984adba60d Mon Sep 17 00:00:00 2001 From: Hung-Weic Chiu Date: Tue, 2 May 2017 00:28:41 +0000 Subject: [PATCH 14/48] Revert "Fix the "Use-after-free" of clang SA." - This's the wrong way to fix this problem. - Since the "TAILQ_FIRST()" always return diferent pointer as we call "TAILQ_REMOVE()", the clang static analyzer can't detect this behavior. - Ignore this warning and keep files identical to its original one. This reverts commit 5d6cc38ca36538583ff4c464c46a7c6de08608b6. Signed-off-by: Hung-Weic Chiu --- lib/imsg-buffer.c | 4 +--- lib/imsg.c | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/imsg-buffer.c b/lib/imsg-buffer.c index f7b9f63778..a486fc17c1 100644 --- a/lib/imsg-buffer.c +++ b/lib/imsg-buffer.c @@ -209,10 +209,8 @@ msgbuf_clear(struct msgbuf *msgbuf) { struct ibuf *buf; - while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) { + while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) ibuf_dequeue(msgbuf, buf); - TAILQ_FIRST(&msgbuf->bufs) = NULL; - } } int diff --git a/lib/imsg.c b/lib/imsg.c index df3cdf510c..246430cdd5 100644 --- a/lib/imsg.c +++ b/lib/imsg.c @@ -310,7 +310,6 @@ imsg_get_fd(struct imsgbuf *ibuf) fd = ifd->fd; TAILQ_REMOVE(&ibuf->fds, ifd, entry); free(ifd); - TAILQ_FIRST(&ibuf->fds) = NULL; return (fd); } From 7e5e32b62f83c893eaf3d9bd0b77e3b5f029dc16 Mon Sep 17 00:00:00 2001 From: Sam Tannous Date: Thu, 4 May 2017 06:54:17 -0700 Subject: [PATCH 15/48] Remove uncalled function causing compiler error Ticket: CM-16086 Reviewed By: sharpd Testing Done: Built debs and tested on hardnode With snmp enabled, this function was causing compiler errors since it was not being called. Removed it. Signed-off-by: Sam Tannous --- lib/thread.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index e10d0c48bf..e3db7a93e5 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1153,28 +1153,6 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa #if defined(HAVE_POLL) -#if defined(HAVE_SNMP) -/* add snmp fds to poll set */ -static void -add_snmp_pollfds(struct thread_master *m, fd_set *snmpfds, int fdsetsize) -{ - int i; - m->handler.pfdcountsnmp = m->handler.pfdcount; - /* cycle trough fds and add neccessary fds to poll set */ - for (i=0;ihandler.pfdcountsnmp <= m->handler.pfdsize); - - m->handler.pfds[m->handler.pfdcountsnmp].fd = i; - m->handler.pfds[m->handler.pfdcountsnmp].events = POLLIN; - m->handler.pfdcountsnmp++; - } - } -} -#endif - /* check poll events */ static void check_pollfds(struct thread_master *m, fd_set *readfd, int num) From a03d3c8040ff1f1b9ec907ed83918429d939ebb7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 4 May 2017 10:24:25 -0400 Subject: [PATCH 16/48] lib: Rename HAVE_POLL to prevent conflicting #defines Rename HAVE_POLL to HAVE_POLL_CALL, when compiling with snmp and poll enabled this was causing issues. Signed-off-by: Donald Sharp --- configure.ac | 2 +- lib/thread.c | 30 +++++++++++++++--------------- lib/thread.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 63fbc304fc..9b4af1f2bf 100755 --- a/configure.ac +++ b/configure.ac @@ -321,7 +321,7 @@ if test "${enable_rr_semantics}" != "no" ; then fi if test "${enable_poll}" = "yes" ; then - AC_DEFINE(HAVE_POLL,,Compile systemd support in) + AC_DEFINE(HAVE_POLL_CALL,,Compile systemd support in) fi dnl ---------- diff --git a/lib/thread.c b/lib/thread.c index e3db7a93e5..e71b1cb139 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -486,7 +486,7 @@ thread_master_create (void) rv->timer->cmp = rv->background->cmp = thread_timer_cmp; rv->timer->update = rv->background->update = thread_timer_update; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) rv->handler.pfdsize = rv->fd_limit; rv->handler.pfdcount = 0; rv->handler.pfds = XCALLOC (MTYPE_THREAD_MASTER, @@ -642,7 +642,7 @@ thread_master_free (struct thread_master *m) thread_list_free (m, &m->unuse); thread_queue_free (m, m->background); -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) XFREE (MTYPE_THREAD_MASTER, m->handler.pfds); #endif XFREE (MTYPE_THREAD_MASTER, m); @@ -705,7 +705,7 @@ thread_get (struct thread_master *m, u_char type, return thread; } -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) #define fd_copy_fd_set(X) (X) @@ -759,7 +759,7 @@ static int fd_select (struct thread_master *m, int size, thread_fd_set *read, thread_fd_set *write, thread_fd_set *except, struct timeval *timer_wait) { int num; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) /* recalc timeout for poll. Attention NULL pointer is no timeout with select, where with poll no timeount is -1 */ int timeout = -1; @@ -777,7 +777,7 @@ fd_select (struct thread_master *m, int size, thread_fd_set *read, thread_fd_set static int fd_is_set (struct thread *thread, thread_fd_set *fdset, int pos) { -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) return 1; #else return FD_ISSET (THREAD_FD (thread), fdset); @@ -787,7 +787,7 @@ fd_is_set (struct thread *thread, thread_fd_set *fdset, int pos) static int fd_clear_read_write (struct thread *thread) { -#if !defined(HAVE_POLL) +#if !defined(HAVE_POLL_CALL) thread_fd_set *fdset = NULL; int fd = THREAD_FD (thread); @@ -812,7 +812,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, { struct thread *thread = NULL; -#if !defined(HAVE_POLL) +#if !defined(HAVE_POLL_CALL) thread_fd_set *fdset = NULL; if (dir == THREAD_READ) fdset = &m->handler.readfd; @@ -820,7 +820,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, fdset = &m->handler.writefd; #endif -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) thread = generic_thread_add(m, func, arg, fd, dir, debugargpass); if (thread == NULL) @@ -969,7 +969,7 @@ funcname_thread_add_event (struct thread_master *m, static void thread_cancel_read_or_write (struct thread *thread, short int state) { -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) nfds_t i; for (i=0;imaster->handler.pfdcount;++i) @@ -1003,7 +1003,7 @@ thread_cancel (struct thread *thread) switch (thread->type) { case THREAD_READ: -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) thread_cancel_read_or_write (thread, POLLIN | POLLHUP); #else thread_cancel_read_or_write (thread, 0); @@ -1011,7 +1011,7 @@ thread_cancel (struct thread *thread) thread_array = thread->master->read; break; case THREAD_WRITE: -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) thread_cancel_read_or_write (thread, POLLOUT | POLLHUP); #else thread_cancel_read_or_write (thread, 0); @@ -1143,7 +1143,7 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa thread_delete_fd (thread_array, thread); thread_list_add (&m->ready, thread); thread->type = THREAD_READY; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) thread->master->handler.pfds[pos].events &= ~(state); #endif return 1; @@ -1151,7 +1151,7 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa return 0; } -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) /* check poll events */ static void @@ -1192,7 +1192,7 @@ check_pollfds(struct thread_master *m, fd_set *readfd, int num) static void thread_process_fds (struct thread_master *m, thread_fd_set *rset, thread_fd_set *wset, int num) { -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) check_pollfds (m, rset, num); #else int ready = 0, index; @@ -1280,7 +1280,7 @@ thread_fetch (struct thread_master *m, struct thread *fetch) thread_process (&m->event); /* Structure copy. */ -#if !defined(HAVE_POLL) +#if !defined(HAVE_POLL_CALL) readfd = fd_copy_fd_set(m->handler.readfd); writefd = fd_copy_fd_set(m->handler.writefd); exceptfd = fd_copy_fd_set(m->handler.exceptfd); diff --git a/lib/thread.h b/lib/thread.h index 3440a92999..35a11cb77e 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -49,7 +49,7 @@ struct pqueue; */ typedef fd_set thread_fd_set; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) #include struct fd_handler { From ff871f86e119c5b916907fce4ac042d6e0125d58 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 8 Mar 2017 16:37:42 +0100 Subject: [PATCH 17/48] pimd: fix clang warning pimd/pim_sock.c:178:13: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion] ra[0] = 148; Signed-off-by: David Lamparter --- pimd/pim_sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index 54816d126b..e1949e3602 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -136,7 +136,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char lo /* Set router alert (RFC 2113) for all IGMP messages (RFC 3376 4. Message Formats)*/ if (protocol == IPPROTO_IGMP) { - char ra[4]; + uint8_t ra[4]; ra[0] = 148; ra[1] = 4; ra[2] = 0; From 399598bf6b749daa15d70ad64fc885d00cde1225 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 9 May 2017 14:52:54 -0400 Subject: [PATCH 18/48] bgpd: add back unicast option to 'address-family vpnv(4&6)' Issue #459 --- bgpd/bgp_vty.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 39933a1953..347d026aff 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6141,6 +6141,13 @@ DEFUN (address_family_vpnv4, return CMD_SUCCESS; } +ALIAS (address_family_vpnv4, + address_family_vpnv4_unicast_cmd, + "address-family vpnv4 unicast", + "Enter Address Family command mode\n" + "Address family\n" + "Address Family modifier\n") + DEFUN (address_family_vpnv6, address_family_vpnv6_cmd, "address-family vpnv6", @@ -6151,6 +6158,13 @@ DEFUN (address_family_vpnv6, return CMD_SUCCESS; } +ALIAS (address_family_vpnv6, + address_family_vpnv6_unicast_cmd, + "address-family vpnv6 unicast", + "Enter Address Family command mode\n" + "Address family\n" + "Address Family modifier\n") + DEFUN (address_family_encap, address_family_encap_cmd, "address-family encap", @@ -15149,7 +15163,9 @@ bgp_vty_init (void) install_element (BGP_NODE, &address_family_ipv6_cmd); install_element (BGP_NODE, &address_family_ipv6_safi_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); + install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); + install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); install_element (BGP_NODE, &address_family_encap_cmd); install_element (BGP_NODE, &address_family_encapv4_cmd); install_element (BGP_NODE, &address_family_encapv6_cmd); From 5490641755c40a9cdd56719766cf3aaa868342f9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 9 May 2017 16:18:04 -0400 Subject: [PATCH 19/48] *: Remove ability to install frr_sudoers If the user were to uncomment last line and allow VTYSH_SHOW to be used as a non-root account, this would allow arbitrary command completion inside of vtysh via multiple -c ... -c .... lines Signed-off-by: Donald Sharp --- cumulus/etc/sudoers.d/frr_sudoers | 15 --------------- debian/frr.postinst | 1 - 2 files changed, 16 deletions(-) delete mode 100644 cumulus/etc/sudoers.d/frr_sudoers diff --git a/cumulus/etc/sudoers.d/frr_sudoers b/cumulus/etc/sudoers.d/frr_sudoers deleted file mode 100644 index 4a42fb24f4..0000000000 --- a/cumulus/etc/sudoers.d/frr_sudoers +++ /dev/null @@ -1,15 +0,0 @@ -Defaults env_keep += VTYSH_PAGER - -# Allow user in group frr to run vtysh show commands -# without a password by uncommenting the "%frr" line below. - -# Subshell commands need to be disallowed, including -# preventing the user passing command line args like 'start-shell' -# Since vtysh allows minimum non-conflicting prefix'es, that means -# anything beginning with the string "st" in any arg. That's a bit -# restrictive. -# Instead, use NOEXEC, to prevent any exec'ed commands. - -Cmnd_Alias VTY_SHOW = /usr/bin/vtysh -c show * -# %frr ALL = (root) NOPASSWD:NOEXEC: VTY_SHOW - diff --git a/debian/frr.postinst b/debian/frr.postinst index 43d3ffa9e0..9020d7bf7a 100644 --- a/debian/frr.postinst +++ b/debian/frr.postinst @@ -15,7 +15,6 @@ frrvtygid=`egrep "^frrvty:" $GROUPFILE | awk -F ":" '{ print $3 }'` chown -R ${frruid}:${frrgid} /etc/frr touch /etc/frr/vtysh.conf chgrp ${frrvtygid} /etc/frr/vtysh* -chmod 440 /etc/sudoers.d/frr_sudoers chmod 644 /etc/frr/* ENVIRONMENTFILE=/etc/environment From 9bcb88c7bfc063e3f78965921e1ac0669e503c3f Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 10 May 2017 00:55:10 +0000 Subject: [PATCH 20/48] Change Frr.conf to frr.conf Signed-off-by: Daniel Walton --- cumulus/etc/frr/{Frr.conf => frr.conf} | 0 doc/Building_FRR_on_Ubuntu1604.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename cumulus/etc/frr/{Frr.conf => frr.conf} (100%) diff --git a/cumulus/etc/frr/Frr.conf b/cumulus/etc/frr/frr.conf similarity index 100% rename from cumulus/etc/frr/Frr.conf rename to cumulus/etc/frr/frr.conf diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/Building_FRR_on_Ubuntu1604.md index 7848ff68ab..2d5b57ed56 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/Building_FRR_on_Ubuntu1604.md @@ -120,7 +120,7 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: sudo install -m 644 cumulus/etc/default/frr /etc/default/frr sudo install -m 644 cumulus/etc/frr/daemons /etc/frr/daemons sudo install -m 644 cumulus/etc/frr/debian.conf /etc/frr/debian.conf - sudo install -m 644 cumulus/etc/frr/Frr.conf /etc/frr/Frr.conf + sudo install -m 644 cumulus/etc/frr/frr.conf /etc/frr/frr.conf sudo install -m 644 -o frr -g frr cumulus/etc/frr/vtysh.conf /etc/frr/vtysh.conf ### Enable daemons From 818c4f214a9bbad29b39dccb964ad231bc898baf Mon Sep 17 00:00:00 2001 From: Adam Fitzgerald Date: Thu, 11 May 2017 21:03:23 +1000 Subject: [PATCH 21/48] added troubleshooting section to debian 8 build doc --- doc/Building_FRR_on_Debian8.md | 41 +++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/doc/Building_FRR_on_Debian8.md b/doc/Building_FRR_on_Debian8.md index 0084433721..a60783d310 100644 --- a/doc/Building_FRR_on_Debian8.md +++ b/doc/Building_FRR_on_Debian8.md @@ -4,13 +4,13 @@ Building FRR on Debian 8 from Git Source Debian 8 restrictions: ---------------------- -- MPLS is not supported on `Debian 8` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use +- MPLS is not supported on `Debian 8` with default kernel. MPLS requires + Linux Kernel 4.5 or higher (LDP can be built, but may have limited use without MPLS) Install required packages ------------------------- - + Add packages: sudo apt-get install git autoconf automake libtool make gawk \ @@ -24,7 +24,7 @@ Install newer pytest (>3.0) from pip Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using +**This assumes you want to build and install FRR from source and not using any packages** ### Add frr groups and user @@ -87,7 +87,7 @@ an example.) ### Enable IP & IPv6 forwarding -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit `/etc/sysctl.conf` and uncomment the following values (ignore the other settings) # Uncomment the next line to enable packet forwarding for IPv4 @@ -99,3 +99,34 @@ other settings) net.ipv6.conf.all.forwarding=1 **Reboot** or use `sysctl -p` to apply the same config to the running system + +### Troubleshooting + +**Local state directory** + +The local state directory must exist and have the correct permissions applied +for the frrouting daemons to start. In the above ./configure example the +local state directory is set to /var/run/frr (--localstatedir=/var/run/frr) +Debian considers /var/run/frr to be temporary and this is removed after a +reboot. + +When using a different local state directory you need to create the new +directory and change the ownership to the frr user, for example: + + mkdir /var/opt/frr + chown frr /var/opt/frr + +**Shared library error** + +If you try and start any of the frrouting daemons you may see the below error +due to the frrouting shared library directory not being found: + + ./zebra: error while loading shared libraries: libfrr.so.0: cannot open shared object file: No such file or directory + +The fix is to add the following line to /etc/ld.so.conf which will continue to +reference the library directory after the system reboots. To load the library +directory path immediately run the ldconfig command after adding the line to +the file eg: + + echo include /usr/local/lib >> /etc/ld.so.conf + ldconfig From c358f112a6733d3507ad8cdc16fb54235dd065f9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 15 Nov 2016 09:39:35 -0500 Subject: [PATCH 22/48] bgpd: Fix occassional turn off of extended-nexthop for an if Sometimes, like once every 400 iterations, when you restart Quagga, extended-nexthop has been turned off for interface based config( for 5549 ). Examining the code, there is only 1 real path to setting the PEER_FLAG_CAPABILITITY_ENHE and that is through peer_conf_interface_get. Modify this code path to always set the PEER_FLAG_CAPABILITY_ENHE if it is not already set. In addition, fix a possible pointer dereference. Ticket: CM-12929 Signed-off-by: Donald Sharp --- bgpd/bgp_vty.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 347d026aff..4187654244 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2882,7 +2882,10 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi, NULL); - if (peer && v6only) + if (!peer) + return CMD_WARNING; + + if (v6only) SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); /* Request zebra to initiate IPv6 RAs on this interface. We do this @@ -2891,10 +2894,7 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, * gets deleted later etc.) */ if (peer->ifp) - { - bgp_zebra_initiate_radv (bgp, peer); - } - peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); + bgp_zebra_initiate_radv (bgp, peer); } else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) @@ -2915,8 +2915,8 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, bgp_session_reset(peer); } - if (!peer) - return CMD_WARNING; + if (!CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE)) + peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); if (peer_group_name) { From c22767d89ea4ca34d7054dbe39cac4d254974ff5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 15 Nov 2016 10:16:52 -0500 Subject: [PATCH 23/48] bgpd: Fix ADJCHANGE message to include more info When bgp logs ADJCHANGE messages include the hostname and vrf that this change is being made in. Ticket: CM-10922 Signed-off-by: Donald Sharp --- bgpd/bgp_fsm.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index e669b4f9b7..f20bd3bf26 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1021,8 +1021,14 @@ bgp_stop (struct peer *peer) /* bgp log-neighbor-changes of neighbor Down */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Down %s", peer->host, - peer_down_str [(int) peer->last_reset]); + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + (vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default", + peer_down_str [(int) peer->last_reset]); + } /* graceful restart */ if (peer->t_gr_stale) @@ -1459,8 +1465,13 @@ bgp_establish (struct peer *peer) /* bgp log-neighbor-changes of neighbor Up */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Up", peer->host); - + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + (vrf->vrf_id != VRF_DEFAULT ) ? vrf->name : "Default"); + } /* assign update-group/subgroup */ update_group_adjust_peer_afs(peer); From 70a4754dd0eec88e0294c645d7c93d08e4356dda Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Nov 2016 11:28:11 -0500 Subject: [PATCH 24/48] ospfd: Fix possible crash and wrong data being shown When you have more than one ospf interface configured to be used, we were attempting to reuse the json_interface_sub pointer after we added it to the json data structure. Ticket: CM-13597 Signed-off-by: Donald Sharp --- ospfd/ospf_vty.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 2724df98a0..b13c28d0c9 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3967,9 +3967,14 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, { show_ip_ospf_interface_sub (vty, ospf, ifp, json_interface_sub, use_json); if (use_json) - json_object_object_add(json, ifp->name, json_interface_sub); + { + json_object_object_add(json, ifp->name, json_interface_sub); + json_interface_sub = json_object_new_object (); + } } } + if (use_json) + json_object_free (json_interface_sub); } else { From 71ffee748f3a5466dc3e73e9f5fb5b286ff3b6c5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Nov 2016 12:00:40 -0500 Subject: [PATCH 25/48] bgpd: More Extended nexthop fixing Basically if we are reading in a cli with a extended-nexthop and we have not received from zebra the interface we are working on I believe we have a race condition where we are not propagating the PEER_FLAG_CAPABILITY_ENHE in this case. Modify the code to propagate even if we haven't found the interface yet. Signed-off-by: Donald Sharp --- bgpd/bgpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 86133cd763..c6997a9b83 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2652,7 +2652,7 @@ peer_group_bind (struct bgp *bgp, union sockunion *su, struct peer *peer, * Capability extended-nexthop is enabled for an interface neighbor by * default. So, fix that up here. */ - if (peer->ifp && cap_enhe_preset) + if (peer->conf_if && cap_enhe_preset) peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); for (afi = AFI_IP; afi < AFI_MAX; afi++) From 2dbfa8a020315ae7d3572bd1c691701c25e3c54a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Nov 2016 22:17:39 -0500 Subject: [PATCH 26/48] ospf6d: Fix debug line always showing up in ospf6d The command 'debug ospf6 lsa unknown' was always showing up, upon starting of the ospf6 daemon. Remove this from happening. Also fix some help strings while we are in there. Ticket: CM-7913 Signed-off-by: Donald Sharp --- ospf6d/ospf6_lsa.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 35e5a91544..f3afd487e4 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -77,8 +77,7 @@ struct ospf6_lsa_handler unknown_handler = "Unknown", "Unk", ospf6_unknown_lsa_show, - NULL, - OSPF6_LSA_DEBUG, + NULL }; void @@ -822,7 +821,14 @@ DEFUN (debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" + "Router LSA's\n" + "Network LSA's\n" + "Inter-Prefix LSA's\n" + "Inter-Router LSA's\n" + "AS-External LSA's\n" + "Link LSA's\n" + "Intra-Prefix LSA's\n" + "Unknown LSA's\n" ) { unsigned int i; @@ -876,7 +882,14 @@ DEFUN (no_debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" + "Router LSA's\n" + "Network LSA's\n" + "Inter-Prefix LSA's\n" + "Inter-Router LSA's\n" + "AS-External LSA's\n" + "Link LSA's\n" + "Intra-Prefix LSA's\n" + "Unknown LSA's\n" ) { u_int i; From 5b0747d71df6006835ead8e6354f70b26f7bca80 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 18 Nov 2016 11:41:53 -0500 Subject: [PATCH 27/48] ospf6d: Allow unconfig of unknown lsa's When we are receiving the 'no debug ospf6 lsa unknown ...' Allow the removal of the originate examine and flooding keywords. Ticket: CM-12805 Signed-off-by: Donald Sharp --- ospf6d/ospf6_lsa.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index f3afd487e4..867dc3d9d8 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -872,7 +872,17 @@ ALIAS (debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" + "Router LSA's\n" + "Network LSA's\n" + "Inter-Prefix LSA's\n" + "Inter-Router LSA's\n" + "AS-External LSA's\n" + "Link LSA's\n" + "Intra-Prefix LSA's\n" + "Unknown LSA's\n" + "Originate\n" + "Examine\n" + "Flooding\n" ) DEFUN (no_debug_ospf6_lsa_type, @@ -928,12 +938,22 @@ DEFUN (no_debug_ospf6_lsa_type, ALIAS (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_detail_cmd, - "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix) (originate|examine|flooding)", + "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)", NO_STR DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" + "Router LSA's\n" + "Network LSA's\n" + "Inter-Prefix LSA's\n" + "Inter-Router LSA's\n" + "AS-External LSA's\n" + "Link LSA's\n" + "Intra-Prefix LSA's\n" + "Unknown LSA's\n" + "Originate\n" + "Examine\n" + "Flooding\n" ) void From c2f613443672d8dd95e505ff14a92693448173df Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 1 Dec 2016 08:59:16 -0500 Subject: [PATCH 28/48] bgpd: Fix vrf crash Ensure that we have a valid vrf before we log information about it. Signed-off-by: Donald Sharp Reviewed-by: Don Slice --- bgpd/bgp_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index f20bd3bf26..2f37f39ffd 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1470,7 +1470,7 @@ bgp_establish (struct peer *peer) zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up", peer->host, (peer->hostname) ? peer->hostname : "Unknown", - (vrf->vrf_id != VRF_DEFAULT ) ? vrf->name : "Default"); + vrf ? ((vrf->vrf_id != VRF_DEFAULT ) ? vrf->name : "Default") : ""); } /* assign update-group/subgroup */ update_group_adjust_peer_afs(peer); From d32dfc22011c79c87edcdf05b66f4598443ee7b2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 15 Nov 2016 10:16:52 -0500 Subject: [PATCH 29/48] bgpd: Fix ADJCHANGE message to include more info When bgp logs ADJCHANGE messages include the hostname and vrf that this change is being made in. Ticket: CM-10922 Signed-off-by: Donald Sharp --- bgpd/bgp_fsm.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index e669b4f9b7..f20bd3bf26 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1021,8 +1021,14 @@ bgp_stop (struct peer *peer) /* bgp log-neighbor-changes of neighbor Down */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Down %s", peer->host, - peer_down_str [(int) peer->last_reset]); + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + (vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default", + peer_down_str [(int) peer->last_reset]); + } /* graceful restart */ if (peer->t_gr_stale) @@ -1459,8 +1465,13 @@ bgp_establish (struct peer *peer) /* bgp log-neighbor-changes of neighbor Up */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Up", peer->host); - + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + (vrf->vrf_id != VRF_DEFAULT ) ? vrf->name : "Default"); + } /* assign update-group/subgroup */ update_group_adjust_peer_afs(peer); From 2e37f307ee663c3955044c6fa97914c37fed9751 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Tue, 22 Nov 2016 09:48:16 -0800 Subject: [PATCH 30/48] bgpd: fix crash in bgp_stop due to missing vrf Problem found to be derefencing a vrf that had already been deleted. Fix verifies that vrf exists before using it. Ticket: CM-13682 Signed-off-by: Don Slice Reviewed By: Vivek Venkatraman Testing Done: manual testing, re-run of failing scripts good --- bgpd/bgp_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index f20bd3bf26..e3968d21cd 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1026,7 +1026,7 @@ bgp_stop (struct peer *peer) zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s", peer->host, (peer->hostname) ? peer->hostname : "Unknown", - (vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default", + vrf ? ((vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default") : "", peer_down_str [(int) peer->last_reset]); } From fa14eb2c0b408982a6634459b3afb21e9df6326a Mon Sep 17 00:00:00 2001 From: Don Slice Date: Wed, 5 Apr 2017 07:13:45 -0700 Subject: [PATCH 31/48] bgpd: resolve ipv6 ecmp issue with vrfs and ll nexthop Problem reported that ecmp wasn't working correctly in a vrf with ipv6. Issue was that originator of the routes were sending the updates with a link-local nexthop and nhlen of 16. In this particular case, bgp_zebra_announce was using the wrong call to get the ifindex and was not supplying the vrf. This caused ecmp to work only in the case of the default vrf. Ticket: CM-15545 Signed-off-by: Don Slice Reviewed-by: CCR-6017 --- bgpd/bgp_zebra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 3d3bd90f5b..d07fc65bdf 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1469,7 +1469,8 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, if (!ifindex) { if (info->peer->conf_if || info->peer->ifname) - ifindex = if_nametoindex (info->peer->conf_if ? info->peer->conf_if : info->peer->ifname); + ifindex = ifname2ifindex_vrf (info->peer->conf_if ? info->peer->conf_if : + info->peer->ifname, bgp->vrf_id); else if (info->peer->nexthop.ifp) ifindex = info->peer->nexthop.ifp->ifindex; } From 83f35619359379687f21c839d61121e4ebe72541 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 16 May 2017 23:49:53 +0000 Subject: [PATCH 32/48] zebra: 'no ip route 4.1.1.19 255.255.255.255 99' is ambiguous Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp --- zebra/zebra_mpls_vty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 8b967c3af8..343f2975e8 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -472,7 +472,7 @@ DEFUN (no_ip_route_tag_distance_label, DEFUN (no_ip_route_mask_distance_label, no_ip_route_mask_distance_label_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>", + "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> label WORD", NO_STR IP_STR "Establish static routes\n" @@ -486,7 +486,7 @@ DEFUN (no_ip_route_mask_distance_label, "One or more labels separated by '/'\n") { return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, - argv[3], NULL, argv[5]); + argv[3], NULL, argv[4]); } DEFUN (no_ip_route_mask_tag_distance_label, From 464598de53722b515c0967eb223aa538bb27ecf6 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 16 May 2017 23:54:46 +0000 Subject: [PATCH 33/48] bgpd: "neighbor swpX interface remote-as XYZ" is ignored Signed-off-by: Daniel Walton Reviewed-by: Don Slice If you did: neighbor swp1 interface neighbor swp1 interface remote-as external we would not set the remote-as. You could however still do neighbor swp1 remote-as external --- bgpd/bgp_vty.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 347d026aff..f163fef712 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2872,7 +2872,12 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, } peer = peer_lookup_by_conf_if (bgp, conf_if); - if (!peer) + if (peer) + { + if (as_str) + ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); + } + else { if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) && afi == AFI_IP && safi == SAFI_UNICAST) @@ -2896,8 +2901,9 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, } peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); } - else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || - (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) + + if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || + (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) { if (v6only) SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); From 10a6a98b0af1c5490c8b87ab0ce15d5edabbbc35 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 16 May 2017 23:56:31 +0000 Subject: [PATCH 34/48] bgpd: does not honor configured keepalive timer Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp --- bgpd/bgp_packet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 796a57f054..5ac982d565 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1118,7 +1118,10 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) else peer->v_holdtime = send_holdtime; - peer->v_keepalive = peer->v_holdtime / 3; + if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)) + peer->v_keepalive = peer->keepalive; + else + peer->v_keepalive = peer->v_holdtime / 3; /* Open option part parse. */ if (optlen != 0) From 501be9875b7e385d4b39e85ea6bddd431e87e8bb Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 16 May 2017 23:58:34 +0000 Subject: [PATCH 35/48] bgpd: 'redistribute' triggers both IPv4 and IPv6 code paths Signed-off-by: Daniel Walton Whenever you did "redistribute" zebra would kick this off for ipv4 and ipv6. No real issue other than this is sub-optimal --- zebra/redistribute.c | 56 ++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 9c7ef5f12c..5d7dbd5b00 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -108,42 +108,38 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id) /* Redistribute routes. */ static void -zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id) +zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id, int afi) { struct rib *newrib; struct route_table *table; struct route_node *rn; - int afi; - for (afi = AFI_IP; afi <= AFI_IP6; afi++) - { - table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id); - if (! table) - continue; + table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id); + if (! table) + return; - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, newrib) - { - if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, " - "zebra_check_addr=%d", __func__, - CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED), - newrib->type, newrib->distance, - zebra_check_addr (&rn->p)); + for (rn = route_top (table); rn; rn = route_next (rn)) + RNODE_FOREACH_RIB (rn, newrib) + { + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, " + "zebra_check_addr=%d", __func__, + CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED), + newrib->type, newrib->distance, + zebra_check_addr (&rn->p)); - if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED)) - continue; - if ((type != ZEBRA_ROUTE_ALL && - (newrib->type != type || newrib->instance != instance))) - continue; - if (newrib->distance == DISTANCE_INFINITY) - continue; - if (! zebra_check_addr (&rn->p)) - continue; + if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED)) + continue; + if ((type != ZEBRA_ROUTE_ALL && + (newrib->type != type || newrib->instance != instance))) + continue; + if (newrib->distance == DISTANCE_INFINITY) + continue; + if (! zebra_check_addr (&rn->p)) + continue; - zsend_redistribute_route (1, client, &rn->p, newrib); - } - } + zsend_redistribute_route (1, client, &rn->p, newrib); + } } /* Either advertise a route for redistribution to registered clients or */ @@ -262,13 +258,13 @@ zebra_redistribute_add (int command, struct zserv *client, int length, if (! redist_check_instance (&client->mi_redist[afi][type], instance)) { redist_add_instance (&client->mi_redist[afi][type], instance); - zebra_redistribute (client, type, instance, zvrf_id (zvrf)); + zebra_redistribute (client, type, instance, zvrf_id (zvrf), afi); } } else { if (! vrf_bitmap_check (client->redist[afi][type], zvrf_id (zvrf))) { vrf_bitmap_set (client->redist[afi][type], zvrf_id (zvrf)); - zebra_redistribute (client, type, 0, zvrf_id (zvrf)); + zebra_redistribute (client, type, 0, zvrf_id (zvrf), afi); } } } From 3bd07551f803960920db358dd8291b24ca50ec79 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:01:23 +0000 Subject: [PATCH 36/48] bgp: garbage "neighbor (af 54816) remote-as internal" peer in show run Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f163fef712..6f330b0d03 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2875,7 +2875,7 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, if (peer) { if (as_str) - ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); + ret = peer_remote_as (bgp, &su, conf_if, &as, as_type, afi, safi); } else { From 46111f2f48e964ac14b617f77fccb574cfb8d693 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:07:02 +0000 Subject: [PATCH 37/48] bgpd: Add epoch uptime to BGP neighbor json outputs Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 4 ++++ bgpd/bgpd.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 6f330b0d03..f71d03e46b 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -11087,6 +11087,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js u_int16_t i; u_char *msg; json_object *json_neigh = NULL; + time_t epoch_tbuf; bgp = p->bgp; @@ -11277,8 +11278,11 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js uptime = bgp_clock(); uptime -= p->uptime; tm = gmtime(&uptime); + epoch_tbuf = time(NULL) - uptime; json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); + json_object_string_add(json_neigh, "bgpTimerUpString", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); + json_object_int_add(json_neigh, "bgpTimerUpEstablishedEpoch", epoch_tbuf); } else if (p->status == Active) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 86133cd763..31d54a3e98 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6250,7 +6250,7 @@ peer_clear_soft (struct peer *peer, afi_t afi, safi_t safi, char * peer_uptime (time_t uptime2, char *buf, size_t len, u_char use_json, json_object *json) { - time_t uptime1; + time_t uptime1, epoch_tbuf; struct tm *tm; /* Check buffer length. */ @@ -6304,8 +6304,10 @@ peer_uptime (time_t uptime2, char *buf, size_t len, u_char use_json, json_object if (use_json) { + epoch_tbuf = time(NULL) - uptime1; json_object_string_add(json, "peerUptime", buf); json_object_long_add(json, "peerUptimeMsec", uptime1 * 1000); + json_object_int_add(json, "peerUptimeEstablishedEpoch", epoch_tbuf); } return buf; From 825be4c27bc165e68ebcb1de8d1beebdbd8c82e9 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:14:37 +0000 Subject: [PATCH 38/48] tools: frr-reload.py should exit non-zero when "set src x.x.x.x" fails Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp --- tools/frr-reload.py | 34 +++++++++++++++++++++++++++++----- vtysh/vtysh.c | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 80d2d6a2a3..0e71eaa04c 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -346,6 +346,7 @@ end "debug ", "dump ", "enable ", + "frr ", "hostname ", "ip ", "ipv6 ", @@ -888,11 +889,15 @@ if __name__ == '__main__': # Verify the new config file is valid if not os.path.isfile(args.filename): - print "Filename %s does not exist" % args.filename + msg = "Filename %s does not exist" % args.filename + print msg + log.error(msg) sys.exit(1) if not os.path.getsize(args.filename): - print "Filename %s is an empty file" % args.filename + msg = "Filename %s is an empty file" % args.filename + print msg + log.error(msg) sys.exit(1) # Verify that 'service integrated-vtysh-config' is configured @@ -909,7 +914,9 @@ if __name__ == '__main__': break if not service_integrated_vtysh_config: - print "'service integrated-vtysh-config' is not configured, this is required for 'service frr reload'" + msg = "'service integrated-vtysh-config' is not configured, this is required for 'service frr reload'" + print msg + log.error(msg) sys.exit(1) if args.debug: @@ -920,6 +927,7 @@ if __name__ == '__main__': # Create a Config object from the config generated by newconf newconf = Config() newconf.load_from_file(args.filename) + reload_ok = True if args.test: @@ -1029,7 +1037,7 @@ if __name__ == '__main__': # 'no ip ospf authentication message-digest 1.1.1.1' in # our example above # - Split that last entry by whitespace and drop the last word - log.warning('Failed to execute %s', ' '.join(cmd)) + log.info('Failed to execute %s', ' '.join(cmd)) last_arg = cmd[-1].split(' ') if len(last_arg) <= 2: @@ -1064,9 +1072,25 @@ if __name__ == '__main__': with open(filename, 'w') as fh: for line in lines_to_configure: fh.write(line + '\n') - subprocess.call(['/usr/bin/vtysh', '-f', filename]) + + output = subprocess.check_output(['/usr/bin/vtysh', '-f', filename]) + + # exit non-zero if we see these errors + for x in ('BGP instance name and AS number mismatch', + 'BGP instance is already running', + '% not a local address'): + for line in output.splitlines(): + if x in line: + msg = "ERROR: %s" % x + log.error(msg) + print msg + reload_ok = False + os.unlink(filename) # Make these changes persistent if args.overwrite or args.filename != '/etc/frr/frr.conf': subprocess.call(['/usr/bin/vtysh', '-c', 'write']) + + if not reload_ok: + sys.exit(1) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 51f71a46bb..2994c3507a 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -635,7 +635,7 @@ vtysh_mark_file (const char *filename) } } /* This is the end */ - fprintf(stdout, "end\n"); + fprintf(stdout, "\nend\n"); vty_close(vty); XFREE(MTYPE_VTYSH_CMD, vty_buf_copy); From afa2e8e1870eab4578e19c80cfd23bb443d1adbe Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:16:09 +0000 Subject: [PATCH 39/48] tools: reload handle removal of entire address-family section under BGP Signed-off-by: Daniel Walton When an entire address-family section is removed from under BGP, we cannot just issue 'no address-family foo bar' as address-family line doesn't support 'no'. We have to delete the individual lines under the address-family. --- tools/frr-reload.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 0e71eaa04c..1ef6920d06 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -814,6 +814,14 @@ def compare_context_objects(newconf, running): elif "router bgp" in running_ctx_keys[0] and len(running_ctx_keys) > 1 and delete_bgpd: continue + elif ("router bgp" in running_ctx_keys[0] and + len(running_ctx_keys) > 1 and + running_ctx_keys[1].startswith('address-family')): + # There's no 'no address-family' support and so we have to + # delete each line individually again + for line in running_ctx.lines: + lines_to_del.append((running_ctx_keys, line)) + # Non-global context elif running_ctx_keys and not any("address-family" in key for key in running_ctx_keys): lines_to_del.append((running_ctx_keys, None)) From 970c956816599fe3d58bc45ca3a18b9542467337 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:18:33 +0000 Subject: [PATCH 40/48] tools: frr-reload removes "ipv6 nd ra-interval" and "no ipv6 nd supp" Signed-off-by: Daniel Walton --- tools/frr-reload.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 1ef6920d06..f6cb6d9910 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -1009,7 +1009,20 @@ if __name__ == '__main__': (lines_to_add, lines_to_del) = compare_context_objects(newconf, running) - if lines_to_del: + # Only do deletes on the first pass. The reason being if we + # configure a bgp neighbor via "neighbor swp1 interface" frr + # will automatically add: + # + # interface swp1 + # ipv6 nd ra-interval 10 + # no ipv6 nd suppress-ra + # ! + # + # but those lines aren't in the config we are reloading against so + # on the 2nd pass they will show up in lines_to_del. This could + # apply to other scenarios as well where configuring FOO adds BAR + # to the config. + if lines_to_del and x == 0: for (ctx_keys, line) in lines_to_del: if line == '!': From 619c4e3acf2077dc16adf6ebd48adaec9365c623 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:22:00 +0000 Subject: [PATCH 41/48] frr-reload.py fails on "no debug ospf6 message unknown" Signed-off-by: Daniel Walton --- tools/frr-reload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index f6cb6d9910..090937ed27 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -351,6 +351,7 @@ end "ip ", "ipv6 ", "log ", + "no ", "password ", "ptm-enable", "router-id ", From ec3fd9577411a4555a9988f8187e2d1598cd2b00 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:23:38 +0000 Subject: [PATCH 42/48] tools: frr-reload.py VtyshMarkException needs to include "vtysh -m" output Signed-off-by: Daniel Walton --- tools/frr-reload.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 090937ed27..11e0bdc681 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -109,9 +109,12 @@ class Config(object): log.info('Loading Config object from file %s', filename) try: - file_output = subprocess.check_output(['/usr/bin/vtysh', '-m', '-f', filename]) + file_output = subprocess.check_output(['/usr/bin/vtysh', '-m', '-f', filename], + stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - raise VtyshMarkException(str(e)) + ve = VtyshMarkException(e) + ve.output = e.output + raise ve for line in file_output.split('\n'): line = line.strip() @@ -134,9 +137,11 @@ class Config(object): try: config_text = subprocess.check_output( "/usr/bin/vtysh -c 'show run' | /usr/bin/tail -n +4 | /usr/bin/vtysh -m -f -", - shell=True) + shell=True, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - raise VtyshMarkException(str(e)) + ve = VtyshMarkException(e) + ve.output = e.output + raise ve for line in config_text.split('\n'): line = line.strip() From e80c8c5531635e9df550f11b466f35644668f9f5 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 17 May 2017 00:25:28 +0000 Subject: [PATCH 43/48] tools: Allow frr-reload.py to know about agentx Signed-off-by: Daniel Walton Signed-off-by: Donald Sharp --- tools/frr-reload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 11e0bdc681..a9151e3e7d 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -347,6 +347,7 @@ end # the keywords that we know are single line contexts. bgp in this case # is not the main router bgp block, but enabling multi-instance oneline_ctx_keywords = ("access-list ", + "agentx", "bgp ", "debug ", "dump ", From 9c5cd62f08f5e0d77a6474e15a49dcf8bd8ce21c Mon Sep 17 00:00:00 2001 From: Don Slice Date: Wed, 23 Nov 2016 11:58:27 -0800 Subject: [PATCH 44/48] zebra: Move interfaces to default before deleting Encountered a crash in zebra due to getting a delete on an SVI with VRR configured. Since we don't actually do a delete but flag the interface as inactive, slag VRR interfaces would remain on the vrf_iflist with a lock count of zero, causing the crash. Since all other interface types are moved to the default table before deleting, doing the same thing for any interfaces that were left in the vrf. Testing includes manual testing, bgp-min, ospf-min, vrf-min, bgp-smoke, and ospf-smoke. All passed (first time or on rerun) or match known failures. Ticket: CM-13288 Signed-off-by: Don Slice Reviewed-by: Donald Sharp --- zebra/interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zebra/interface.c b/zebra/interface.c index 39c20e6289..524183a434 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -693,6 +693,10 @@ if_delete_update (struct interface *ifp) for setting ifindex to IFINDEX_INTERNAL after processing the interface deletion message. */ ifp->ifindex = IFINDEX_INTERNAL; + + /* if the ifp is in a vrf, move it to default so vrf can be deleted if desired */ + if (ifp->vrf_id) + if_handle_vrf_change (ifp, VRF_DEFAULT); } /* VRF change for an interface */ From 63d825b0db90ba8a69c3da42a8fc163541495a13 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Tue, 6 Dec 2016 09:29:05 -0800 Subject: [PATCH 45/48] zebrad: Correct problem removing dead routes from rib due to NHT issue Fix for another issue with next-hop tracking for overlapping static routes created a problem removing the dead routes. This fix corrects that error. Ticket: CM-13710 Signed-off-by: Don Slice Reviewed By: Donald Sharp Testing Done: ospf-smoke, bgp-smoke --- zebra/zebra_rnh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index b679803b06..1032d5405f 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -546,7 +546,7 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family, { RNODE_FOREACH_RIB(static_rn, srib) { - if (srib->type == ZEBRA_ROUTE_STATIC) + if (srib->type != ZEBRA_ROUTE_STATIC) continue; /* Set the filter flag for the correct nexthop - static route may From 1dac3a9619c8436f81c7b37f0252574b0b677dd0 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Tue, 14 Feb 2017 09:15:40 -0800 Subject: [PATCH 46/48] zebra: stop deregistering static nexthops unless removing the static Problem reported was that with some overlapping static route configurations, when the link went down the less specific static was not re-installed after the link came back up. Determined that with the overlapping statics, we would recursively resolve the next-hop temporarily thru the more specific static route, but since the next-hop wasn't actually reachable, we would go through the code that clears the nht information for the static completely. This caused the nht code to no longer process the static route. After reviewing the process, there doesn't seem to be any reason that the static should be deregistered in that section of code. Removed the deregister and the problem is resolved and not addional failures seen in manual testing. zebra_test.py completed successfully and ospf and bgp smokes completed with no new failures. Ticket: CM-14873 Signed-off-by: Don Slice Reviewed-by: CCR-5696 --- zebra/zebra_rib.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index e48da0479b..23c4c9ebea 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -366,7 +366,6 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set, if (set) { UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); - zebra_deregister_rnh_static_nexthops(rib->vrf_id, nexthop->resolved, top); nexthops_free(nexthop->resolved); nexthop->resolved = NULL; rib->nexthop_mtu = 0; @@ -597,7 +596,6 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set, if (set) { UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); - zebra_deregister_rnh_static_nexthops (rib->vrf_id, nexthop->resolved, top); nexthops_free(nexthop->resolved); nexthop->resolved = NULL; } From a27cb3cfe901d4f1378116bc91e6656aaed7c74c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 17 May 2017 20:31:19 +0000 Subject: [PATCH 47/48] ospf6d: fix decimal area ID cli Not all numbers are dotted quads Signed-off-by: Quentin Young --- ospf6d/ospf6_area.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index bbab8598b8..1691e501f8 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -406,26 +406,11 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) } -#define OSPF6_CMD_AREA_LOOKUP(str, oa) \ -{ \ - u_int32_t area_id = 0; \ - if (inet_pton (AF_INET, str, &area_id) != 1) \ - { \ - vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ - return CMD_SUCCESS; \ - } \ - oa = ospf6_area_lookup (area_id, ospf6); \ - if (oa == NULL) \ - { \ - vty_out (vty, "No such Area: %s%s", str, VNL); \ - return CMD_SUCCESS; \ - } \ -} - #define OSPF6_CMD_AREA_GET(str, oa) \ { \ - u_int32_t area_id = 0; \ - if (inet_pton (AF_INET, str, &area_id) != 1) \ + char *ep; \ + u_int32_t area_id = htonl (strtol(str, &ep, 10)); \ + if (*ep && inet_pton (AF_INET, str, &area_id) != 1) \ { \ vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ return CMD_SUCCESS; \ From b2b6f8f33c934c87de580a1665acfe79e434b3ec Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Thu, 18 May 2017 11:41:01 +0200 Subject: [PATCH 48/48] Pre-revert nonmergeable changes Revert "ospf6d: fix decimal area ID cli" commit a27cb3cfe901d4f1378116bc91e6656aaed7c74c Revert "bgpd: add back unicast option to 'address-family vpnv(4&6)' Issue #459" commit 399598bf6b749daa15d70ad64fc885d00cde1225 Revert "Fix the memory leak" commit d8d58e98397d8442ec68f8d715b64d5e6000b903 Revert "zebra: 'no ip route 4.1.1.19 255.255.255.255 99' is ambiguous" commit 83f35619359379687f21c839d61121e4ebe72541 Revert "ospf6d: Allow unconfig of unknown lsa's" commit 5b0747d71df6006835ead8e6354f70b26f7bca80 Revert "Fix the "Dead assignment" of clang SA." commit 3a6570a1f145c49155d72a815441025085dd45ad Revert "snapcraft: Improve README.usage.md based on feedback received" commit 2a3a819a9c2b2c9700e6228e7352e53b3562776c Revert "zebra: stop deregistering static nexthops unless removing the static" commit 1dac3a9619c8436f81c7b37f0252574b0b677dd0 All of these changes do not apply on stable/3.0 due to either CLI changes or another fix already being present. Signed-off-by: David Lamparter --- bgpd/bgp_vty.c | 16 ----------- lib/csv.c | 7 ----- ospf6d/ospf6_area.c | 21 ++++++++++++-- ospf6d/ospf6_lsa.c | 26 ++--------------- ospfd/ospf_apiserver.c | 2 +- ospfd/ospf_vty.c | 9 ++++++ pimd/pim_register.c | 4 +-- snapcraft/README.usage.md | 59 ++++----------------------------------- zebra/zebra_mpls_vty.c | 4 +-- zebra/zebra_rib.c | 2 ++ 10 files changed, 42 insertions(+), 108 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9d5a4bd1cf..eef11441d6 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6147,13 +6147,6 @@ DEFUN (address_family_vpnv4, return CMD_SUCCESS; } -ALIAS (address_family_vpnv4, - address_family_vpnv4_unicast_cmd, - "address-family vpnv4 unicast", - "Enter Address Family command mode\n" - "Address family\n" - "Address Family modifier\n") - DEFUN (address_family_vpnv6, address_family_vpnv6_cmd, "address-family vpnv6", @@ -6164,13 +6157,6 @@ DEFUN (address_family_vpnv6, return CMD_SUCCESS; } -ALIAS (address_family_vpnv6, - address_family_vpnv6_unicast_cmd, - "address-family vpnv6 unicast", - "Enter Address Family command mode\n" - "Address family\n" - "Address Family modifier\n") - DEFUN (address_family_encap, address_family_encap_cmd, "address-family encap", @@ -15173,9 +15159,7 @@ bgp_vty_init (void) install_element (BGP_NODE, &address_family_ipv6_cmd); install_element (BGP_NODE, &address_family_ipv6_safi_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); - install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); - install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); install_element (BGP_NODE, &address_family_encap_cmd); install_element (BGP_NODE, &address_family_encapv4_cmd); install_element (BGP_NODE, &address_family_encapv6_cmd); diff --git a/lib/csv.c b/lib/csv.c index 95e3e97768..7df9292647 100644 --- a/lib/csv.c +++ b/lib/csv.c @@ -177,9 +177,6 @@ csv_decode_record(csv_record_t *rec) field = strpbrk(curr, ","); } field = strstr(curr, "\n"); - if (!field) { - return; - } fld = malloc(sizeof(csv_field_t)); if (field && fld) { fld->field = curr; @@ -242,10 +239,6 @@ csv_encode (csv_t *csv, rec = malloc(sizeof(csv_record_t)); if (!rec) { log_error("record malloc failed\n"); - if (!buf) { - free(str); - } - va_end(list); return (NULL); } csv_init_record(rec); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 1691e501f8..bbab8598b8 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -406,11 +406,26 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) } +#define OSPF6_CMD_AREA_LOOKUP(str, oa) \ +{ \ + u_int32_t area_id = 0; \ + if (inet_pton (AF_INET, str, &area_id) != 1) \ + { \ + vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ + return CMD_SUCCESS; \ + } \ + oa = ospf6_area_lookup (area_id, ospf6); \ + if (oa == NULL) \ + { \ + vty_out (vty, "No such Area: %s%s", str, VNL); \ + return CMD_SUCCESS; \ + } \ +} + #define OSPF6_CMD_AREA_GET(str, oa) \ { \ - char *ep; \ - u_int32_t area_id = htonl (strtol(str, &ep, 10)); \ - if (*ep && inet_pton (AF_INET, str, &area_id) != 1) \ + u_int32_t area_id = 0; \ + if (inet_pton (AF_INET, str, &area_id) != 1) \ { \ vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ return CMD_SUCCESS; \ diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 867dc3d9d8..f3afd487e4 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -872,17 +872,7 @@ ALIAS (debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Router LSA's\n" - "Network LSA's\n" - "Inter-Prefix LSA's\n" - "Inter-Router LSA's\n" - "AS-External LSA's\n" - "Link LSA's\n" - "Intra-Prefix LSA's\n" - "Unknown LSA's\n" - "Originate\n" - "Examine\n" - "Flooding\n" + "Specify LS type as Hexadecimal\n" ) DEFUN (no_debug_ospf6_lsa_type, @@ -938,22 +928,12 @@ DEFUN (no_debug_ospf6_lsa_type, ALIAS (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_detail_cmd, - "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)", + "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix) (originate|examine|flooding)", NO_STR DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Router LSA's\n" - "Network LSA's\n" - "Inter-Prefix LSA's\n" - "Inter-Router LSA's\n" - "AS-External LSA's\n" - "Link LSA's\n" - "Intra-Prefix LSA's\n" - "Unknown LSA's\n" - "Originate\n" - "Examine\n" - "Flooding\n" + "Specify LS type as Hexadecimal\n" ) void diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 620dacb157..aac8ef4b8b 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -2459,7 +2459,7 @@ ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr) { struct msg *msg; struct in_addr ifaddr = { .s_addr = 0L }; - struct in_addr nbraddr; + struct in_addr nbraddr = { .s_addr = 0L }; assert (nbr); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index b13c28d0c9..c65d148ff0 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6763,6 +6763,7 @@ DEFUN (no_ip_ospf_cost, int ret; struct ospf_if_params *params; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 1) @@ -6831,6 +6832,7 @@ DEFUN (no_ip_ospf_cost2, int ret; struct ospf_if_params *params; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); /* According to the semantics we are mimicking "no ip ospf cost N" is @@ -7070,6 +7072,7 @@ DEFUN (no_ip_ospf_dead_interval, struct ospf_interface *oi; struct route_node *rn; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 2) @@ -7244,6 +7247,7 @@ DEFUN (no_ip_ospf_hello_interval, int ret; struct ospf_if_params *params; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 2) @@ -7521,6 +7525,7 @@ DEFUN (no_ip_ospf_priority, int ret; struct ospf_if_params *params; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc == 2) @@ -7667,6 +7672,7 @@ DEFUN (no_ip_ospf_retransmit_interval, struct ospf_if_params *params; int addr_index; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc >= 1) @@ -7738,6 +7744,7 @@ DEFUN (no_ip_ospf_retransmit_interval_sec, struct interface *ifp = vty->index; struct ospf_if_params *params; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); UNSET_IF_PARAM (params, retransmit_interval); @@ -7822,6 +7829,7 @@ DEFUN (no_ip_ospf_transmit_delay, struct ospf_if_params *params; int addr_index; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); if (argc >= 1) @@ -7894,6 +7902,7 @@ DEFUN (no_ip_ospf_transmit_delay_sec, struct interface *ifp = vty->index; struct ospf_if_params *params; + ifp = vty->index; params = IF_DEF_PARAMS (ifp); UNSET_IF_PARAM (params, transmit_delay); diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 7844bd3399..ce3ac1a433 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -160,8 +160,8 @@ pim_register_recv (struct interface *ifp, int sentRegisterStop = 0; struct ip *ip_hdr; //size_t hlen; - struct in_addr group; - struct in_addr source; + struct in_addr group = { .s_addr = 0 }; + struct in_addr source = { .s_addr = 0 }; //uint8_t *msg; uint32_t *bits; diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md index c678c8805c..aaff59438a 100644 --- a/snapcraft/README.usage.md +++ b/snapcraft/README.usage.md @@ -3,7 +3,7 @@ Using the FRRouting Snap After installing the Snap, the priviledged plug need to be connected: - snap connect frr:network-control core:network-control + snap connect frr:network-control ubuntu-core:network-control Enabling/Disabling FRRouting Daemons ------------------------------------------- @@ -53,74 +53,25 @@ depend on them). These are mainly intended to debug the Snap - `frr.ldpd-debug`: 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. - FAQ --- - frr.vtysh displays `--MORE--` on long output. How to suppress this? - Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add `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 ==================== The source for this SNAP is available as part of the FRRouting -Source Code Distribution under `GPLv2 or later` +Source Code Distribution. - + https://github.com/frrouting/frr.git -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 +Instructions for rebuilding the snap are in `README.snap_build.md` Feedback welcome ================ Please send Feedback about this snap to Martin Winter at `mwinter@opensourcerouting.org` + diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 343f2975e8..8b967c3af8 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -472,7 +472,7 @@ DEFUN (no_ip_route_tag_distance_label, DEFUN (no_ip_route_mask_distance_label, no_ip_route_mask_distance_label_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> label WORD", + "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>", NO_STR IP_STR "Establish static routes\n" @@ -486,7 +486,7 @@ DEFUN (no_ip_route_mask_distance_label, "One or more labels separated by '/'\n") { return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, - argv[3], NULL, argv[4]); + argv[3], NULL, argv[5]); } DEFUN (no_ip_route_mask_tag_distance_label, diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 23c4c9ebea..e48da0479b 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -366,6 +366,7 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set, if (set) { UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); + zebra_deregister_rnh_static_nexthops(rib->vrf_id, nexthop->resolved, top); nexthops_free(nexthop->resolved); nexthop->resolved = NULL; rib->nexthop_mtu = 0; @@ -596,6 +597,7 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set, if (set) { UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE); + zebra_deregister_rnh_static_nexthops (rib->vrf_id, nexthop->resolved, top); nexthops_free(nexthop->resolved); nexthop->resolved = NULL; }