Fix icmp/udp/tcp punt/drop paths 40/9440/8
authorVijayabhaskar Katamreddy <vkatamre@cisco.com>
Wed, 15 Nov 2017 21:50:26 +0000 (13:50 -0800)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 15 Dec 2017 15:58:46 +0000 (15:58 +0000)
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>
14 files changed:
src/vnet/ip/icmp4.c
src/vnet/ip/icmp6.c
src/vnet/ip/ip4_forward.c
src/vnet/ip/ip4_source_and_port_range_check.c
src/vnet/ip/ip4_source_check.c
src/vnet/ip/ip6_forward.c
src/vnet/ip/ip6_hop_by_hop.c
src/vnet/ip/ip6_neighbor.c
src/vnet/ip/ip_frag.c
src/vnet/ip/ip_input_acl.c
src/vnet/ip/ping.c
src/vnet/ip/punt.c
src/vnet/tcp/tcp_input.c
src/vnet/udp/udp_local.c

index bbeab32..1fe01e4 100644 (file)
@@ -219,7 +219,7 @@ VLIB_REGISTER_NODE (ip4_icmp_input_node,static) = {
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [ICMP_INPUT_NEXT_ERROR] = "error-punt",
+    [ICMP_INPUT_NEXT_ERROR] = "ip4-punt",
   },
 };
 /* *INDENT-ON* */
@@ -592,7 +592,7 @@ VLIB_REGISTER_NODE (ip4_icmp_error_node) = {
 
   .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",
   },
 
index 70696d0..ab871b3 100644 (file)
@@ -250,7 +250,7 @@ VLIB_REGISTER_NODE (ip6_icmp_input_node) = {
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [ICMP_INPUT_NEXT_DROP] = "error-drop",
+    [ICMP_INPUT_NEXT_DROP] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
@@ -663,7 +663,7 @@ VLIB_REGISTER_NODE (ip6_icmp_error_node) = {
 
   .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",
   },
 
index 2f3f340..9c57757 100755 (executable)
@@ -2727,7 +2727,7 @@ ip4_rewrite_inline (vlib_main_t * vm,
 
     <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 @@ VLIB_REGISTER_NODE (ip4_rewrite_node) = {
 
   .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",
   },
 };
index d1f18dd..06e6e7c 100644 (file)
@@ -593,7 +593,7 @@ VLIB_REGISTER_NODE (ip4_source_port_and_range_check_rx) = {
 
   .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 @@ VLIB_REGISTER_NODE (ip4_source_port_and_range_check_tx) = {
 
   .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 @@ set_ip_source_and_port_range_check_fn (vlib_main_t * vm,
  * 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 @@ set_ip_source_and_port_range_check_fn (vlib_main_t * vm,
  * 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
  *
index 17a1cb1..25c5127 100644 (file)
@@ -309,7 +309,7 @@ VLIB_REGISTER_NODE (ip4_check_source_reachable_via_any) = {
 
   .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 @@ VLIB_REGISTER_NODE (ip4_check_source_reachable_via_rx) = {
 
   .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 @@ done:
  * 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 @@ done:
  * 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
  *
index 67fedc9..29cd3ca 100644 (file)
@@ -1902,7 +1902,7 @@ VLIB_REGISTER_NODE (ip6_discover_neighbor_node) =
   .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 @@ VLIB_REGISTER_NODE (ip6_glean_node) =
   .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 @@ VLIB_REGISTER_NODE (ip6_rewrite_node) =
   .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",
   },
 };
index 14fbb39..90a4d21 100644 (file)
@@ -46,7 +46,7 @@ ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main;
 #define foreach_ip6_hbyh_ioam_input_next       \
   _(IP6_REWRITE, "ip6-rewrite")                        \
   _(IP6_LOOKUP, "ip6-lookup")                  \
-  _(DROP, "error-drop")
+  _(DROP, "ip6-drop")
 
 typedef enum
 {
index d549ac3..82b402f 100644 (file)
@@ -2435,7 +2435,7 @@ VLIB_REGISTER_NODE (ip6_icmp_router_solicitation_node,static) =
 
   .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 @@ VLIB_REGISTER_NODE (ip6_icmp_router_advertisement_node,static) =
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [0] = "error-drop",
+    [0] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
@@ -2671,7 +2671,7 @@ VLIB_REGISTER_NODE (ip6_icmp_neighbor_solicitation_node,static) =
 
   .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 @@ VLIB_REGISTER_NODE (ip6_icmp_neighbor_advertisement_node,static) =
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [0] = "error-drop",
+    [0] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
index ca062bf..2af697e 100644 (file)
@@ -90,8 +90,8 @@ ip4_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer,
       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 @@ ip4_frag (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
              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 @@ ip6_frag (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
              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 @@ VLIB_REGISTER_NODE (ip4_frag_node) = {
     [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 @@ VLIB_REGISTER_NODE (ip6_frag_node) = {
   .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* */
index 4d365a4..3c54fe8 100644 (file)
@@ -402,7 +402,7 @@ VLIB_REGISTER_NODE (ip4_inacl_node) = {
 
   .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 @@ VLIB_REGISTER_NODE (ip6_inacl_node) = {
 
   .n_next_nodes = ACL_NEXT_INDEX_N_NEXT,
   .next_nodes = {
-    [ACL_NEXT_INDEX_DENY] = "error-drop",
+    [ACL_NEXT_INDEX_DENY] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
index f438ce9..a142754 100755 (executable)
@@ -155,8 +155,8 @@ VLIB_REGISTER_NODE (ip6_icmp_echo_reply_node, static) =
   .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 @@ VLIB_REGISTER_NODE (ip4_icmp_echo_reply_node, static) =
   .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* */
index 568350c..b417427 100644 (file)
@@ -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 @@ enum punt_socket_rx_next_e
   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 @@ udp46_punt_inline (vlib_main_t * vm,
     {
       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 @@ udp46_punt_inline (vlib_main_t * vm,
          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;
index 702a94f..b0ea24f 100644 (file)
@@ -27,7 +27,8 @@ static char *tcp_error_strings[] = {
 
 /* All TCP nodes have the same outgoing arcs */
 #define foreach_tcp_state_next                  \
-  _ (DROP, "error-drop")                        \
+  _ (DROP4, "ip4-drop")                         \
+  _ (DROP6, "ip6-drop")                         \
   _ (TCP4_OUTPUT, "tcp4-output")                \
   _ (TCP6_OUTPUT, "tcp6-output")
 
@@ -75,6 +76,9 @@ typedef enum _tcp_state_next
 #define tcp_next_output(is_ip4) (is_ip4 ? TCP_NEXT_TCP4_OUTPUT          \
                                         : TCP_NEXT_TCP6_OUTPUT)
 
+#define tcp_next_drop(is_ip4) (is_ip4 ? TCP_NEXT_DROP4                  \
+                                      : TCP_NEXT_DROP6)
+
 vlib_node_registration_t tcp4_established_node;
 vlib_node_registration_t tcp6_established_node;
 
@@ -1554,7 +1558,7 @@ tcp_segment_rcv (tcp_main_t * tm, tcp_connection_t * tc, vlib_buffer_t * b,
       if (seq_lt (vnet_buffer (b)->tcp.seq_number, tc->rcv_nxt))
        {
          error = TCP_ERROR_SEGMENT_OLD;
-         *next0 = TCP_NEXT_DROP;
+         *next0 = tcp_next_drop (tc->c_is_ip4);
 
          /* Completely in the past (possible retransmit) */
          if (seq_leq (vnet_buffer (b)->tcp.seq_end, tc->rcv_nxt))
@@ -1707,7 +1711,7 @@ tcp46_established_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          vlib_buffer_t *b0;
          tcp_header_t *th0 = 0;
          tcp_connection_t *tc0;
-         u32 next0 = TCP_ESTABLISHED_NEXT_DROP, error0 = TCP_ERROR_ENQUEUED;
+         u32 next0 = tcp_next_drop (is_ip4), error0 = TCP_ERROR_ENQUEUED;
 
          bi0 = from[0];
          to_next[0] = bi0;
@@ -1967,7 +1971,7 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          tcp_header_t *tcp0 = 0;
          tcp_connection_t *tc0;
          tcp_connection_t *new_tc0;
-         u32 next0 = TCP_SYN_SENT_NEXT_DROP, error0 = TCP_ERROR_ENQUEUED;
+         u32 next0 = tcp_next_drop (is_ip4), error0 = TCP_ERROR_ENQUEUED;
 
          bi0 = from[0];
          to_next[0] = bi0;
@@ -2294,7 +2298,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          vlib_buffer_t *b0;
          tcp_header_t *tcp0 = 0;
          tcp_connection_t *tc0;
-         u32 next0 = TCP_RCV_PROCESS_NEXT_DROP, error0 = TCP_ERROR_ENQUEUED;
+         u32 next0 = tcp_next_drop (is_ip4), error0 = TCP_ERROR_ENQUEUED;
          u8 is_fin0;
 
          bi0 = from[0];
@@ -2690,7 +2694,7 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          ip4_header_t *ip40;
          ip6_header_t *ip60;
          tcp_connection_t *child0;
-         u32 error0 = TCP_ERROR_SYNS_RCVD, next0 = TCP_LISTEN_NEXT_DROP;
+         u32 error0 = TCP_ERROR_SYNS_RCVD, next0 = tcp_next_drop (is_ip4);
 
          bi0 = from[0];
          to_next[0] = bi0;
@@ -2895,22 +2899,22 @@ typedef enum _tcp_input_next
 } tcp_input_next_t;
 
 #define foreach_tcp4_input_next                 \
-  _ (DROP, "error-drop")                        \
+  _ (DROP, "ip4-drop")                          \
   _ (LISTEN, "tcp4-listen")                     \
   _ (RCV_PROCESS, "tcp4-rcv-process")           \
   _ (SYN_SENT, "tcp4-syn-sent")                 \
   _ (ESTABLISHED, "tcp4-established")          \
   _ (RESET, "tcp4-reset")                      \
-  _ (PUNT, "error-punt")
+  _ (PUNT, "ip4-punt")
 
 #define foreach_tcp6_input_next                 \
-  _ (DROP, "error-drop")                        \
+  _ (DROP, "ip6-drop")                          \
   _ (LISTEN, "tcp6-listen")                     \
   _ (RCV_PROCESS, "tcp6-rcv-process")           \
   _ (SYN_SENT, "tcp6-syn-sent")                 \
   _ (ESTABLISHED, "tcp6-established")          \
   _ (RESET, "tcp6-reset")                      \
-  _ (PUNT, "error-punt")
+  _ (PUNT, "ip6-punt")
 
 #define filter_flags (TCP_FLAG_SYN|TCP_FLAG_ACK|TCP_FLAG_RST|TCP_FLAG_FIN)
 
index ce9bb02..f0d9530 100644 (file)
 udp_main_t udp_main;
 
 #define foreach_udp_local_next                  \
-  _ (PUNT, "error-punt")                        \
-  _ (DROP, "error-drop")                        \
+  _ (PUNT4, "ip4-punt")                         \
+  _ (PUNT6, "ip6-punt")                         \
+  _ (DROP4, "ip4-drop")                         \
+  _ (DROP6, "ip6-drop")                         \
   _ (ICMP4_ERROR, "ip4-icmp-error")             \
   _ (ICMP6_ERROR, "ip6-icmp-error")
 
@@ -37,6 +39,9 @@ typedef enum
     UDP_LOCAL_N_NEXT,
 } udp_local_next_t;
 
+#define udp_local_next_drop(is_ip4)      ((is_ip4) ? UDP_LOCAL_NEXT_DROP4 : UDP_LOCAL_NEXT_DROP6)
+#define udp_local_next_punt(is_ip4)      ((is_ip4) ? UDP_LOCAL_NEXT_PUNT4 : UDP_LOCAL_NEXT_PUNT6)
+
 typedef struct
 {
   u16 src_port;
@@ -132,7 +137,7 @@ udp46_local_inline (vlib_main_t * vm,
          if (PREDICT_FALSE (b0->current_length < advance0 + sizeof (*h0)))
            {
              error0 = UDP_ERROR_LENGTH_ERROR;
-             next0 = UDP_LOCAL_NEXT_DROP;
+             next0 = udp_local_next_drop (is_ip4);
            }
          else
            {
@@ -143,14 +148,14 @@ udp46_local_inline (vlib_main_t * vm,
                                 vlib_buffer_length_in_chain (vm, b0)))
                {
                  error0 = UDP_ERROR_LENGTH_ERROR;
-                 next0 = UDP_LOCAL_NEXT_DROP;
+                 next0 = udp_local_next_drop (is_ip4);
                }
            }
 
          if (PREDICT_FALSE (b1->current_length < advance1 + sizeof (*h1)))
            {
              error1 = UDP_ERROR_LENGTH_ERROR;
-             next1 = UDP_LOCAL_NEXT_DROP;
+             next1 = udp_local_next_drop (is_ip4);
            }
          else
            {
@@ -161,7 +166,7 @@ udp46_local_inline (vlib_main_t * vm,
                                 vlib_buffer_length_in_chain (vm, b1)))
                {
                  error1 = UDP_ERROR_LENGTH_ERROR;
-                 next1 = UDP_LOCAL_NEXT_DROP;
+                 next1 = udp_local_next_drop (is_ip4);
                }
            }
 
@@ -187,7 +192,7 @@ udp46_local_inline (vlib_main_t * vm,
              if (PREDICT_FALSE (punt_unknown))
                {
                  b0->error = node->errors[UDP_ERROR_PUNT];
-                 next0 = UDP_LOCAL_NEXT_PUNT;
+                 next0 = udp_local_next_punt (is_ip4);
                }
              else if (is_ip4)
                {
@@ -224,7 +229,7 @@ udp46_local_inline (vlib_main_t * vm,
              if (PREDICT_FALSE (punt_unknown))
                {
                  b1->error = node->errors[UDP_ERROR_PUNT];
-                 next1 = UDP_LOCAL_NEXT_PUNT;
+                 next1 = udp_local_next_punt (is_ip4);
                }
              else if (is_ip4)
                {
@@ -308,7 +313,7 @@ udp46_local_inline (vlib_main_t * vm,
          if (PREDICT_FALSE (b0->current_length < advance0 + sizeof (*h0)))
            {
              b0->error = node->errors[UDP_ERROR_LENGTH_ERROR];
-             next0 = UDP_LOCAL_NEXT_DROP;
+             next0 = udp_local_next_drop (is_ip4);
              goto trace_x1;
            }
 
@@ -333,7 +338,7 @@ udp46_local_inline (vlib_main_t * vm,
                  if (PREDICT_FALSE (punt_unknown))
                    {
                      b0->error = node->errors[UDP_ERROR_PUNT];
-                     next0 = UDP_LOCAL_NEXT_PUNT;
+                     next0 = udp_local_next_punt (is_ip4);
                    }
                  else if (is_ip4)
                    {
@@ -364,7 +369,7 @@ udp46_local_inline (vlib_main_t * vm,
          else
            {
              b0->error = node->errors[UDP_ERROR_LENGTH_ERROR];
-             next0 = UDP_LOCAL_NEXT_DROP;
+             next0 = udp_local_next_drop (is_ip4);
            }
 
        trace_x1: