From 3cb50bf1ee8fe08a36f702c61c6b911fe0c0e6a8 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 31 Jan 2017 13:51:27 +0100 Subject: [PATCH] Revert "*: Add source of route as protocol string in ip route pushed into kernel" This reverts commit 1a11782c408a60afb464fe232fc2e3fa1e298436. The change is not suitable for stable/2.0, it's not a bugfix and has quite a visible user impact. Signed-off-by: David Lamparter Acked-by: Donald Sharp --- cumulus/etc/iproute2/rt_protos.d/frr.conf | 8 ---- debian/frr.dirs | 1 - tools/frr | 9 +---- zebra/kernel_netlink.c | 5 --- zebra/rt_netlink.c | 49 ++--------------------- zebra/rt_netlink.h | 8 ---- 6 files changed, 5 insertions(+), 75 deletions(-) delete mode 100644 cumulus/etc/iproute2/rt_protos.d/frr.conf diff --git a/cumulus/etc/iproute2/rt_protos.d/frr.conf b/cumulus/etc/iproute2/rt_protos.d/frr.conf deleted file mode 100644 index 883782e4dd..0000000000 --- a/cumulus/etc/iproute2/rt_protos.d/frr.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Additional protocol strings defined by quagga for each of its daemons - -186 bgp -187 isis -188 ospf -189 rip -190 ripng -191 static diff --git a/debian/frr.dirs b/debian/frr.dirs index 56699b2daa..58290080d0 100644 --- a/debian/frr.dirs +++ b/debian/frr.dirs @@ -1,6 +1,5 @@ etc/logrotate.d/ etc/frr/ -etc/iproute2/rt_protos.d/ usr/share/doc/frr/ usr/share/doc/frr/examples/ usr/share/lintian/overrides/ diff --git a/tools/frr b/tools/frr index a6d99feaf6..2ecaadbb53 100755 --- a/tools/frr +++ b/tools/frr @@ -532,15 +532,8 @@ case "$1" in fi if [ -z "$dmn" -o "$dmn" = "zebra" ]; then - echo "Removing all routes made by quagga." - 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 + echo "Removing all routes made by zebra." ip route flush proto zebra - ip route flush proto isis - else [ -n "$dmn" ] && eval "${dmn/-/_}=0" start_watchfrr diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 20cb62e318..9f9a62f384 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -91,11 +91,6 @@ static const struct message rtproto_str[] = { #ifdef RTPROT_BIRD {RTPROT_BIRD, "BIRD"}, #endif /* RTPROT_BIRD */ - {RTPROT_BGP, "BGP"}, - {RTPROT_OSPF, "OSPF"}, - {RTPROT_ISIS, "IS-IS"}, - {RTPROT_RIP, "RIP"}, - {RTPROT_RIPNG, "RIPNG"}, {0, NULL} }; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 5d1ef26487..4913aa878f 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -92,47 +92,6 @@ struct gw_family_t union g_addr gate; }; -static inline int is_selfroute(int proto) -{ - if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) || - (proto == RTPROT_STATIC) || (proto == RTPROT_ZEBRA) || - (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG)) { - return 1; - } - - return 0; -} - -static inline int get_rt_proto(int proto) -{ - switch (proto) { - case ZEBRA_ROUTE_BGP: - proto = RTPROT_BGP; - break; - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - proto = RTPROT_OSPF; - break; - case ZEBRA_ROUTE_STATIC: - proto = RTPROT_STATIC; - break; - case ZEBRA_ROUTE_ISIS: - proto = RTPROT_ISIS; - break; - case ZEBRA_ROUTE_RIP: - proto = RTPROT_RIP; - break; - case ZEBRA_ROUTE_RIPNG: - proto = RTPROT_RIPNG; - break; - default: - proto = RTPROT_ZEBRA; - break; - } - - return proto; -} - /* Pending: create an efficient table_id (in a tree/hash) based lookup) */ @@ -222,7 +181,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h, } /* Route which inserted by Zebra. */ - if (is_selfroute(rtm->rtm_protocol)) + if (rtm->rtm_protocol == RTPROT_ZEBRA) flags |= ZEBRA_FLAG_SELFROUTE; index = 0; @@ -408,9 +367,9 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (rtm->rtm_protocol == RTPROT_KERNEL) return 0; - if (is_selfroute(rtm->rtm_protocol) && h->nlmsg_type == RTM_NEWROUTE) + if (rtm->rtm_protocol == RTPROT_ZEBRA && h->nlmsg_type == RTM_NEWROUTE) return 0; - if (is_selfroute(rtm->rtm_protocol)) + if (rtm->rtm_protocol == RTPROT_ZEBRA) SET_FLAG(zebra_flags, ZEBRA_FLAG_SELFROUTE); if (rtm->rtm_src_len != 0) @@ -1194,7 +1153,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, req.n.nlmsg_type = cmd; req.r.rtm_family = family; req.r.rtm_dst_len = p->prefixlen; - req.r.rtm_protocol = get_rt_proto(rib->type); + req.r.rtm_protocol = RTPROT_ZEBRA; req.r.rtm_scope = RT_SCOPE_UNIVERSE; if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT)) diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index d1f01bda4c..7183525fba 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -28,14 +28,6 @@ #define NL_DEFAULT_ROUTE_METRIC 20 -/* Additional protocol strings to push into routes */ -#define RTPROT_BGP 186 -#define RTPROT_ISIS 187 -#define RTPROT_OSPF 188 -#define RTPROT_RIP 189 -#define RTPROT_RIPNG 190 - - extern void clear_nhlfe_installed (zebra_lsp_t *lsp); extern int