]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd rfapi: Shift rfapi receive hooks for vpn and encap safis into 112/head
authorG. Paul Ziemba <paulz@labn.net>
Mon, 16 Jan 2017 19:09:12 +0000 (11:09 -0800)
committerLou Berger <lberger@labn.net>
Tue, 24 Jan 2017 18:15:06 +0000 (13:15 -0500)
     bgp_update/bgp_withdraw (Issue #91)

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
bgpd/bgp_encap.c
bgpd/bgp_mplsvpn.c
bgpd/bgp_route.c
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c

index 69f6c6157e7817fec152ac0e1480345d39d00a0c..282815a596cb48e6e01d0bb3fd19d235994ba52f 100644 (file)
@@ -188,15 +188,7 @@ bgp_nlri_parse_encap(
       if (attr) {
        bgp_update (peer, &p, 0, attr, afi, SAFI_ENCAP,
                    ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0);
-#if ENABLE_BGP_VNC
-       rfapiProcessUpdate(peer, NULL, &p, &prd, attr, afi, SAFI_ENCAP,
-                           ZEBRA_ROUTE_BGP,  BGP_ROUTE_NORMAL, NULL);
-#endif
       } else {
-#if ENABLE_BGP_VNC
-       rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, afi, SAFI_ENCAP,
-                             ZEBRA_ROUTE_BGP, 0);
-#endif
        bgp_withdraw (peer, &p, 0, attr, afi, SAFI_ENCAP,
                      ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL);
       }
index e494f8cbb78a1a2ea3a26e838b29605d968068f7..deb187abd2b3823b9315d57ddd0b3703af66cee1 100644 (file)
@@ -154,9 +154,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
   safi_t safi;
   int addpath_encoded;
   u_int32_t addpath_id;
-#if ENABLE_BGP_VNC
-  u_int32_t label = 0;
-#endif
 
   /* Check peer status. */
   if (peer->status != Established)
@@ -232,10 +229,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
           return -1;
         }
       
-#if ENABLE_BGP_VNC
-      label = decode_label (pnt);
-#endif
-
       /* Copyr label to prefix. */
       tagpnt = pnt;
 
@@ -277,18 +270,9 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
         {
           bgp_update (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN,
                       ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0);
-#if ENABLE_BGP_VNC
-          rfapiProcessUpdate(peer, NULL, &p, &prd, attr, packet->afi, 
-                             SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
-                             &label);
-#endif
         }
       else
         {
-#if ENABLE_BGP_VNC
-          rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, packet->afi, 
-                               SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, 0);
-#endif
           bgp_withdraw (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN,
                         ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt);
         }
@@ -588,7 +572,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, afi_t afi, struct prefix
                       struct rd_as rd_as;
                       struct rd_ip rd_ip = {0};
 #if ENABLE_BGP_VNC
-                      struct rd_vnc_eth rd_vnc_eth;
+                      struct rd_vnc_eth rd_vnc_eth = {0};
 #endif
                       u_char *pnt;
 
@@ -798,7 +782,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
                      struct rd_as rd_as;
                      struct rd_ip rd_ip = {0};
 #if ENABLE_BGP_VNC
-                      struct rd_vnc_eth rd_vnc_eth;
+                      struct rd_vnc_eth rd_vnc_eth = {0};
 #endif
                      u_char *pnt;
 
index 81516640bdcf20c6adf9c5c039b3197be8954860..1db68e7195ecfeba6eb854653acbcd97d79fd3e8 100644 (file)
@@ -2686,6 +2686,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
       bgp_process (bgp, rn, afi, safi);
       bgp_unlock_node (rn);
 
+#if ENABLE_BGP_VNC
+  if (SAFI_MPLS_VPN == safi)
+    {
+      uint32_t    label = decode_label(tag);
+
+      rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type,
+        &label);
+    }
+  if (SAFI_ENCAP == safi)
+    {
+      rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type,
+        NULL);
+    }
+#endif
+
       return 0;
     } // End of implicit withdraw
 
@@ -2780,6 +2795,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
   /* Process change. */
   bgp_process (bgp, rn, afi, safi);
 
+#if ENABLE_BGP_VNC
+  if (SAFI_MPLS_VPN == safi)
+    {
+      uint32_t    label = decode_label(tag);
+
+      rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type,
+        &label);
+    }
+  if (SAFI_ENCAP == safi)
+    {
+      rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type,
+        NULL);
+    }
+#endif
+
   return 0;
 
   /* This BGP update is filtered.  Log the reason then update BGP
@@ -2819,6 +2849,13 @@ bgp_withdraw (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
   struct bgp_node *rn;
   struct bgp_info *ri;
 
+#if ENABLE_BGP_VNC
+  if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi))
+    {
+      rfapiProcessWithdraw(peer, NULL, p, prd, NULL, afi, safi, type, 0);
+    }
+#endif
+
   bgp = peer->bgp;
 
   /* Lookup node. */
index 599d6e88bf63289dd68127298f87ca3907b10e27..ebd369f3acaf3df433d688cc1ec673f95261fb11 100644 (file)
@@ -417,9 +417,10 @@ del_vnc_route (
     {
 
       vnc_zlog_debug_verbose
-        ("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p",
+        ("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
          __func__, bi, bi->peer, bi->type, bi->sub_type,
-         (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL));
+         (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL),
+        ((bi->attr && CHECK_FLAG(bi->attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))? bi->attr->local_pref: 0));
 
       if (bi->peer == peer &&
           bi->type == type &&
index ba264972072991769448b4b1460b7aac1ab344da..4d35af2641dce607f73fe6744ee3b79d9f50d177 100644 (file)
@@ -3724,6 +3724,12 @@ rfapiBgpInfoFilteredImportVPN (
       if (rn->info)
         original_had_routes = 1;
 
+      if (VNC_DEBUG(VERBOSE))
+        {
+          vnc_zlog_debug_verbose ("%s: showing IT node on entry", __func__);
+          rfapiShowItNode (NULL, rn);   /* debug */
+        }
+
       /*
        * Look for same route (will have same RD and peer)
        */