X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat.c;h=0d909cedbf4c3d6a241187b17f457d8a6d285be7;hb=1d1985de91833a5483a6b7ee96ef4090d530a7a6;hp=43ef325d5918ccba626f627405939b49aa85655d;hpb=26e035bfcda580a8ce06df7498ca30e0a39b45ef;p=vpp.git diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c index 43ef325d591..0d909cedbf4 100755 --- a/src/plugins/nat/nat.c +++ b/src/plugins/nat/nat.c @@ -171,7 +171,7 @@ VNET_FEATURE_INIT (ip4_nat44_ed_hairpinning, static) = VLIB_PLUGIN_REGISTER () = { .version = VPP_BUILD_VER, - .description = "Network Address Translation", + .description = "Network Address Translation (NAT)", }; /* *INDENT-ON* */ @@ -188,11 +188,20 @@ nat_free_session_data (snat_main_t * sm, snat_session_t * s, u32 thread_index, if (is_fwd_bypass_session (s)) { + if (snat_is_unk_proto_session (s)) + { + ed_key.proto = s->in2out.port; + ed_key.r_port = 0; + ed_key.l_port = 0; + } + else + { + ed_key.proto = snat_proto_to_ip_proto (s->in2out.protocol); + ed_key.l_port = s->in2out.port; + ed_key.r_port = s->ext_host_port; + } ed_key.l_addr = s->in2out.addr; ed_key.r_addr = s->ext_host_addr; - ed_key.l_port = s->in2out.port; - ed_key.r_port = s->ext_host_port; - ed_key.proto = snat_proto_to_ip_proto (s->in2out.protocol); ed_key.fib_index = 0; ed_kv.key[0] = ed_key.as_u64[0]; ed_kv.key[1] = ed_key.as_u64[1]; @@ -713,7 +722,7 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr, if (!addr_only) { - if (rp->l_port != l_port || rp->e_port != e_port + if ((rp->l_port != l_port && rp->e_port != e_port) || rp->proto != proto) continue; }