diff options
Diffstat (limited to 'src/plugins/nat/out2in.c')
-rwxr-xr-x | src/plugins/nat/out2in.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c index 61719c73081..94679fb402c 100755 --- a/src/plugins/nat/out2in.c +++ b/src/plugins/nat/out2in.c @@ -278,7 +278,7 @@ static_always_inline if (!icmp_type_is_error_message (vnet_buffer (b)->ip.reass.icmp_type_or_tcp_flags)) { - key0.protocol = SNAT_PROTOCOL_ICMP; + key0.protocol = NAT_PROTOCOL_ICMP; key0.addr = ip0->dst_address; key0.port = vnet_buffer (b)->ip.reass.l4_src_port; // TODO should this be dst port? } @@ -286,17 +286,17 @@ static_always_inline { inner_ip0 = (ip4_header_t *) (echo0 + 1); l4_header = ip4_next_header (inner_ip0); - key0.protocol = ip_proto_to_snat_proto (inner_ip0->protocol); + key0.protocol = ip_proto_to_nat_proto (inner_ip0->protocol); key0.addr = inner_ip0->src_address; switch (key0.protocol) { - case SNAT_PROTOCOL_ICMP: + case NAT_PROTOCOL_ICMP: inner_icmp0 = (icmp46_header_t *) l4_header; inner_echo0 = (icmp_echo_header_t *) (inner_icmp0 + 1); key0.port = inner_echo0->identifier; break; - case SNAT_PROTOCOL_UDP: - case SNAT_PROTOCOL_TCP: + case NAT_PROTOCOL_UDP: + case NAT_PROTOCOL_TCP: key0.port = ((tcp_udp_header_t *) l4_header)->src_port; break; default: @@ -624,7 +624,7 @@ icmp_out2in (snat_main_t * sm, switch (protocol) { - case SNAT_PROTOCOL_ICMP: + case NAT_PROTOCOL_ICMP: inner_icmp0 = (icmp46_header_t *) l4_header; inner_echo0 = (icmp_echo_header_t *) (inner_icmp0 + 1); @@ -638,8 +638,8 @@ icmp_out2in (snat_main_t * sm, identifier); icmp0->checksum = ip_csum_fold (sum0); break; - case SNAT_PROTOCOL_UDP: - case SNAT_PROTOCOL_TCP: + case NAT_PROTOCOL_UDP: + case NAT_PROTOCOL_TCP: old_id0 = ((tcp_udp_header_t *) l4_header)->src_port; new_id0 = sm0.port; ((tcp_udp_header_t *) l4_header)->src_port = new_id0; @@ -813,9 +813,9 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, goto trace0; } - proto0 = ip_proto_to_snat_proto (ip0->protocol); + proto0 = ip_proto_to_nat_proto (ip0->protocol); - if (PREDICT_FALSE (proto0 == ~0)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_OTHER)) { if (nat_out2in_sm_unknown_proto (sm, b0, ip0, rx_fib_index0)) { @@ -830,7 +830,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, goto trace0; } - if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP)) { next0 = icmp_out2in_slow_path (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node, @@ -859,7 +859,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, * be able to use dhcp client on the outside interface */ if (PREDICT_FALSE - (proto0 == SNAT_PROTOCOL_UDP + (proto0 == NAT_PROTOCOL_UDP && (vnet_buffer (b0)->ip.reass.l4_dst_port == clib_host_to_net_u16 (UDP_DST_PORT_dhcp_to_client)))) @@ -903,7 +903,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, dst_address /* changed member */ ); ip0->checksum = ip_csum_fold (sum0); - if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP)) + if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP)) { if (!vnet_buffer (b0)->ip.reass.is_non_first_fragment) { @@ -985,9 +985,9 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, goto trace1; } - proto1 = ip_proto_to_snat_proto (ip1->protocol); + proto1 = ip_proto_to_nat_proto (ip1->protocol); - if (PREDICT_FALSE (proto1 == ~0)) + if (PREDICT_FALSE (proto1 == NAT_PROTOCOL_OTHER)) { if (nat_out2in_sm_unknown_proto (sm, b1, ip1, rx_fib_index1)) { @@ -1002,7 +1002,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, goto trace1; } - if (PREDICT_FALSE (proto1 == SNAT_PROTOCOL_ICMP)) + if (PREDICT_FALSE (proto1 == NAT_PROTOCOL_ICMP)) { next1 = icmp_out2in_slow_path (sm, b1, ip1, icmp1, sw_if_index1, rx_fib_index1, node, @@ -1031,7 +1031,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, * be able to use dhcp client on the outside interface */ if (PREDICT_FALSE - (proto1 == SNAT_PROTOCOL_UDP + (proto1 == NAT_PROTOCOL_UDP && (vnet_buffer (b1)->ip.reass.l4_dst_port == clib_host_to_net_u16 (UDP_DST_PORT_dhcp_to_client)))) @@ -1077,7 +1077,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, dst_address /* changed member */ ); ip1->checksum = ip_csum_fold (sum1); - if (PREDICT_TRUE (proto1 == SNAT_PROTOCOL_TCP)) + if (PREDICT_TRUE (proto1 == NAT_PROTOCOL_TCP)) { if (!vnet_buffer (b1)->ip.reass.is_non_first_fragment) { @@ -1190,9 +1190,9 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, rx_fib_index0 = vec_elt (sm->ip4_main->fib_index_by_sw_if_index, sw_if_index0); - proto0 = ip_proto_to_snat_proto (ip0->protocol); + proto0 = ip_proto_to_nat_proto (ip0->protocol); - if (PREDICT_FALSE (proto0 == ~0)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_OTHER)) { if (nat_out2in_sm_unknown_proto (sm, b0, ip0, rx_fib_index0)) { @@ -1217,7 +1217,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, goto trace00; } - if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP)) { next0 = icmp_out2in_slow_path (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node, @@ -1246,7 +1246,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, * be able to use dhcp client on the outside interface */ if (PREDICT_FALSE - (proto0 == SNAT_PROTOCOL_UDP + (proto0 == NAT_PROTOCOL_UDP && (vnet_buffer (b0)->ip.reass.l4_dst_port == clib_host_to_net_u16 (UDP_DST_PORT_dhcp_to_client)))) @@ -1292,7 +1292,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm, dst_address /* changed member */ ); ip0->checksum = ip_csum_fold (sum0); - if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP)) + if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP)) { if (!vnet_buffer (b0)->ip.reass.is_non_first_fragment) { @@ -1472,12 +1472,12 @@ VLIB_NODE_FN (snat_out2in_fast_node) (vlib_main_t * vm, goto trace00; } - proto0 = ip_proto_to_snat_proto (ip0->protocol); + proto0 = ip_proto_to_nat_proto (ip0->protocol); - if (PREDICT_FALSE (proto0 == ~0)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_OTHER)) goto trace00; - if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP)) + if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP)) { next0 = icmp_out2in (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node, next0, ~0, 0, 0); @@ -1511,7 +1511,7 @@ VLIB_NODE_FN (snat_out2in_fast_node) (vlib_main_t * vm, old_port0 = udp0->dst_port; udp0->dst_port = new_port0; - if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP)) + if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP)) { sum0 = tcp0->checksum; sum0 = ip_csum_update (sum0, old_addr0, new_addr0, @@ -1536,7 +1536,7 @@ VLIB_NODE_FN (snat_out2in_fast_node) (vlib_main_t * vm, } else { - if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP)) + if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP)) { sum0 = tcp0->checksum; sum0 = ip_csum_update (sum0, old_addr0, new_addr0, |