u8 is_ipv6;
} ipip_rx_trace_t;
-u8 *
+static u8 *
format_ipip_rx_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
ipip_main_t *gm = &ipip_main;
u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
u32 tunnel_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 len;
vnet_interface_main_t *im = &gm->vnet_main->interface_main;
if (is_ipv6)
{
ip60 = vlib_buffer_get_current (b0);
+ /* Check for outer fragmentation */
+ if (ip60->protocol == IP_PROTOCOL_IPV6_FRAGMENTATION)
+ {
+ next0 = IPIP_INPUT_NEXT_DROP;
+ b0->error = node->errors[IPIP_ERROR_FRAGMENTED_PACKET];
+ goto drop;
+ }
+
vlib_buffer_advance (b0, sizeof (*ip60));
ip_set (&src0, &ip60->src_address, false);
ip_set (&dst0, &ip60->dst_address, false);
else
{
ip40 = vlib_buffer_get_current (b0);
+ /* Check for outer fragmentation */
+ if (ip40->flags_and_fragment_offset &
+ clib_host_to_net_u16 (IP4_HEADER_FLAG_MORE_FRAGMENTS))
+ {
+ next0 = IPIP_INPUT_NEXT_DROP;
+ b0->error = node->errors[IPIP_ERROR_FRAGMENTED_PACKET];
+ goto drop;
+ }
vlib_buffer_advance (b0, sizeof (*ip40));
ip_set (&src0, &ip40->src_address, true);
ip_set (&dst0, &ip40->dst_address, true);
vnet_buffer (b0)->sw_if_index[VLIB_RX] = tunnel_sw_if_index;
if (inner_protocol0 == IP_PROTOCOL_IPV6)
- next0 = IPIP_INPUT_NEXT_IP6_INPUT;
+ {
+ next0 = IPIP_INPUT_NEXT_IP6_INPUT;
+
+ if (t0->flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
+ {
+ if (is_ipv6)
+ ip6_set_ecn_network_order ((ip60 + 1),
+ ip6_ecn_network_order (ip60));
+ else
+ ip6_set_ecn_network_order ((ip6_header_t *) (ip40 + 1),
+ ip4_header_get_ecn (ip40));
+ }
+ }
else if (inner_protocol0 == IP_PROTOCOL_IP_IN_IP)
- next0 = IPIP_INPUT_NEXT_IP4_INPUT;
+ {
+ next0 = IPIP_INPUT_NEXT_IP4_INPUT;
+ if (t0->flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
+ {
+ if (is_ipv6)
+ ip4_header_set_ecn_w_chksum ((ip4_header_t *) (ip60 + 1),
+ ip6_ecn_network_order
+ (ip60));
+ else
+ ip4_header_set_ecn_w_chksum (ip40 + 1,
+ ip4_header_get_ecn (ip40));
+ }
+ }
if (!is_ipv6 && t0->mode == IPIP_MODE_6RD
&& t0->sixrd.security_check)
return from_frame->n_vectors;
}
-static uword
-ipip4_input (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+VLIB_NODE_FN (ipip4_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return ipip_input (vm, node, from_frame, /* is_ip6 */ false);
}
-static uword
-ipip6_input (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+VLIB_NODE_FN (ipip6_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return ipip_input (vm, node, from_frame, /* is_ip6 */ true);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE(ipip4_input_node) = {
- .function = ipip4_input,
.name = "ipip4-input",
/* Takes a vector of packets. */
.vector_size = sizeof(u32),
};
VLIB_REGISTER_NODE(ipip6_input_node) = {
- .function = ipip6_input,
.name = "ipip6-input",
/* Takes a vector of packets. */
.vector_size = sizeof(u32),
.format_trace = format_ipip_rx_trace,
};
-VLIB_NODE_FUNCTION_MULTIARCH(ipip4_input_node, ipip4_input)
-VLIB_NODE_FUNCTION_MULTIARCH(ipip6_input_node, ipip6_input)
/* *INDENT-ON* */
/*