[quagga-dev 11990] [PATCH 06/15] zebra: mrib: Include BGP routes in RPF lookups

David Lamparter equinox at opensourcerouting.org
Fri Jan 30 00:54:24 GMT 2015


From: Everton Marques <everton.marques at gmail.com>

The rib_match_ipv4() function was previously used only for iBGP
recursive nexthop lookups, which ignore eBGP routes.  This is not
desirable for PIM RPF lookups, which may well use an eBGP route.

Cc: Everton Marques <everton.marques at gmail.com>
Cc: Balaji G <balajig81 at gmail.com>
Signed-off-by: David Lamparter <equinox at opensourcerouting.org>
---
 zebra/rib.h       | 2 +-
 zebra/zebra_rib.c | 7 +++----
 zebra/zserv.c     | 5 +++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/zebra/rib.h b/zebra/rib.h
index 13011e2..aef7150 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -419,7 +419,7 @@ extern int rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p,
 		            u_int32_t, safi_t safi);
 
 extern struct rib *rib_match_ipv4 (struct in_addr);
-extern struct rib *rib_match_ipv4_safi (struct in_addr addr, safi_t safi);
+extern struct rib *rib_match_ipv4_safi (struct in_addr addr, safi_t safi, int skip_bgp);
 
 extern struct rib *rib_lookup_ipv4 (struct prefix_ipv4 *);
 
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 469c10b..f4a9155 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -721,11 +721,11 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
 struct rib *
 rib_match_ipv4 (struct in_addr addr)
 {
-  return rib_match_ipv4_safi (addr, SAFI_UNICAST);
+  return rib_match_ipv4_safi (addr, SAFI_UNICAST, 1);
 }
 
 struct rib *
-rib_match_ipv4_safi (struct in_addr addr, safi_t safi)
+rib_match_ipv4_safi (struct in_addr addr, safi_t safi, int skip_bgp)
 {
   struct route_table *table;
   struct route_node *rn;
@@ -755,8 +755,7 @@ rib_match_ipv4_safi (struct in_addr addr, safi_t safi)
 
       /* If there is no selected route or matched route is EGP, go up
          tree. */
-      if (! match
-	  || match->type == ZEBRA_ROUTE_BGP)
+      if (!match || (skip_bgp && (match->type == ZEBRA_ROUTE_BGP)))
 	{
 	  do {
 	    rn = rn->parent;
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 89eb266..1b69315 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -612,16 +612,17 @@ zsend_ipv4_nexthop_lookup_mrib (struct zserv *client, struct in_addr addr)
   unsigned long nump;
   u_char num;
   struct nexthop *nexthop;
+  int skip_bgp = 0; /* bool */
 
   /* Lookup nexthop. */
-  rib = rib_match_ipv4_safi (addr, SAFI_MULTICAST);
+  rib = rib_match_ipv4_safi (addr, SAFI_MULTICAST, skip_bgp);
 
   if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV)
     zlog_debug("%s: %s mrib entry found.", __func__, rib ? "Matching" : "No matching");
 
   if (!rib) {
     /* Retry lookup with unicast rib */
-    rib = rib_match_ipv4_safi (addr, SAFI_UNICAST);
+    rib = rib_match_ipv4_safi (addr, SAFI_UNICAST, skip_bgp);
     if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV)
       zlog_debug("%s: %s rib entry found.", __func__, rib ? "Matching" : "No matching");
   }
-- 
2.0.4





More information about the Quagga-dev mailing list