aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorVijayabhaskar Katamreddy <vkatamre@cisco.com>2017-11-15 13:50:26 -0800
committerFlorin Coras <florin.coras@gmail.com>2017-12-15 15:58:46 +0000
commitce07412a54f06900b377a7f4966f6a26e19b8f2b (patch)
tree860d792f497e71e09c899b13bd744512c43a9563 /src/vnet/ip
parent0e789423bb0d447c9d0ef62e1379d01f78939b8a (diff)
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>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/icmp4.c4
-rw-r--r--src/vnet/ip/icmp6.c4
-rwxr-xr-xsrc/vnet/ip/ip4_forward.c4
-rw-r--r--src/vnet/ip/ip4_source_and_port_range_check.c8
-rw-r--r--src/vnet/ip/ip4_source_check.c8
-rw-r--r--src/vnet/ip/ip6_forward.c6
-rw-r--r--src/vnet/ip/ip6_hop_by_hop.c2
-rw-r--r--src/vnet/ip/ip6_neighbor.c8
-rw-r--r--src/vnet/ip/ip_frag.c25
-rw-r--r--src/vnet/ip/ip_input_acl.c4
-rwxr-xr-xsrc/vnet/ip/ping.c8
-rw-r--r--src/vnet/ip/punt.c10
12 files changed, 49 insertions, 42 deletions
diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c
index bbeab32b6a5..1fe01e48500 100644
--- a/src/vnet/ip/icmp4.c
+++ b/src/vnet/ip/icmp4.c
@@ -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",
},
diff --git a/src/vnet/ip/icmp6.c b/src/vnet/ip/icmp6.c
index 70696d0c6cb..ab871b3a969 100644
--- a/src/vnet/ip/icmp6.c
+++ b/src/vnet/ip/icmp6.c
@@ -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",
},
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 2f3f340264f..9c5775792b0 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -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",
},
};
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 d1f18dd6b26..06e6e7c6b63 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 @@ 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
*
diff --git a/src/vnet/ip/ip4_source_check.c b/src/vnet/ip/ip4_source_check.c
index 17a1cb1bdd6..25c51275920 100644
--- a/src/vnet/ip/ip4_source_check.c
+++ b/src/vnet/ip/ip4_source_check.c
@@ -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
*
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 67fedc949ac..29cd3ca8239 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -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",
},
};
diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c
index 14fbb392e19..90a4d21d3a6 100644
--- a/src/vnet/ip/ip6_hop_by_hop.c
+++ b/src/vnet/ip/ip6_hop_by_hop.c
@@ -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
{
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index d549ac37625..82b402ff263 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -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* */
diff --git a/src/vnet/ip/ip_frag.c b/src/vnet/ip/ip_frag.c
index ca062bfd5e8..2af697e96b6 100644
--- a/src/vnet/ip/ip_frag.c
+++ b/src/vnet/ip/ip_frag.c
@@ -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* */
diff --git a/src/vnet/ip/ip_input_acl.c b/src/vnet/ip/ip_input_acl.c
index 4d365a4437f..3c54fe8be2c 100644
--- a/src/vnet/ip/ip_input_acl.c
+++ b/src/vnet/ip/ip_input_acl.c
@@ -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* */
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index f438ce96060..a142754bdf7 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -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* */
diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c
index 568350cda82..b417427288c 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 @@ 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;