X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvnet%2Fipip%2Fnode.c;h=cd26b8a8b8563cc2afd37829b656693c0f06fa95;hp=6171d3e5d71cdb989cad3715a903d6cc948785a4;hb=9534696b4;hpb=282093f1fe783b5d36a014d4495995cd64e2e3fb diff --git a/src/vnet/ipip/node.c b/src/vnet/ipip/node.c index 6171d3e5d71..cd26b8a8b85 100644 --- a/src/vnet/ipip/node.c +++ b/src/vnet/ipip/node.c @@ -45,7 +45,7 @@ typedef struct 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 *); @@ -158,9 +158,33 @@ ipip_input (vlib_main_t * vm, vlib_node_runtime_t * node, 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 & IPIP_TUNNEL_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 & IPIP_TUNNEL_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) @@ -216,16 +240,14 @@ ipip_input (vlib_main_t * vm, vlib_node_runtime_t * node, 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); } @@ -238,7 +260,6 @@ static char *ipip_error_strings[] = { /* *INDENT-OFF* */ VLIB_REGISTER_NODE(ipip4_input_node) = { - .function = ipip4_input, .name = "ipip4-input", /* Takes a vector of packets. */ .vector_size = sizeof(u32), @@ -255,7 +276,6 @@ VLIB_REGISTER_NODE(ipip4_input_node) = { }; VLIB_REGISTER_NODE(ipip6_input_node) = { - .function = ipip6_input, .name = "ipip6-input", /* Takes a vector of packets. */ .vector_size = sizeof(u32), @@ -271,8 +291,6 @@ VLIB_REGISTER_NODE(ipip6_input_node) = { .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* */ /*