From 40da22166ff29753a65b7947ed5fa7261fee1d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 13 Aug 2008 17:37:14 +0100 Subject: [zebra:netlink] Set proto/scope on all route update messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-08-13 Timo Teräs * zebra/rt_netlink.c: (netlink_route{,_multipath) Set protocol and scope appropriately for both NEW and DELROUTE messages, to avoid wiping out non-zebra routes on delete. Signed-off-by: Paul Jakma --- zebra/rt_netlink.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 0bf2d9eb..4234a445 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1348,6 +1348,8 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate, req.r.rtm_family = family; req.r.rtm_table = table; req.r.rtm_dst_len = length; + req.r.rtm_protocol = RTPROT_ZEBRA; + req.r.rtm_scope = RT_SCOPE_UNIVERSE; if ((zebra_flags & ZEBRA_FLAG_BLACKHOLE) || (zebra_flags & ZEBRA_FLAG_REJECT)) @@ -1357,9 +1359,6 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate, if (cmd == RTM_NEWROUTE) { - req.r.rtm_protocol = RTPROT_ZEBRA; - req.r.rtm_scope = RT_SCOPE_UNIVERSE; - if (discard) { if (zebra_flags & ZEBRA_FLAG_BLACKHOLE) @@ -1424,6 +1423,8 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, req.r.rtm_family = family; req.r.rtm_table = rib->table; req.r.rtm_dst_len = p->prefixlen; + req.r.rtm_protocol = RTPROT_ZEBRA; + req.r.rtm_scope = RT_SCOPE_UNIVERSE; if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT)) discard = 1; @@ -1432,9 +1433,6 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, if (cmd == RTM_NEWROUTE) { - req.r.rtm_protocol = RTPROT_ZEBRA; - req.r.rtm_scope = RT_SCOPE_UNIVERSE; - if (discard) { if (rib->flags & ZEBRA_FLAG_BLACKHOLE) -- cgit v1.2.1