[cmaster-next] [PATCH] bgpd: Fix multiple bgp view vnc crash

Donald Sharp sharpd at cumulusnetworks.com
Wed Nov 30 09:27:27 EST 2016


When configuring multiple bgp views without a default
bgp session, the code will crash.

This code change only fixes the crash from happening.  I'm not
entirely sure that the code will not misbehave with multiple
bgp views and configuring vnc in this case.

Signed-off-by: Donald Sharp <sharpd at cumulusnetworks.com>
---
 bgpd/rfapi/vnc_import_bgp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 4215ce2..441bdee 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -1798,6 +1798,9 @@ vnc_import_bgp_exterior_add_route_it (
   struct bgp *bgp_default = bgp_get_default ();
   afi_t afi = family2afi (prefix->family);
 
+  if (!bgp_default)
+    return;
+
   h = bgp_default->rfapi;
   hc = bgp_default->rfapi_cfg;
 
@@ -1992,6 +1995,9 @@ vnc_import_bgp_exterior_del_route (
   afi_t afi = family2afi (prefix->family);
   struct bgp *bgp_default = bgp_get_default ();
 
+  if (!bgp_default)
+    return;
+
   memset (&pfx_orig_nexthop, 0, sizeof (struct prefix));        /* keep valgrind happy */
 
   h = bgp_default->rfapi;
-- 
2.5.5





More information about the dev mailing list