[quagga-dev 11586] [PATCH 1/2] MBGP routes should not be installed in the kernel

Balaji.G balajig81 at gmail.com
Sun Oct 19 19:46:45 BST 2014


MBGP routes are used only for PIM RPF checks and hence should
not be installed in the kernel's FIB

Signed-off-by: Balaji.G <balajig81 at gmail.com>
---
 bgpd/bgp_zebra.c  | 6 ++++++
 lib/zebra.h       | 1 +
 zebra/zebra_rib.c | 6 +++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index f18d916..2b13ad7 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -703,6 +703,9 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, sa
 
   stream_reset (bgp_nexthop_buf);
 
+  if(safi == SAFI_MULTICAST)
+      SET_FLAG (flags, ZEBRA_FLAG_MBGP);
+
   if (p->family == AF_INET)
     {
       struct zapi_ipv4 api;
@@ -852,6 +855,9 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
       || CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
     SET_FLAG (flags, ZEBRA_FLAG_INTERNAL);
 
+  if(safi == SAFI_MULTICAST)
+      SET_FLAG (flags, ZEBRA_FLAG_MBGP);
+
   if (p->family == AF_INET)
     {
       struct zapi_ipv4 api;
diff --git a/lib/zebra.h b/lib/zebra.h
index b289a19..bed1327 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -476,6 +476,7 @@ extern const char *zserv_command_string (unsigned int command);
 #define ZEBRA_FLAG_SELECTED           0x10
 #define ZEBRA_FLAG_CHANGED            0x20
 #define ZEBRA_FLAG_STATIC             0x40
+#define ZEBRA_FLAG_MBGP 	      0x60
 #define ZEBRA_FLAG_REJECT             0x80
 
 /* Zebra nexthop flags. */
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index dc7e1ca..fa19021 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1290,6 +1290,10 @@ rib_process (struct route_node *rn)
       if (rib->distance == DISTANCE_INFINITY)
         continue;
 
+      /* MBGP routes shouldn't be installed in kernel */
+      if (rib->flags == ZEBRA_FLAG_MBGP)
+	continue;
+
       /* Newly selected rib, the common case. */
       if (!select)
         {
@@ -1407,7 +1411,7 @@ rib_process (struct route_node *rn)
    * tell, that if a new winner exists, FIB is still not updated with this
    * data, but ready to be.
    */
-  if (select)
+  if (select) 
     {
       if (IS_ZEBRA_DEBUG_RIB)
         zlog_debug ("%s: %s/%d: Adding route, select %p", __func__, buf,
-- 
1.9.1





More information about the Quagga-dev mailing list