summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/snat_api.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-07-06 05:37:49 -0700
committerOle Trøan <otroan@employees.org>2017-07-07 07:04:42 +0000
commit7968e6cad5fac28568162945e2e57556740013fd (patch)
treee379568214b125982ff3348d4943c1ac5cab8832 /src/plugins/snat/snat_api.c
parent7b749fe890a4acb23431148859c25643a3597d2a (diff)
SNAT: Fallback to 3-tuple key for non TCP/UDP sessions (VPP-884)
Change-Id: I4868ff6e81c579b29d3ea066976ae145f8b83e9e Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/snat/snat_api.c')
-rw-r--r--src/plugins/snat/snat_api.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/snat/snat_api.c b/src/plugins/snat/snat_api.c
index 638f576c354..237b080dd67 100644
--- a/src/plugins/snat/snat_api.c
+++ b/src/plugins/snat/snat_api.c
@@ -732,15 +732,24 @@ static void
ntohs (VL_API_SNAT_USER_SESSION_DETAILS + sm->msg_id_base);
rmp->is_ip4 = 1;
clib_memcpy (rmp->outside_ip_address, (&s->out2in.addr), 4);
- rmp->outside_port = s->out2in.port;
clib_memcpy (rmp->inside_ip_address, (&s->in2out.addr), 4);
- rmp->inside_port = s->in2out.port;
- rmp->protocol = ntohs (snat_proto_to_ip_proto (s->in2out.protocol));
rmp->is_static = s->flags & SNAT_SESSION_FLAG_STATIC_MAPPING ? 1 : 0;
rmp->last_heard = clib_host_to_net_u64 ((u64) s->last_heard);
rmp->total_bytes = clib_host_to_net_u64 (s->total_bytes);
rmp->total_pkts = ntohl (s->total_pkts);
rmp->context = context;
+ if (snat_is_unk_proto_session (s))
+ {
+ rmp->outside_port = 0;
+ rmp->inside_port = 0;
+ rmp->protocol = ntohs (s->in2out.port);
+ }
+ else
+ {
+ rmp->outside_port = s->out2in.port;
+ rmp->inside_port = s->in2out.port;
+ rmp->protocol = ntohs (snat_proto_to_ip_proto (s->in2out.protocol));
+ }
vl_msg_api_send_shmem (q, (u8 *) & rmp);
}