]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd rfapi: advertise encap attribute when TT is valid and not MPLS. 174/head
authorLou Berger <lberger@labn.net>
Tue, 7 Feb 2017 02:29:43 +0000 (21:29 -0500)
committerLou Berger <lberger@labn.net>
Tue, 7 Feb 2017 14:30:35 +0000 (09:30 -0500)
     Ensure tunnel type set based on rx'ed
     Ignore bad/mpls encap types.

Signed-off-by: Lou Berger <lberger@labn.net>
bgpd/bgp_attr.c
bgpd/rfapi/vnc_import_bgp.c

index f4995faab00f85258eb54cecdb11d642bb05ce41..7dc42e719f8f42735b92033a329cf14add6aad36 100644 (file)
@@ -2241,8 +2241,10 @@ bgp_attr_encap(
     stlv_last = tlv;
   }
 
-  if (attre && (BGP_ATTR_ENCAP == type)) {
-      attre->encap_tunneltype = tunneltype;
+  if (BGP_ATTR_ENCAP == type) {
+    if (!attre)
+      attre = bgp_attr_extra_get(attr);
+    attre->encap_tunneltype = tunneltype;
   }
 
   if (length) {
@@ -2854,7 +2856,10 @@ bgp_packet_mpattr_tea(
     struct bgp_attr_encap_subtlv       *st;
     const char                         *attrname;
 
-    if (!attr || !attr->extra)
+    if (!attr || !attr->extra || 
+        (attrtype == BGP_ATTR_ENCAP && 
+         (!attr->extra->encap_tunneltype ||
+          attr->extra->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
        return;
 
     switch (attrtype) {
@@ -2885,11 +2890,6 @@ bgp_packet_mpattr_tea(
            assert(0);
     }
 
-
-    /* if no tlvs, don't make attr */
-    if (subtlvs == NULL)
-       return;
-
     /* compute attr length */
     for (st = subtlvs; st; st = st->next) {
        attrlenfield += (attrhdrlen + st->length);
index 8c7fd9066dd8607b71ff57d32c918097e6bffc4a..10246758f31fe5d661c50ecade34cec57358e912 100644 (file)
@@ -514,7 +514,8 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
   if (bi->attr && bi->attr->extra)
     {
       encaptlvs = bi->attr->extra->vnc_subtlvs;
-      if (bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_MPLS)
+      if (bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED &&
+          bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_MPLS)
         {
           if (opt != NULL)
             opt->next = &optary[cur_opt];