aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordongjuan <dong.juan1@zte.com.cn>2017-09-15 10:21:07 +0800
committerdongjuan <dong.juan1@zte.com.cn>2017-09-15 10:21:07 +0800
commitd5b1b85d2e776718169f930f592af5184a18100a (patch)
treeb929244849c4cca78e8d06a1d2df32487fb5bd0e /src
parentf49921f73f4e1f0b67823be445aafeb9ff2333a6 (diff)
Modify return value of snat_out2in_lb(VPP-985)
in order to trace session_index Change-Id: I4433155fbe21635f8a997523e2c7900c6a7569af Signed-off-by: dongjuan <dong.juan1@zte.com.cn>
Diffstat (limited to 'src')
-rwxr-xr-x[-rw-r--r--]src/plugins/nat/in2out.c11
-rwxr-xr-x[-rw-r--r--]src/plugins/nat/out2in.c11
2 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index d0a13237b39..9196ccbb454 100644..100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -1370,7 +1370,7 @@ create_ses:
vnet_buffer(b)->sw_if_index[VLIB_TX] = sm->outside_fib_index;
}
-static void
+static snat_session_t *
snat_in2out_lb (snat_main_t *sm,
vlib_buffer_t * b,
ip4_header_t * ip,
@@ -1417,7 +1417,7 @@ snat_in2out_lb (snat_main_t *sm,
l_key.protocol = proto;
l_key.fib_index = rx_fib_index;
if (snat_static_mapping_match(sm, l_key, &e_key, 0, 0))
- return;
+ return 0;
u_key.addr = ip->src_address;
u_key.fib_index = rx_fib_index;
@@ -1515,6 +1515,7 @@ snat_in2out_lb (snat_main_t *sm,
s->last_heard = now;
s->total_pkts++;
s->total_bytes += vlib_buffer_length_in_chain (vm, b);
+ return s;
}
static inline uword
@@ -1677,7 +1678,7 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
{
if (is_slow_path)
{
- snat_in2out_lb(sm, b0, ip0, rx_fib_index0, thread_index,
+ s0 = snat_in2out_lb(sm, b0, ip0, rx_fib_index0, thread_index,
now, vm);
goto trace00;
}
@@ -1848,7 +1849,7 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
{
if (is_slow_path)
{
- snat_in2out_lb(sm, b1, ip1, rx_fib_index1, thread_index,
+ s1 = snat_in2out_lb(sm, b1, ip1, rx_fib_index1, thread_index,
now, vm);
goto trace01;
}
@@ -2056,7 +2057,7 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
{
if (is_slow_path)
{
- snat_in2out_lb(sm, b0, ip0, rx_fib_index0, thread_index,
+ s0 = snat_in2out_lb(sm, b0, ip0, rx_fib_index0, thread_index,
now, vm);
goto trace0;
}
diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c
index 55a750e4187..52adc8a8e08 100644..100755
--- a/src/plugins/nat/out2in.c
+++ b/src/plugins/nat/out2in.c
@@ -750,7 +750,7 @@ snat_out2in_unknown_proto (snat_main_t *sm,
s->per_user_index);
}
-static void
+static snat_session_t *
snat_out2in_lb (snat_main_t *sm,
vlib_buffer_t * b,
ip4_header_t * ip,
@@ -797,7 +797,7 @@ snat_out2in_lb (snat_main_t *sm,
e_key.protocol = proto;
e_key.fib_index = rx_fib_index;
if (snat_static_mapping_match(sm, e_key, &l_key, 1, 0))
- return;
+ return 0;
u_key.addr = l_key.addr;
u_key.fib_index = l_key.fib_index;
@@ -894,6 +894,7 @@ snat_out2in_lb (snat_main_t *sm,
s->last_heard = now;
s->total_pkts++;
s->total_bytes += vlib_buffer_length_in_chain (vm, b);
+ return s;
}
static uword
@@ -1044,7 +1045,7 @@ snat_out2in_node_fn (vlib_main_t * vm,
{
if (PREDICT_FALSE (value0.value == ~0ULL))
{
- snat_out2in_lb(sm, b0, ip0, rx_fib_index0, thread_index, now,
+ s0 = snat_out2in_lb(sm, b0, ip0, rx_fib_index0, thread_index, now,
vm);
goto trace0;
}
@@ -1195,7 +1196,7 @@ snat_out2in_node_fn (vlib_main_t * vm,
{
if (PREDICT_FALSE (value1.value == ~0ULL))
{
- snat_out2in_lb(sm, b1, ip1, rx_fib_index1, thread_index, now,
+ s1 = snat_out2in_lb(sm, b1, ip1, rx_fib_index1, thread_index, now,
vm);
goto trace1;
}
@@ -1383,7 +1384,7 @@ snat_out2in_node_fn (vlib_main_t * vm,
{
if (PREDICT_FALSE (value0.value == ~0ULL))
{
- snat_out2in_lb(sm, b0, ip0, rx_fib_index0, thread_index, now,
+ s0 = snat_out2in_lb(sm, b0, ip0, rx_fib_index0, thread_index, now,
vm);
goto trace00;
}