summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/out2in.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-03-07 08:04:32 -0800
committerOle Trøan <otroan@employees.org>2017-03-08 08:23:51 +0000
commit6f19c695583f9d7bd8b39f575e03f01d27e51f64 (patch)
treef8b7e210c34e7760cef0defc232e2353e94bd2a4 /src/plugins/snat/out2in.c
parenta0b34a74a916eff88f9a8354c78a2cf9798c8578 (diff)
CGN: fix outside port calculation and set buffer error (VPP-623)
Change-Id: I5143328b2da62ce4d6bb2915e2a51855696d87fc Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/snat/out2in.c')
-rw-r--r--src/plugins/snat/out2in.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/snat/out2in.c b/src/plugins/snat/out2in.c
index 9b4c73d779e..178aa560940 100644
--- a/src/plugins/snat/out2in.c
+++ b/src/plugins/snat/out2in.c
@@ -1081,6 +1081,7 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
clib_warning("unknown dst address: %U",
format_ip4_address, &ip0->dst_address);
next0 = SNAT_OUT2IN_NEXT_DROP;
+ b0->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION];
goto trace0;
}
@@ -1090,12 +1091,14 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
ses0 = snat_det_get_ses_by_out (dm0, &new_addr0, key0.as_u64);
if (PREDICT_FALSE(!ses0))
{
- clib_warning("no match src %U:%d dst %d for user %U",
- format_ip4_address, &ip0->dst_address,
+ clib_warning("no match src %U:%d dst %U:%d for user %U",
+ format_ip4_address, &ip0->src_address,
clib_net_to_host_u16 (tcp0->src),
+ format_ip4_address, &ip0->dst_address,
clib_net_to_host_u16 (tcp0->dst),
format_ip4_address, &new_addr0);
next0 = SNAT_OUT2IN_NEXT_DROP;
+ b0->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION];
goto trace0;
}
new_port0 = ses0->in_port;
@@ -1173,6 +1176,7 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
clib_warning("unknown dst address: %U",
format_ip4_address, &ip1->dst_address);
next1 = SNAT_OUT2IN_NEXT_DROP;
+ b1->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION];
goto trace1;
}
@@ -1182,12 +1186,14 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
ses1 = snat_det_get_ses_by_out (dm1, &new_addr1, key1.as_u64);
if (PREDICT_FALSE(!ses1))
{
- clib_warning("no match src %U:%d dst %d for user %U",
- format_ip4_address, &ip1->dst_address,
+ clib_warning("no match src %U:%d dst %U:%d for user %U",
+ format_ip4_address, &ip1->src_address,
clib_net_to_host_u16 (tcp1->src),
+ format_ip4_address, &ip1->dst_address,
clib_net_to_host_u16 (tcp1->dst),
format_ip4_address, &new_addr1);
next1 = SNAT_OUT2IN_NEXT_DROP;
+ b1->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION];
goto trace1;
}
new_port1 = ses1->in_port;
@@ -1296,6 +1302,7 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
clib_warning("unknown dst address: %U",
format_ip4_address, &ip0->dst_address);
next0 = SNAT_OUT2IN_NEXT_DROP;
+ b0->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION];
goto trace00;
}
@@ -1305,12 +1312,14 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
ses0 = snat_det_get_ses_by_out (dm0, &new_addr0, key0.as_u64);
if (PREDICT_FALSE(!ses0))
{
- clib_warning("no match src %U:%d dst %d for user %U",
- format_ip4_address, &ip0->dst_address,
+ clib_warning("no match src %U:%d dst %U:%d for user %U",
+ format_ip4_address, &ip0->src_address,
clib_net_to_host_u16 (tcp0->src),
+ format_ip4_address, &ip0->dst_address,
clib_net_to_host_u16 (tcp0->dst),
format_ip4_address, &new_addr0);
next0 = SNAT_OUT2IN_NEXT_DROP;
+ b0->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION];
goto trace00;
}
new_port0 = ses0->in_port;