From a6487ff6b5df8db2d695aee08ef5212900da2e8a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 25 Sep 2017 19:10:40 -0400 Subject: [PATCH 1/4] tools: Fix route flush This commit does two things: 1) Flush by proto number not string This is useful because not all systems might have the proto values installed, or a version of iproute2 that they might be installed with. 2) Flush missing routes that might have been installed( eigrp and nhrp ) Signed-off-by: Donald Sharp --- tools/frr | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/frr b/tools/frr index 4eb4a5c28c..5fb2b11f99 100755 --- a/tools/frr +++ b/tools/frr @@ -544,13 +544,15 @@ case "$1" in if [ -z "$dmn" -o "$dmn" = "zebra" ]; then echo "Removing all routes made by FRR." - ip route flush proto bgp - ip route flush proto ospf - ip route flush proto static - ip route flush proto rip - ip route flush proto ripng - ip route flush proto zebra - ip route flush proto isis + ip route flush proto 186 + ip route flush proto 188 + ip route flush proto 4 + ip route flush proto 189 + ip route flush proto 190 + ip route flush proto 11 + ip route flush proto 187 + ip route flush proto 192 + ip route flush proto 194 else [ -n "$dmn" ] && eval "${dmn/-/_}=0" From 91effb395ad75498cbc26d7651f44f89ee80533a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 5 Oct 2017 08:23:27 -0400 Subject: [PATCH 2/4] tools: Fix babel RT_PROT # We had mistakenly created another RT_PROT # for babel. This is incorrect. Signed-off-by: Donald Sharp --- tools/etc/iproute2/rt_protos.d/frr.conf | 1 - tools/frr | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/etc/iproute2/rt_protos.d/frr.conf b/tools/etc/iproute2/rt_protos.d/frr.conf index 6b341f5161..2d3b884e7e 100644 --- a/tools/etc/iproute2/rt_protos.d/frr.conf +++ b/tools/etc/iproute2/rt_protos.d/frr.conf @@ -8,4 +8,3 @@ 191 nhrp 192 eigrp 193 ldp -194 babel diff --git a/tools/frr b/tools/frr index 5fb2b11f99..905b38f545 100755 --- a/tools/frr +++ b/tools/frr @@ -552,8 +552,7 @@ case "$1" in ip route flush proto 11 ip route flush proto 187 ip route flush proto 192 - ip route flush proto 194 - + ip route flush proto 42 else [ -n "$dmn" ] && eval "${dmn/-/_}=0" start_watchfrr From 92bd13d762c03226610c0b1ee7e468cd0bd121ca Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 5 Oct 2017 08:27:31 -0400 Subject: [PATCH 3/4] tools: Add NHRP to route flushing Signed-off-by: Donald Sharp --- tools/frr | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/frr b/tools/frr index 905b38f545..8d67917be7 100755 --- a/tools/frr +++ b/tools/frr @@ -553,6 +553,7 @@ case "$1" in ip route flush proto 187 ip route flush proto 192 ip route flush proto 42 + ip route flush proto 191 else [ -n "$dmn" ] && eval "${dmn/-/_}=0" start_watchfrr From 6977eb91c6432b8976c98cd283e9558a9facd492 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 5 Oct 2017 08:54:03 -0400 Subject: [PATCH 4/4] *: Add some documentation about how to handle new daemons Add some breadcrumbs for when we add a new routing daemon so things `just work`. Signed-off-by: Donald Sharp --- tools/frr | 6 ++++++ zebra/rt_netlink.h | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/frr b/tools/frr index 8d67917be7..78190aadb0 100755 --- a/tools/frr +++ b/tools/frr @@ -544,6 +544,12 @@ case "$1" in if [ -z "$dmn" -o "$dmn" = "zebra" ]; then echo "Removing all routes made by FRR." + # Specific values for each proto can be found + # in /etc/iproute2/rt_protos as well as FRR + # specific ones in /etc/iproute2/rt_protos.d + # Additionally if a new protocol is added + # we need to add it here as well as + # in rt_netlink.h( follow the directions! ) ip route flush proto 186 ip route flush proto 188 ip route flush proto 4 diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index e607dda6f9..980ff915cc 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -27,14 +27,26 @@ #define NL_DEFAULT_ROUTE_METRIC 20 -/* Additional protocol strings to push into routes */ +/* + * Additional protocol strings to push into routes + * If we add anything new here please make sure + * to update: + * zebra2proto Function + * proto2zebra Function + * is_selfroute Function + * tools/frr To flush the route upon exit + * + * Finally update this file to allow iproute2 to + * know about this new route. + * tools/etc/iproute2/rt_protos.d + */ #define RTPROT_BGP 186 #define RTPROT_ISIS 187 #define RTPROT_OSPF 188 #define RTPROT_RIP 189 #define RTPROT_RIPNG 190 #if !defined(RTPROT_BABEL) -#define RTPROT_BABEL 42 +#define RTPROT_BABEL 42 #endif #define RTPROT_NHRP 191 #define RTPROT_EIGRP 192