[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quagga-dev
Subject:    [quagga-dev 5525] [patch] Make zebra delete only self created routes
From:       Timo_Teräs <timo.teras () iki ! fi>
Date:       2008-06-24 11:34:11
Message-ID: 4860DBB3.7050205 () iki ! fi
[Download RAW message or body]

Hi,

Currently when zebra is talking with kernel using netlink, it does not set
the rtm_protocol nor rtm_scope when deleting routes. There are some valid
cases in my environment when there can be an identical route inserted by
another program with only different rtm_protocol (NHRP shortcut route in
an NBMA network). And in those situations zebra will delete the BGP route
as non-zebra routes take preference, but the non-zebra route is also
deleted as it will match the deletion request without rtm_protocol.

I'm not sure if the current behavior is intentional, but I applied the
following and it fixed problems for me.

Cheers,
  Timo

Index: zebra/rt_netlink.c
===================================================================
RCS file: /var/cvsroot/quagga/zebra/rt_netlink.c,v
retrieving revision 1.47
diff -u -r1.47 rt_netlink.c
--- zebra/rt_netlink.c	29 May 2008 18:23:08 -0000	1.47
+++ zebra/rt_netlink.c	24 Jun 2008 08:22:32 -0000
@@ -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)

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic