]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd, zebra: Fix for ignored non-default VRF single-hop BFD status messages in Quagga
authorradhika <radhika@cumulusnetworks.com>
Fri, 6 Jan 2017 20:54:25 +0000 (12:54 -0800)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Jan 2017 18:40:21 +0000 (13:40 -0500)
Ticket: CM-13425
Reviewed By: Donald, Kanna
Testing Done: Unit, Min tests, PTM Smoke and Nightly, BGP Smoke

Issue: BFD status up/down not reflected in the Quagga for non-default VRF single-hop BFD sessions.

Root Cause: PTM doesn’t keep track of VRF for Single hop BFD sessions since they are interface-based sessions. The status up/down messages to the quagga for single hop sessions do not have VRF information. In zebra daemon, the interface search based on the interface name extracted from the BFD status message is done across all VRFs. So, the search does not fail in zebra daemon. But, the interface search in bgpd/ospd is done per vrf and default VRF is used for search if no VRF is sent in the status message. So, the search fails and the BFD status changes are ignored.

Fix: The VRF information is extracted from the interface if VRF is not sent in the BFD status messages in zebra daemon and passed to bgpd/ospfd. The interface search will not fail since the appropriate VRF is passed to bgpd/ospfd and BFD satus changes are not ignored.

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
bgpd/bgp_bfd.c
zebra/zebra_ptm.c

index ad221d922d1d0c1928057ff8d649febf2d71635c..4f76fd17fb228c701bef10d95fb408eb978e09c6 100644 (file)
@@ -311,14 +311,14 @@ bgp_bfd_dest_update (int command, struct zclient *zclient,
       prefix2str(&dp, buf[0], sizeof(buf[0]));
       if (ifp)
         {
-          zlog_debug("Zebra: interface %s bfd destination %s %s",
-                      ifp->name, buf[0], bfd_get_status_str(status));
+          zlog_debug("Zebra: vrf %d interface %s bfd destination %s %s",
+                      vrf_id, ifp->name, buf[0], bfd_get_status_str(status));
         }
       else
         {
           prefix2str(&sp, buf[1], sizeof(buf[1]));
-          zlog_debug("Zebra: source %s bfd destination %s %s",
-                      buf[1], buf[0], bfd_get_status_str(status));
+          zlog_debug("Zebra: vrf %d source %s bfd destination %s %s",
+                      vrf_id, buf[1], buf[0], bfd_get_status_str(status));
         }
     }
 
index c5223199a4c57e4076a24bd70209a3987eae39d4..a633ce6332664780f5fea169c0e52d5ee3b82df1 100644 (file)
@@ -459,6 +459,7 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp)
   char vrf_str[64];
   struct prefix dest_prefix;
   struct prefix src_prefix;
+  vrf_id_t vrf_id;
 
   ptm_lib_find_key_in_msg(in_ctxt, ZEBRA_PTM_BFDSTATUS_STR, bfdst_str);
 
@@ -491,7 +492,8 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp)
   }
 
   if (IS_ZEBRA_DEBUG_EVENT)
-    zlog_debug("%s: Recv Port [%s] bfd status [%s] vrf [%s] peer [%s] local [%s]",
+    zlog_debug("%s: Recv Port [%s] bfd status [%s] vrf [%s]"
+                  " peer [%s] local [%s]",
                   __func__, ifp ? ifp->name : "N/A", bfdst_str,
                   vrf_str, dest_str, src_str);
 
@@ -510,12 +512,18 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp)
     }
   }
 
+  if (!strcmp(ZEBRA_PTM_INVALID_VRF, vrf_str) && ifp) {
+    vrf_id = ifp->vrf_id;
+  } else {
+    vrf_id = vrf_name_to_id(vrf_str);
+  }
+
   if (!strcmp (bfdst_str, ZEBRA_PTM_BFDSTATUS_DOWN_STR)) {
     if_bfd_session_update(ifp, &dest_prefix, &src_prefix, BFD_STATUS_DOWN,
-                            vrf_name_to_id(vrf_str));
+                            vrf_id);
   } else {
     if_bfd_session_update(ifp, &dest_prefix, &src_prefix, BFD_STATUS_UP,
-                            vrf_name_to_id(vrf_str));
+                            vrf_id);
   }
 
   return 0;