Improved tracing for the IP[46] not-enabled case. 35/10335/3
authorNeale Ranns <nranns@cisco.com>
Tue, 30 Jan 2018 17:02:20 +0000 (09:02 -0800)
committerDamjan Marion <dmarion.lists@gmail.com>
Wed, 31 Jan 2018 17:42:27 +0000 (17:42 +0000)
now we get
00:00:03:665501: pg-input
 ...
00:00:03:665681: ethernet-input
 ...
00:00:03:665691: ip6-input
  UDP: 2001::1 -> ffef::1
    tos 0x00, flow label 0x0, hop limit 64, payload length 108
  UDP: 1234 -> 1234
    length 108, checksum 0x7b25
00:00:03:665695: ip6-not-enabled
    UDP: 2001::1 -> ffef::1
      tos 0x00, flow label 0x0, hop limit 64, payload length 108
    UDP: 1234 -> 1234
      length 108, checksum 0x7b25
00:00:03:665706: error-drop
  ethernet-input: no error

Same goes for IPv4

Change-Id: Ia360df39b43281d3a0aa1b686f04b73cfa37c546
Signed-off-by: Neale Ranns <nranns@cisco.com>
src/plugins/stn/stn.c
src/vnet/dhcp/dhcp_client_detect.c
src/vnet/ip/ip4_forward.c
src/vnet/ip/ip4_punt_drop.c
src/vnet/ip/ip6_forward.c
src/vnet/ip/ip6_punt_drop.c

index b05883b..1447ec4 100644 (file)
@@ -382,9 +382,11 @@ int stn_rule_add_del (stn_rule_add_del_args_t *args)
                                  1, 0, 0);
       vnet_feature_enable_disable("ip6-unicast", "ip6-lookup", args->sw_if_index,
                                  1, 0, 0);
-      vnet_feature_enable_disable("ip4-unicast", "ip4-drop", args->sw_if_index,
+      vnet_feature_enable_disable("ip4-unicast", "ip4-not-enabled",
+                                  args->sw_if_index,
                                  0, 0, 0);
-      vnet_feature_enable_disable("ip6-unicast", "ip6-drop", args->sw_if_index,
+      vnet_feature_enable_disable("ip6-unicast", "ip6-not-enabled",
+                                  args->sw_if_index,
                                  0, 0, 0);
     }
   else if (r)
index 1b916cd..f9ba4fe 100644 (file)
@@ -319,7 +319,7 @@ VNET_FEATURE_INIT (ip4_dvr_reinject_feat_node, static) =
 {
   .arc_name = "ip4-unicast",
   .node_name = "ip4-dhcp-client-detect",
-  .runs_before = VNET_FEATURES ("ip4-drop"),
+  .runs_before = VNET_FEATURES ("ip4-not-enabled"),
 };
 
 /* *INDENT-ON* */
index c4c54b7..3ddf6df 100755 (executable)
@@ -883,11 +883,11 @@ ip4_sw_interface_enable_disable (u32 sw_if_index, u32 is_enable)
       if (0 != --im->ip_enabled_by_sw_if_index[sw_if_index])
        return;
     }
-  vnet_feature_enable_disable ("ip4-unicast", "ip4-drop", sw_if_index,
+  vnet_feature_enable_disable ("ip4-unicast", "ip4-not-enabled", sw_if_index,
                               !is_enable, 0, 0);
 
 
-  vnet_feature_enable_disable ("ip4-multicast", "ip4-drop",
+  vnet_feature_enable_disable ("ip4-multicast", "ip4-not-enabled",
                               sw_if_index, !is_enable, 0, 0);
 }
 
@@ -1066,10 +1066,10 @@ VNET_FEATURE_INIT (ip4_vxlan_bypass, static) =
   .runs_before = VNET_FEATURES ("ip4-lookup"),
 };
 
-VNET_FEATURE_INIT (ip4_drop, static) =
+VNET_FEATURE_INIT (ip4_not_enabled, static) =
 {
   .arc_name = "ip4-unicast",
-  .node_name = "ip4-drop",
+  .node_name = "ip4-not-enabled",
   .runs_before = VNET_FEATURES ("ip4-lookup"),
 };
 
@@ -1095,10 +1095,10 @@ VNET_FEATURE_INIT (ip4_vpath_mc, static) =
   .runs_before = VNET_FEATURES ("ip4-mfib-forward-lookup"),
 };
 
-VNET_FEATURE_INIT (ip4_mc_drop, static) =
+VNET_FEATURE_INIT (ip4_mc_not_enabled, static) =
 {
   .arc_name = "ip4-multicast",
-  .node_name = "ip4-drop",
+  .node_name = "ip4-not-enabled",
   .runs_before = VNET_FEATURES ("ip4-mfib-forward-lookup"),
 };
 
@@ -1166,11 +1166,11 @@ ip4_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
       /* *INDENT-ON* */
     }
 
-  vnet_feature_enable_disable ("ip4-unicast", "ip4-drop", sw_if_index,
+  vnet_feature_enable_disable ("ip4-unicast", "ip4-not-enabled", sw_if_index,
                               is_add, 0, 0);
 
-  vnet_feature_enable_disable ("ip4-multicast", "ip4-drop", sw_if_index,
-                              is_add, 0, 0);
+  vnet_feature_enable_disable ("ip4-multicast", "ip4-not-enabled",
+                              sw_if_index, is_add, 0, 0);
 
   return /* no error */ 0;
 }
index 4e74963..3600d7c 100644 (file)
@@ -28,7 +28,7 @@ VNET_FEATURE_ARC_INIT (ip4_punt) =
 VNET_FEATURE_ARC_INIT (ip4_drop) =
 {
   .arc_name  = "ip4-drop",
-  .start_nodes = VNET_FEATURES ("ip4-drop"),
+  .start_nodes = VNET_FEATURES ("ip4-drop", "ip4-not-enabled"),
 };
 /* *INDENT-ON* */
 
@@ -186,6 +186,17 @@ ip4_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 
 }
 
+static uword
+ip4_not_enabled (vlib_main_t * vm,
+                vlib_node_runtime_t * node, vlib_frame_t * frame)
+{
+  if (node->flags & VLIB_NODE_FLAG_TRACE)
+    ip4_forward_next_trace (vm, node, frame, VLIB_TX);
+
+  return ip_drop_or_punt (vm, node, frame,
+                         vnet_feat_arc_ip4_drop.feature_arc_index);
+}
+
 static uword
 ip4_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
@@ -211,6 +222,20 @@ VLIB_REGISTER_NODE (ip4_drop_node, static) =
 
 VLIB_NODE_FUNCTION_MULTIARCH (ip4_drop_node, ip4_drop);
 
+VLIB_REGISTER_NODE (ip4_not_enabled_node, static) =
+{
+  .function = ip4_not_enabled,
+  .name = "ip4-not-enabled",
+  .vector_size = sizeof (u32),
+  .format_trace = format_ip4_forward_next_trace,
+  .n_next_nodes = 1,
+  .next_nodes = {
+    [0] = "error-drop",
+  },
+};
+
+VLIB_NODE_FUNCTION_MULTIARCH (ip4_not_enabled_node, ip4_not_enabled);
+
 VLIB_REGISTER_NODE (ip4_punt_node, static) =
 {
   .function = ip4_punt,
index 0a30872..c1c9ec0 100644 (file)
@@ -436,11 +436,11 @@ ip6_sw_interface_enable_disable (u32 sw_if_index, u32 is_enable)
        return;
     }
 
-  vnet_feature_enable_disable ("ip6-unicast", "ip6-drop", sw_if_index,
+  vnet_feature_enable_disable ("ip6-unicast", "ip6-not-enabled", sw_if_index,
                               !is_enable, 0, 0);
 
-  vnet_feature_enable_disable ("ip6-multicast", "ip6-drop", sw_if_index,
-                              !is_enable, 0, 0);
+  vnet_feature_enable_disable ("ip6-multicast", "ip6-not-enabled",
+                              sw_if_index, !is_enable, 0, 0);
 }
 
 /* get first interface address */
@@ -622,10 +622,10 @@ VNET_FEATURE_INIT (ip6_vxlan_bypass, static) =
   .runs_before = VNET_FEATURES ("ip6-lookup"),
 };
 
-VNET_FEATURE_INIT (ip6_drop, static) =
+VNET_FEATURE_INIT (ip6_not_enabled, static) =
 {
   .arc_name = "ip6-unicast",
-  .node_name = "ip6-drop",
+  .node_name = "ip6-not-enabled",
   .runs_before = VNET_FEATURES ("ip6-lookup"),
 };
 
@@ -650,9 +650,9 @@ VNET_FEATURE_INIT (ip6_vpath_mc, static) = {
   .runs_before = VNET_FEATURES ("ip6-mfib-forward-lookup"),
 };
 
-VNET_FEATURE_INIT (ip6_drop_mc, static) = {
+VNET_FEATURE_INIT (ip6_not_enabled_mc, static) = {
   .arc_name = "ip6-multicast",
-  .node_name = "ip6-drop",
+  .node_name = "ip6-not-enabled",
   .runs_before = VNET_FEATURES ("ip6-mfib-forward-lookup"),
 };
 
@@ -711,11 +711,11 @@ ip6_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
       ip6_mfib_interface_enable_disable (sw_if_index, 0);
     }
 
-  vnet_feature_enable_disable ("ip6-unicast", "ip6-drop", sw_if_index,
+  vnet_feature_enable_disable ("ip6-unicast", "ip6-not-enabled", sw_if_index,
                               is_add, 0, 0);
 
-  vnet_feature_enable_disable ("ip6-multicast", "ip6-drop", sw_if_index,
-                              is_add, 0, 0);
+  vnet_feature_enable_disable ("ip6-multicast", "ip6-not-enabled",
+                              sw_if_index, is_add, 0, 0);
 
   return /* no error */ 0;
 }
index 8852775..b894489 100644 (file)
@@ -28,7 +28,7 @@ VNET_FEATURE_ARC_INIT (ip6_punt) =
 VNET_FEATURE_ARC_INIT (ip6_drop) =
 {
   .arc_name  = "ip6-drop",
-  .start_nodes = VNET_FEATURES ("ip6-drop"),
+  .start_nodes = VNET_FEATURES ("ip6-drop", "ip6-not-enabled"),
 };
 /* *INDENT-ON* */
 
@@ -88,6 +88,18 @@ ip6_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 
 }
 
+static uword
+ip6_not_enabled (vlib_main_t * vm,
+                vlib_node_runtime_t * node, vlib_frame_t * frame)
+{
+  if (node->flags & VLIB_NODE_FLAG_TRACE)
+    ip6_forward_next_trace (vm, node, frame, VLIB_TX);
+
+  return ip_drop_or_punt (vm, node, frame,
+                         vnet_feat_arc_ip6_drop.feature_arc_index);
+
+}
+
 static uword
 ip6_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
@@ -113,6 +125,20 @@ VLIB_REGISTER_NODE (ip6_drop_node, static) =
 
 VLIB_NODE_FUNCTION_MULTIARCH (ip6_drop_node, ip6_drop);
 
+VLIB_REGISTER_NODE (ip6_not_enabled_node, static) =
+{
+  .function = ip6_not_enabled,
+  .name = "ip6-not-enabled",
+  .vector_size = sizeof (u32),
+  .format_trace = format_ip6_forward_next_trace,
+  .n_next_nodes = 1,
+  .next_nodes = {
+    [0] = "error-drop",
+  },
+};
+
+VLIB_NODE_FUNCTION_MULTIARCH (ip6_not_enabled_node, ip6_not_enabled);
+
 VLIB_REGISTER_NODE (ip6_punt_node, static) =
 {
   .function = ip6_punt,