IPv6 Classify Forwarding Graph errors 21/3621/3
authorNeale Ranns <neale.ranns@cisco.com>
Fri, 28 Oct 2016 13:31:54 +0000 (06:31 -0700)
committerJohn Lo <loj@cisco.com>
Sat, 29 Oct 2016 13:15:14 +0000 (13:15 +0000)
Fix a few places where the protocol of the DPO object was incorrectly set and hence the graph traversed by the packet jumped between ip4 and ip6 nodes.

Change-Id: I75c4ecfdf79df39f5dbb7c68f1fc82ff04aaed28
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
vnet/vnet/dpo/classify_dpo.c
vnet/vnet/dpo/classify_dpo.h
vnet/vnet/dpo/drop_dpo.c
vnet/vnet/ip/ip4_forward.c
vnet/vnet/ip/ip6_forward.c
vnet/vnet/ip/lookup.c
vnet/vnet/mpls/interface.c
vnet/vnet/mpls/mpls.c
vpp/vpp-api/api.c

index 93f3f0a..9e7886c 100644 (file)
@@ -40,7 +40,7 @@ classify_dpo_get_index (classify_dpo_t *cd)
 }
 
 index_t
-classify_dpo_create (fib_protocol_t proto,
+classify_dpo_create (dpo_proto_t proto,
                      u32 classify_table_index)
 {
     classify_dpo_t *cd;
@@ -61,7 +61,8 @@ format_classify_dpo (u8 *s, va_list *args)
 
     cd = classify_dpo_get(index);
 
-    return (format(s, "classify:[%d]:table:%d",
+    return (format(s, "%U-classify:[%d]:table:%d",
+                  format_dpo_proto, cd->cd_proto,
                   index, cd->cd_table_index));
 }
 
index cd35c3c..48f4b2b 100644 (file)
@@ -25,7 +25,7 @@
  */
 typedef struct classify_dpo_t
 {
-    fib_protocol_t cd_proto;
+    dpo_proto_t cd_proto;
 
     u32 cd_table_index;
 
@@ -35,7 +35,7 @@ typedef struct classify_dpo_t
     u16 cd_locks;
 } classify_dpo_t;
 
-extern index_t classify_dpo_create(fib_protocol_t proto,
+extern index_t classify_dpo_create(dpo_proto_t proto,
                                    u32 classify_table_index);
 
 extern u8* format_classify_dpo(u8 *s, va_list *args);
index 26c3e8a..5118d2a 100644 (file)
@@ -24,7 +24,7 @@ static dpo_id_t drop_dpos[DPO_PROTO_NUM];
 const dpo_id_t *
 drop_dpo_get (dpo_proto_t proto)
 {
-    dpo_set(&drop_dpos[proto], DPO_DROP, proto, 1);
+    dpo_set(&drop_dpos[proto], DPO_DROP, proto, proto);
 
     return (&drop_dpos[proto]);
 }
index bfa9f0a..d69a3c3 100644 (file)
@@ -654,7 +654,7 @@ ip4_add_interface_routes (u32 sw_if_index,
           dpo_set(&dpo,
                   DPO_CLASSIFY,
                   DPO_PROTO_IP4,
-                  classify_dpo_create(FIB_PROTOCOL_IP4,
+                  classify_dpo_create(DPO_PROTO_IP4,
                                       classify_table_index));
 
          fib_table_entry_special_dpo_add(fib_index,
@@ -3301,8 +3301,7 @@ int vnet_set_ip4_classify_intfc (vlib_main_t * vm, u32 sw_if_index,
           dpo_set(&dpo,
                   DPO_CLASSIFY,
                   DPO_PROTO_IP4,
-                  classify_dpo_create(FIB_PROTOCOL_IP4,
-                                      table_index));
+                  classify_dpo_create(DPO_PROTO_IP4, table_index));
 
          fib_table_entry_special_dpo_add(fib_index,
                                          &pfx,
index c285af9..bdcdbf0 100644 (file)
@@ -354,9 +354,8 @@ ip6_add_interface_routes (vnet_main_t * vnm, u32 sw_if_index,
 
           dpo_set(&dpo,
                   DPO_CLASSIFY,
-                  DPO_PROTO_IP4,
-                  classify_dpo_create(FIB_PROTOCOL_IP6,
-                                      classify_table_index));
+                  DPO_PROTO_IP6,
+                  classify_dpo_create(DPO_PROTO_IP6, classify_table_index));
 
          fib_table_entry_special_dpo_add(fib_index,
                                           &pfx,
@@ -3083,8 +3082,8 @@ int vnet_set_ip6_classify_intfc (vlib_main_t * vm, u32 sw_if_index,
 
           dpo_set(&dpo,
                   DPO_CLASSIFY,
-                  DPO_PROTO_IP4,
-                  classify_dpo_create(FIB_PROTOCOL_IP4,
+                  DPO_PROTO_IP6,
+                  classify_dpo_create(DPO_PROTO_IP6,
                                       table_index));
 
          fib_table_entry_special_dpo_add(fib_index,
index 78152f0..4ddbb54 100644 (file)
@@ -296,7 +296,7 @@ static uword unformat_dpo (unformat_input_t * input, va_list * args)
        }
 
       dpo_set(dpo, DPO_CLASSIFY, proto,
-              classify_dpo_create(fp, classify_table_index));
+              classify_dpo_create(proto, classify_table_index));
     }
   else
     return 0;
index 726e672..af0428c 100644 (file)
@@ -941,7 +941,7 @@ int vnet_mpls_ethernet_add_del_policy_tunnel (u8 *dst,
           dpo_set(&dpo,
                   DPO_CLASSIFY,
                   DPO_PROTO_IP4,
-                  classify_dpo_create(FIB_PROTOCOL_IP4,
+                  classify_dpo_create(DPO_PROTO_IP4,
                                       classify_table_index));
 
           tp->fei = fib_table_entry_special_dpo_add(tp->inner_fib_index,
index ac35e5d..aa1d963 100644 (file)
@@ -528,7 +528,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
          rpath.frp_label = MPLS_LABEL_INVALID;
           rpath.frp_proto = FIB_PROTOCOL_IP4;
           rpath.frp_sw_if_index = FIB_NODE_INDEX_INVALID;
-         pfx.fp_payload_proto = FIB_PROTOCOL_IP4;
+         pfx.fp_payload_proto = DPO_PROTO_IP4;
          vec_add1(rpaths, rpath);
       }
       else if (unformat (line_input,
@@ -539,7 +539,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
           rpath.frp_proto = FIB_PROTOCOL_IP6;
           rpath.frp_sw_if_index = FIB_NODE_INDEX_INVALID;
          vec_add1(rpaths, rpath);
-         pfx.fp_payload_proto = FIB_PROTOCOL_IP6;
+         pfx.fp_payload_proto = DPO_PROTO_IP6;
       }
       else if (unformat (line_input,
                         "mpls-lookup-in-table %d",
@@ -548,7 +548,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
          rpath.frp_label = MPLS_LABEL_INVALID;
           rpath.frp_proto = FIB_PROTOCOL_MPLS;
           rpath.frp_sw_if_index = FIB_NODE_INDEX_INVALID;
-         pfx.fp_payload_proto = FIB_PROTOCOL_MPLS;
+         pfx.fp_payload_proto = DPO_PROTO_MPLS;
          vec_add1(rpaths, rpath);
       }
       else
@@ -597,10 +597,16 @@ vnet_mpls_local_label (vlib_main_t * vm,
       pfx.fp_len = 21;
       pfx.fp_label = local_label;
 
+      if (NULL == rpaths)
+      {
+         error = clib_error_return(0 , "no paths");
+         goto done;
+      }
+
       /*
        * the CLI parsing stored table Ids, swap to FIB indicies
        */
-      fi = fib_table_id_find_fib_index(pfx.fp_payload_proto,
+      fi = fib_table_id_find_fib_index(dpo_proto_to_fib(pfx.fp_payload_proto),
                                       rpaths[0].frp_fib_index);
 
       if (~0 == fi)
index 9af8dbc..832ea66 100644 (file)
@@ -1126,7 +1126,7 @@ add_del_route_t_handler (u8 is_multipath,
                }
 
              dpo_set (&dpo, DPO_CLASSIFY, dproto,
-                      classify_dpo_create (prefix->fp_proto,
+                      classify_dpo_create (dproto,
                                            ntohl (classify_table_index)));
            }
          else