[zebra:netlink] Set proto/scope on all route update messages
2008-08-13 Timo Teräs <timo.teras@iki.fi>
* 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 <paul@quagga.net>
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 0bf2d9e..4234a44 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1348,6 +1348,8 @@
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 @@
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 @@
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 @@
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)