VPP-673 Fix L2 steering. 15/5915/2
authorPablo Camarillo <pcamaril@cisco.com>
Wed, 29 Mar 2017 14:54:40 +0000 (07:54 -0700)
committerDamjan Marion <dmarion.lists@gmail.com>
Thu, 30 Mar 2017 12:16:47 +0000 (12:16 +0000)
Change-Id: I1eab03525f234139ceefbc9b9895a35a03a56910
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
src/vnet/sr/sr_steering.c

index be1bb7a..1699d88 100755 (executable)
@@ -72,16 +72,14 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
   memset (&key, 0, sizeof (sr_steering_key_t));
 
   /* Compute the steer policy key */
-  if (prefix)
+  if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6)
     {
       key.l3.prefix.as_u64[0] = prefix->as_u64[0];
       key.l3.prefix.as_u64[1] = prefix->as_u64[1];
       key.l3.mask_width = mask_width;
       key.l3.fib_table = (table_id != (u32) ~ 0 ? table_id : 0);
-      if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
-       return -1;
     }
-  else
+  else if (traffic_type == SR_STEER_L2)
     {
       key.l2.sw_if_index = sw_if_index;
 
@@ -94,9 +92,9 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
        vnet_get_sw_interface (sm->vnet_main, sw_if_index);
       if (sw->type != VNET_SW_INTERFACE_TYPE_HARDWARE)
        return -3;
-      if (traffic_type != SR_STEER_L2)
-       return -1;
     }
+  else
+    return -1;
 
   key.traffic_type = traffic_type;
 
@@ -280,8 +278,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
        goto cleanup_error_encap;
 
       if (vnet_feature_enable_disable
-         ("device-input", "sr-policy-rewrite-encaps-l2", sw_if_index, 1, 0,
-          0))
+         ("device-input", "sr-pl-rewrite-encaps-l2", sw_if_index, 1, 0, 0))
        goto cleanup_error_redirection;
 
       /* Set promiscous mode on interface */
@@ -552,13 +549,18 @@ sr_steering_init (vlib_main_t * vm)
   return 0;
 }
 
+/* *INDENT-OFF* */
 VLIB_INIT_FUNCTION (sr_steering_init);
+/* *INDENT-ON* */
 
-VNET_FEATURE_INIT (sr_policy_rewrite_encaps_l2, static) =
+/* *INDENT-OFF* */
+VNET_FEATURE_INIT (sr_pl_rewrite_encaps_l2, static) =
 {
-.arc_name = "device-input",.node_name =
-    "sr-pl-rewrite-encaps-l2",.runs_before =
-    VNET_FEATURES ("ethernet-input"),};
+  .arc_name = "device-input",
+  .node_name = "sr-pl-rewrite-encaps-l2",
+  .runs_before = VNET_FEATURES ("ethernet-input"),
+};
+/* *INDENT-ON* */
 
 /*
 * fd.io coding-style-patch-verification: ON