From 0761368af03d4e613a9297bf20dc68690fcc5d69 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 27 Apr 2018 14:53:46 -0400 Subject: [PATCH 1/4] zebra: Add PBR and SHARP handling We are missing some handling of PBR and SHARP protocols for netlink operations w/ the linux kernel. Additionally add a bread crumb for new developers( or existing ) to know to fixup the rt_netlink.c when we start handling new route types to hand to the kernel. Signed-off-by: Donald Sharp --- zebra/rt_netlink.c | 29 ++++++++++++++++++++++++++++- zebra/rt_netlink.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index cdc52211cc..a35dc9a177 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -98,7 +98,8 @@ static inline int is_selfroute(int proto) || (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG) || (proto == RTPROT_NHRP) || (proto == RTPROT_EIGRP) || (proto == RTPROT_LDP) || (proto == RTPROT_BABEL) - || (proto == RTPROT_RIP) || (proto == RTPROT_SHARP)) { + || (proto == RTPROT_RIP) || (proto == RTPROT_SHARP) + || (proto == RTPROT_PBR)) { return 1; } @@ -142,7 +143,18 @@ static inline int zebra2proto(int proto) case ZEBRA_ROUTE_SHARP: proto = RTPROT_SHARP; break; + case ZEBRA_ROUTE_PBR: + proto = RTPROT_PBR; + break; default: + /* + * When a user adds a new protocol this will show up + * to let them know to do something about it. This + * is intentionally a warn because we should see + * this as part of development of a new protocol + */ + zlog_warn("%s: Please add this protocol(%d) to proper rt_netlink.c handling", + __PRETTY_FUNCTION__, proto); proto = RTPROT_ZEBRA; break; } @@ -184,7 +196,22 @@ static inline int proto2zebra(int proto, int family) case RTPROT_STATIC: proto = ZEBRA_ROUTE_STATIC; break; + case RTPROT_SHARP: + proto = ZEBRA_ROUTE_SHARP; + break; + case RTPROT_PBR: + proto = ZEBRA_ROUTE_PBR; + break; default: + /* + * When a user adds a new protocol this will show up + * to let them know to do something about it. This + * is intentionally a warn because we should see + * this as part of development of a new protocol + */ + zlog_warn("%s: Please add this protocol(%d) to proper rt_netlink.c handling", + __PRETTY_FUNCTION__, + proto); proto = ZEBRA_ROUTE_KERNEL; break; } diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index 51350fd6fb..78888f48ca 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -52,6 +52,7 @@ #define RTPROT_EIGRP 192 #define RTPROT_LDP 193 #define RTPROT_SHARP 194 +#define RTPROT_PBR 195 void rt_netlink_init(void); From 70bf5a07fdf5b22201a74c355ac4489e5cffae97 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 27 Apr 2018 14:58:56 -0400 Subject: [PATCH 2/4] tools: Cleanup code to handle sharp and pbr a bit better The sharp and pbr protocols needed a bit more handling to be 'right' from a start/stop perspective. Signed-off-by: Donald Sharp --- tools/etc/iproute2/rt_protos.d/frr.conf | 3 ++- tools/frr | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/etc/iproute2/rt_protos.d/frr.conf b/tools/etc/iproute2/rt_protos.d/frr.conf index b8d4c1c03b..cac75bdfba 100644 --- a/tools/etc/iproute2/rt_protos.d/frr.conf +++ b/tools/etc/iproute2/rt_protos.d/frr.conf @@ -8,4 +8,5 @@ 191 nhrp 192 eigrp 193 ldp -194 sharp \ No newline at end of file +194 sharp +195 pbr diff --git a/tools/frr b/tools/frr index 27136bb762..fec94af689 100755 --- a/tools/frr +++ b/tools/frr @@ -552,16 +552,19 @@ case "$1" in # 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 + ip route flush proto 11 + ip route flush proto 42 + ip route flush proto 186 + ip route flush proto 187 + ip route flush proto 188 ip route flush proto 189 ip route flush proto 190 - ip route flush proto 11 - ip route flush proto 187 - ip route flush proto 192 - ip route flush proto 42 ip route flush proto 191 + ip route flush proto 192 + ip route flush proto 193 + ip route flush proto 194 + ip route flush proto 195 else [ -n "$dmn" ] && eval "${dmn/-/_}=0" start_watchfrr From 3cab181d71152521c74ec7972e6a64452f23fa22 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 27 Apr 2018 15:04:40 -0400 Subject: [PATCH 3/4] *: Actually allow end users to not build pbrd The building of pbrd from a configure compile option was not properly setup. This should do that. Signed-off-by: Donald Sharp --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 53a80e790f..13652ad640 100755 --- a/configure.ac +++ b/configure.ac @@ -354,6 +354,8 @@ AC_ARG_ENABLE(isisd, AS_HELP_STRING([--disable-isisd], [do not build isisd])) AC_ARG_ENABLE(pimd, AS_HELP_STRING([--disable-pimd], [do not build pimd])) +AC_ARG_ENABLE(pbrd, + AS_HELP_STRING([--disable-pbrd], [do not build pbrd])) AC_ARG_ENABLE(bgp-announce, AS_HELP_STRING([--disable-bgp-announce,], [turn off BGP route announcement])) AC_ARG_ENABLE(bgp-vnc, From 2222a71653a693bb92c5bd2193c142f712e442c4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 27 Apr 2018 15:18:41 -0400 Subject: [PATCH 4/4] *: Move sharpd from developmental build to have to explicity enable it sharpd has started to see some use from our field engineers as well as people attempting to build/test their environments as a way of easily injecting a large number of routes. Modify configure.ac to move sharpd from a development build option to having to explicity enable it via `--enable-sharpd=yes` in order for it to be built. This will allow those who want to build it, to build it without having to use the development build option. Signed-off-by: Donald Sharp --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 13652ad640..1b94b6d452 100755 --- a/configure.ac +++ b/configure.ac @@ -232,7 +232,6 @@ else fi fi AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"]) -AM_CONDITIONAL([SHARPD], [test "x$enable_dev_build" = "xyes"]) dnl always want these CFLAGS AC_C_FLAG([-fno-omit-frame-pointer]) @@ -356,6 +355,8 @@ AC_ARG_ENABLE(pimd, AS_HELP_STRING([--disable-pimd], [do not build pimd])) AC_ARG_ENABLE(pbrd, AS_HELP_STRING([--disable-pbrd], [do not build pbrd])) +AC_ARG_ENABLE(sharpd, + AS_HELP_STRING([--enable-sharpd], [do not build sharpd])) AC_ARG_ENABLE(bgp-announce, AS_HELP_STRING([--disable-bgp-announce,], [turn off BGP route announcement])) AC_ARG_ENABLE(bgp-vnc, @@ -1380,6 +1381,7 @@ AM_CONDITIONAL(OSPF6D, test "${enable_ospf6d}" != "no") AM_CONDITIONAL(ISISD, test "${enable_isisd}" != "no") AM_CONDITIONAL(PIMD, test "${enable_pimd}" != "no") AM_CONDITIONAL(PBRD, test "${enable_pbrd}" != "no") +AM_CONDITIONAL(SHARPD, test "${enable_sharpd}" = "yes") if test "${enable_bgp_announce}" = "no";then AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)