Fix icmp/udp/tcp punt/drop paths

Send packets to ip4/6_punt/drop nodes instead of error-drop/punt nodes

dbarach: clean up an annoying checkstyle issue: indent 2.2.10
(OpenSUSE version) and indent 2.2.11 (Ubuntu / CentOS versions) had an
artistic disagreement about ip_frag.c.

Change-Id: I660bee28a064af9c6c70371363081e941d1c3a94
Signed-off-by: Vijayabhaskar Katamreddy <vkatamre@cisco.com>
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c
index bbeab32..1fe01e4 100644
--- a/src/vnet/ip/icmp4.c
+++ b/src/vnet/ip/icmp4.c
@@ -219,7 +219,7 @@
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [ICMP_INPUT_NEXT_ERROR] = "error-punt",
+    [ICMP_INPUT_NEXT_ERROR] = "ip4-punt",
   },
 };
 /* *INDENT-ON* */
@@ -592,7 +592,7 @@
 
   .n_next_nodes = IP4_ICMP_ERROR_N_NEXT,
   .next_nodes = {
-    [IP4_ICMP_ERROR_NEXT_DROP] = "error-drop",
+    [IP4_ICMP_ERROR_NEXT_DROP] = "ip4-drop",
     [IP4_ICMP_ERROR_NEXT_LOOKUP] = "ip4-lookup",
   },
 
diff --git a/src/vnet/ip/icmp6.c b/src/vnet/ip/icmp6.c
index 70696d0..ab871b3 100644
--- a/src/vnet/ip/icmp6.c
+++ b/src/vnet/ip/icmp6.c
@@ -250,7 +250,7 @@
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [ICMP_INPUT_NEXT_DROP] = "error-drop",
+    [ICMP_INPUT_NEXT_DROP] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
@@ -663,7 +663,7 @@
 
   .n_next_nodes = IP6_ICMP_ERROR_N_NEXT,
   .next_nodes = {
-    [IP6_ICMP_ERROR_NEXT_DROP] = "error-drop",
+    [IP6_ICMP_ERROR_NEXT_DROP] = "ip6-drop",
     [IP6_ICMP_ERROR_NEXT_LOOKUP] = "ip6-lookup",
   },
 
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 2f3f340..9c57757 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2727,7 +2727,7 @@
 
     <em>Next Indices:</em>
     - <code> adj->rewrite_header.next_index </code>
-      or @c error-drop
+      or @c ip4-drop
 */
 static uword
 ip4_rewrite (vlib_main_t * vm,
@@ -2779,7 +2779,7 @@
 
   .n_next_nodes = 2,
   .next_nodes = {
-    [IP4_REWRITE_NEXT_DROP] = "error-drop",
+    [IP4_REWRITE_NEXT_DROP] = "ip4-drop",
     [IP4_REWRITE_NEXT_ICMP_ERROR] = "ip4-icmp-error",
   },
 };
diff --git a/src/vnet/ip/ip4_source_and_port_range_check.c b/src/vnet/ip/ip4_source_and_port_range_check.c
index d1f18dd..06e6e7c 100644
--- a/src/vnet/ip/ip4_source_and_port_range_check.c
+++ b/src/vnet/ip/ip4_source_and_port_range_check.c
@@ -593,7 +593,7 @@
 
   .n_next_nodes = IP4_SOURCE_AND_PORT_RANGE_CHECK_N_NEXT,
   .next_nodes = {
-    [IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP] = "error-drop",
+    [IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP] = "ip4-drop",
   },
 
   .format_buffer = format_ip4_header,
@@ -612,7 +612,7 @@
 
   .n_next_nodes = IP4_SOURCE_AND_PORT_RANGE_CHECK_N_NEXT,
   .next_nodes = {
-    [IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP] = "error-drop",
+    [IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP] = "ip4-drop",
   },
 
   .format_buffer = format_ip4_header,
@@ -777,7 +777,7 @@
  * Example of graph node before range checking is enabled:
  * @cliexstart{show vlib graph ip4-source-and-port-range-check-tx}
  *            Name                      Next                    Previous
- * ip4-source-and-port-range-      error-drop [0]
+ * ip4-source-and-port-range-      ip4-drop [0]
  * @cliexend
  *
  * Example of how to enable range checking on TX:
@@ -786,7 +786,7 @@
  * Example of graph node after range checking is enabled:
  * @cliexstart{show vlib graph ip4-source-and-port-range-check-tx}
  *            Name                      Next                    Previous
- * ip4-source-and-port-range-      error-drop [0]              ip4-rewrite
+ * ip4-source-and-port-range-      ip4-drop [0]                ip4-rewrite
  *                              interface-output [1]
  * @cliexend
  *
diff --git a/src/vnet/ip/ip4_source_check.c b/src/vnet/ip/ip4_source_check.c
index 17a1cb1..25c5127 100644
--- a/src/vnet/ip/ip4_source_check.c
+++ b/src/vnet/ip/ip4_source_check.c
@@ -309,7 +309,7 @@
 
   .n_next_nodes = IP4_SOURCE_CHECK_N_NEXT,
   .next_nodes = {
-    [IP4_SOURCE_CHECK_NEXT_DROP] = "error-drop",
+    [IP4_SOURCE_CHECK_NEXT_DROP] = "ip4-drop",
   },
 
   .format_buffer = format_ip4_header,
@@ -328,7 +328,7 @@
 
   .n_next_nodes = IP4_SOURCE_CHECK_N_NEXT,
   .next_nodes = {
-    [IP4_SOURCE_CHECK_NEXT_DROP] = "error-drop",
+    [IP4_SOURCE_CHECK_NEXT_DROP] = "ip4-drop",
   },
 
   .format_buffer = format_ip4_header,
@@ -405,7 +405,7 @@
  * Example of graph node before range checking is enabled:
  * @cliexstart{show vlib graph ip4-source-check-via-rx}
  *            Name                      Next                    Previous
- * ip4-source-check-via-rx         error-drop [0]
+ * ip4-source-check-via-rx         ip4-drop [0]
  * @cliexend
  *
  * Example of how to enable unicast source checking on an interface:
@@ -414,7 +414,7 @@
  * Example of graph node after range checking is enabled:
  * @cliexstart{show vlib graph ip4-source-check-via-rx}
  *            Name                      Next                    Previous
- * ip4-source-check-via-rx         error-drop [0]         ip4-input-no-checksum
+ * ip4-source-check-via-rx         ip4-drop [0]           ip4-input-no-checksum
  *                           ip4-source-and-port-range-         ip4-input
  * @cliexend
  *
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 67fedc9..29cd3ca 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1902,7 +1902,7 @@
   .n_next_nodes = IP6_DISCOVER_NEIGHBOR_N_NEXT,
   .next_nodes =
   {
-    [IP6_DISCOVER_NEIGHBOR_NEXT_DROP] = "error-drop",
+    [IP6_DISCOVER_NEIGHBOR_NEXT_DROP] = "ip6-drop",
     [IP6_DISCOVER_NEIGHBOR_NEXT_REPLY_TX] = "interface-output",
   },
 };
@@ -1920,7 +1920,7 @@
   .n_next_nodes = IP6_DISCOVER_NEIGHBOR_N_NEXT,
   .next_nodes =
   {
-    [IP6_DISCOVER_NEIGHBOR_NEXT_DROP] = "error-drop",
+    [IP6_DISCOVER_NEIGHBOR_NEXT_DROP] = "ip6-drop",
     [IP6_DISCOVER_NEIGHBOR_NEXT_REPLY_TX] = "interface-output",
   },
 };
@@ -2432,7 +2432,7 @@
   .n_next_nodes = 2,
   .next_nodes =
   {
-    [IP6_REWRITE_NEXT_DROP] = "error-drop",
+    [IP6_REWRITE_NEXT_DROP] = "ip6-drop",
     [IP6_REWRITE_NEXT_ICMP_ERROR] = "ip6-icmp-error",
   },
 };
diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c
index 14fbb39..90a4d21 100644
--- a/src/vnet/ip/ip6_hop_by_hop.c
+++ b/src/vnet/ip/ip6_hop_by_hop.c
@@ -46,7 +46,7 @@
 #define foreach_ip6_hbyh_ioam_input_next	\
   _(IP6_REWRITE, "ip6-rewrite")			\
   _(IP6_LOOKUP, "ip6-lookup")			\
-  _(DROP, "error-drop")
+  _(DROP, "ip6-drop")
 
 typedef enum
 {
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index d549ac3..82b402f 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -2435,7 +2435,7 @@
 
   .n_next_nodes = ICMP6_ROUTER_SOLICITATION_N_NEXT,
   .next_nodes = {
-    [ICMP6_ROUTER_SOLICITATION_NEXT_DROP] = "error-drop",
+    [ICMP6_ROUTER_SOLICITATION_NEXT_DROP] = "ip6-drop",
     [ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW] = "ip6-rewrite-mcast",
     [ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX] = "interface-output",
   },
@@ -2628,7 +2628,7 @@
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [0] = "error-drop",
+    [0] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
@@ -2671,7 +2671,7 @@
 
   .n_next_nodes = ICMP6_NEIGHBOR_SOLICITATION_N_NEXT,
   .next_nodes = {
-    [ICMP6_NEIGHBOR_SOLICITATION_NEXT_DROP] = "error-drop",
+    [ICMP6_NEIGHBOR_SOLICITATION_NEXT_DROP] = "ip6-drop",
     [ICMP6_NEIGHBOR_SOLICITATION_NEXT_REPLY] = "interface-output",
   },
 };
@@ -2689,7 +2689,7 @@
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [0] = "error-drop",
+    [0] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
diff --git a/src/vnet/ip/ip_frag.c b/src/vnet/ip/ip_frag.c
index ca062bf..2af697e 100644
--- a/src/vnet/ip/ip_frag.c
+++ b/src/vnet/ip/ip_frag.c
@@ -90,8 +90,8 @@
       ip_frag_id = ip4->fragment_id;
       ip_frag_offset = ip4_get_fragment_offset (ip4);
       more =
-	! !(ip4->flags_and_fragment_offset &
-	    clib_host_to_net_u16 (IP4_HEADER_FLAG_MORE_FRAGMENTS));
+	!(!(ip4->flags_and_fragment_offset &
+	    clib_host_to_net_u16 (IP4_HEADER_FLAG_MORE_FRAGMENTS)));
     }
   else
     {
@@ -239,10 +239,12 @@
 	      next0 = IP4_FRAG_NEXT_ICMP_ERROR;
 	    }
 	  else
-	    next0 =
-	      (error0 ==
-	       IP_FRAG_ERROR_NONE) ? vnet_buffer (p0)->
-	      ip_frag.next_index : IP4_FRAG_NEXT_DROP;
+	    {
+              /* *INDENT-OFF* */
+              next0 = (error0 == IP_FRAG_ERROR_NONE) ? vnet_buffer (p0)->
+                ip_frag.next_index : IP4_FRAG_NEXT_DROP;
+              /* *INDENT-ON* */
+	    }
 
 	  if (error0 == IP_FRAG_ERROR_NONE)
 	    {
@@ -482,10 +484,11 @@
 	      tr->next = vnet_buffer (p0)->ip_frag.next_index;
 	    }
 
-	  next0 =
-	    (error0 ==
-	     IP_FRAG_ERROR_NONE) ? vnet_buffer (p0)->
+          /* *INDENT-OFF* */
+	  next0 = (error0 == IP_FRAG_ERROR_NONE) ? vnet_buffer (p0)->
 	    ip_frag.next_index : IP6_FRAG_NEXT_DROP;
+          /* *INDENT-ON* */
+
 	  frag_sent += vec_len (buffer);
 	  small_packets += (vec_len (buffer) == 1);
 
@@ -547,7 +550,7 @@
     [IP4_FRAG_NEXT_IP4_LOOKUP] = "ip4-lookup",
     [IP4_FRAG_NEXT_IP6_LOOKUP] = "ip6-lookup",
     [IP4_FRAG_NEXT_ICMP_ERROR] = "ip4-icmp-error",
-    [IP4_FRAG_NEXT_DROP] = "error-drop"
+    [IP4_FRAG_NEXT_DROP] = "ip4-drop"
   },
 };
 /* *INDENT-ON* */
@@ -567,7 +570,7 @@
   .next_nodes = {
     [IP6_FRAG_NEXT_IP4_LOOKUP] = "ip4-lookup",
     [IP6_FRAG_NEXT_IP6_LOOKUP] = "ip6-lookup",
-    [IP6_FRAG_NEXT_DROP] = "error-drop"
+    [IP6_FRAG_NEXT_DROP] = "ip6-drop"
   },
 };
 /* *INDENT-ON* */
diff --git a/src/vnet/ip/ip_input_acl.c b/src/vnet/ip/ip_input_acl.c
index 4d365a4..3c54fe8 100644
--- a/src/vnet/ip/ip_input_acl.c
+++ b/src/vnet/ip/ip_input_acl.c
@@ -402,7 +402,7 @@
 
   .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
   .next_nodes = {
-    [ACL_NEXT_INDEX_DENY] = "error-drop",
+    [ACL_NEXT_INDEX_DENY] = "ip4-drop",
   },
 };
 /* *INDENT-ON* */
@@ -427,7 +427,7 @@
 
   .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
   .next_nodes = {
-    [ACL_NEXT_INDEX_DENY] = "error-drop",
+    [ACL_NEXT_INDEX_DENY] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index f438ce9..a142754 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -155,8 +155,8 @@
   .format_trace = format_icmp_echo_trace,
   .n_next_nodes = ICMP6_ECHO_REPLY_N_NEXT,
   .next_nodes = {
-    [ICMP6_ECHO_REPLY_NEXT_DROP] = "error-drop",
-    [ICMP6_ECHO_REPLY_NEXT_PUNT] = "error-punt",
+    [ICMP6_ECHO_REPLY_NEXT_DROP] = "ip6-drop",
+    [ICMP6_ECHO_REPLY_NEXT_PUNT] = "ip6-punt",
   },
 };
 /* *INDENT-ON* */
@@ -213,8 +213,8 @@
   .format_trace = format_icmp_echo_trace,
   .n_next_nodes = ICMP4_ECHO_REPLY_N_NEXT,
   .next_nodes = {
-    [ICMP4_ECHO_REPLY_NEXT_DROP] = "error-drop",
-    [ICMP4_ECHO_REPLY_NEXT_PUNT] = "error-punt",
+    [ICMP4_ECHO_REPLY_NEXT_DROP] = "ip4-drop",
+    [ICMP4_ECHO_REPLY_NEXT_PUNT] = "ip4-punt",
   },
 };
 /* *INDENT-ON* */
diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c
index 568350c..b417427 100644
--- a/src/vnet/ip/punt.c
+++ b/src/vnet/ip/punt.c
@@ -40,7 +40,8 @@
 #include <stdbool.h>
 
 #define foreach_punt_next			\
-  _ (PUNT, "error-punt")
+  _ (PUNT4, "ip4-punt")                         \
+  _ (PUNT6, "ip6-punt")
 
 typedef enum
 {
@@ -58,6 +59,8 @@
   PUNT_SOCKET_RX_N_NEXT
 };
 
+#define punt_next_punt(is_ip4) (is_ip4 ? PUNT_NEXT_PUNT4 : PUNT_NEXT_PUNT6)
+
 vlib_node_registration_t udp4_punt_node;
 vlib_node_registration_t udp6_punt_node;
 vlib_node_registration_t udp4_punt_socket_node;
@@ -104,7 +107,8 @@
     {
       u32 n_left_to_next;
 
-      vlib_get_next_frame (vm, node, PUNT_NEXT_PUNT, to_next, n_left_to_next);
+      vlib_get_next_frame (vm, node, punt_next_punt (is_ip4), to_next,
+			   n_left_to_next);
 
       while (n_left_from > 0 && n_left_to_next > 0)
 	{
@@ -123,7 +127,7 @@
 	  b0->error = node->errors[PUNT_ERROR_UDP_PORT];
 	}
 
-      vlib_put_next_frame (vm, node, PUNT_NEXT_PUNT, n_left_to_next);
+      vlib_put_next_frame (vm, node, punt_next_punt (is_ip4), n_left_to_next);
     }
 
   return from_frame->n_vectors;