summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-05-25 14:36:12 -0400
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-05-30 10:03:10 +0200
commit0b821bb5ee05fd1b1ff552c71d4d1db9fb12213f (patch)
tree92613322cacd8d61fee4de853ffaf0b387009e6e
parent41e5abf816ddd63dbbd4ce91eacbcd03e2ee2b71 (diff)
tools, zebra: Use different protocol value for our statics
The re-use of RTPROT_STATIC has caused too many collisions where other legitimate route sources are causing us to believe we are the originator of the route. Modify the code so that if another protocol inserts RTPROT_STATIC we will assume it's a Kernel Route. Fixes: #2293 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--tools/etc/iproute2/rt_protos.d/frr.conf1
-rwxr-xr-xtools/frr1
-rw-r--r--zebra/kernel_netlink.c1
-rw-r--r--zebra/rt_netlink.c5
-rw-r--r--zebra/rt_netlink.h1
5 files changed, 7 insertions, 2 deletions
diff --git a/tools/etc/iproute2/rt_protos.d/frr.conf b/tools/etc/iproute2/rt_protos.d/frr.conf
index cac75bdfba..4c6968ac27 100644
--- a/tools/etc/iproute2/rt_protos.d/frr.conf
+++ b/tools/etc/iproute2/rt_protos.d/frr.conf
@@ -10,3 +10,4 @@
193 ldp
194 sharp
195 pbr
+196 static
diff --git a/tools/frr b/tools/frr
index fec94af689..7d7b97433a 100755
--- a/tools/frr
+++ b/tools/frr
@@ -565,6 +565,7 @@ case "$1" in
ip route flush proto 193
ip route flush proto 194
ip route flush proto 195
+ ip route flush proto 196
else
[ -n "$dmn" ] && eval "${dmn/-/_}=0"
start_watchfrr
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index db4f19460a..da5b01d640 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -110,6 +110,7 @@ static const struct message rtproto_str[] = {
{RTPROT_ISIS, "IS-IS"},
{RTPROT_RIP, "RIP"},
{RTPROT_RIPNG, "RIPNG"},
+ {RTPROT_ZSTATIC, "static"},
{0}};
static const struct message family_str[] = {{AF_INET, "ipv4"},
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index a35dc9a177..89f59c1933 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -94,7 +94,7 @@ void rt_netlink_init(void)
static inline int is_selfroute(int proto)
{
if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF)
- || (proto == RTPROT_STATIC) || (proto == RTPROT_ZEBRA)
+ || (proto == RTPROT_ZSTATIC) || (proto == RTPROT_ZEBRA)
|| (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG)
|| (proto == RTPROT_NHRP) || (proto == RTPROT_EIGRP)
|| (proto == RTPROT_LDP) || (proto == RTPROT_BABEL)
@@ -120,7 +120,7 @@ static inline int zebra2proto(int proto)
proto = RTPROT_OSPF;
break;
case ZEBRA_ROUTE_STATIC:
- proto = RTPROT_STATIC;
+ proto = RTPROT_ZSTATIC;
break;
case ZEBRA_ROUTE_ISIS:
proto = RTPROT_ISIS;
@@ -194,6 +194,7 @@ static inline int proto2zebra(int proto, int family)
proto = ZEBRA_ROUTE_LDP;
break;
case RTPROT_STATIC:
+ case RTPROT_ZSTATIC:
proto = ZEBRA_ROUTE_STATIC;
break;
case RTPROT_SHARP:
diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h
index 78888f48ca..c8d918b1d2 100644
--- a/zebra/rt_netlink.h
+++ b/zebra/rt_netlink.h
@@ -53,6 +53,7 @@
#define RTPROT_LDP 193
#define RTPROT_SHARP 194
#define RTPROT_PBR 195
+#define RTPROT_ZSTATIC 196
void rt_netlink_init(void);