aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/in2out.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/in2out.c')
-rwxr-xr-xsrc/plugins/nat/in2out.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index dbbc67f9327..8e583313a1c 100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -523,11 +523,11 @@ snat_in2out_error_t icmp_get_key(ip4_header_t *ip0,
* @param e optional parameter
*/
u32 icmp_match_in2out_slow(snat_main_t *sm, vlib_node_runtime_t *node,
- u32 thread_index, vlib_buffer_t *b0, u8 *p_proto,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, u8 *p_proto,
snat_session_key_t *p_value,
u8 *p_dont_translate, void *d, void *e)
{
- ip4_header_t *ip0;
icmp46_header_t *icmp0;
u32 sw_if_index0;
u32 rx_fib_index0;
@@ -537,13 +537,7 @@ u32 icmp_match_in2out_slow(snat_main_t *sm, vlib_node_runtime_t *node,
clib_bihash_kv_8_8_t kv0, value0;
u32 next0 = ~0;
int err;
- u32 iph_offset0 = 0;
- if (PREDICT_FALSE(vnet_buffer(b0)->sw_if_index[VLIB_TX] != ~0))
- {
- iph_offset0 = vnet_buffer (b0)->ip.save_rewrite_length;
- }
- ip0 = (ip4_header_t *) ((u8 *) vlib_buffer_get_current (b0) + iph_offset0);
icmp0 = (icmp46_header_t *) ip4_next_header (ip0);
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
rx_fib_index0 = ip4_fib_table_get_index_for_sw_if_index (sw_if_index0);
@@ -622,11 +616,11 @@ out:
* @param e optional parameter
*/
u32 icmp_match_in2out_fast(snat_main_t *sm, vlib_node_runtime_t *node,
- u32 thread_index, vlib_buffer_t *b0, u8 *p_proto,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, u8 *p_proto,
snat_session_key_t *p_value,
u8 *p_dont_translate, void *d, void *e)
{
- ip4_header_t *ip0;
icmp46_header_t *icmp0;
u32 sw_if_index0;
u32 rx_fib_index0;
@@ -637,7 +631,6 @@ u32 icmp_match_in2out_fast(snat_main_t *sm, vlib_node_runtime_t *node,
u32 next0 = ~0;
int err;
- ip0 = vlib_buffer_get_current (b0);
icmp0 = (icmp46_header_t *) ip4_next_header (ip0);
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
rx_fib_index0 = ip4_fib_table_get_index_for_sw_if_index (sw_if_index0);
@@ -715,7 +708,7 @@ static inline u32 icmp_in2out (snat_main_t *sm,
echo0 = (icmp_echo_header_t *)(icmp0+1);
- next0_tmp = sm->icmp_match_in2out_cb(sm, node, thread_index, b0,
+ next0_tmp = sm->icmp_match_in2out_cb(sm, node, thread_index, b0, ip0,
&protocol, &sm0, &dont_translate, d, e);
if (next0_tmp != ~0)
next0 = next0_tmp;
@@ -2919,11 +2912,11 @@ VLIB_NODE_FUNCTION_MULTIARCH (snat_det_in2out_node, snat_det_in2out_node_fn);
* @param e optional parameter
*/
u32 icmp_match_in2out_det(snat_main_t *sm, vlib_node_runtime_t *node,
- u32 thread_index, vlib_buffer_t *b0, u8 *p_proto,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, u8 *p_proto,
snat_session_key_t *p_value,
u8 *p_dont_translate, void *d, void *e)
{
- ip4_header_t *ip0;
icmp46_header_t *icmp0;
u32 sw_if_index0;
u32 rx_fib_index0;
@@ -2942,7 +2935,6 @@ u32 icmp_match_in2out_det(snat_main_t *sm, vlib_node_runtime_t *node,
ip4_address_t in_addr;
u16 in_port;
- ip0 = vlib_buffer_get_current (b0);
icmp0 = (icmp46_header_t *) ip4_next_header (ip0);
echo0 = (icmp_echo_header_t *)(icmp0+1);
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];