cc = cnat_client_ip6_find (&ip6->dst_address); /* TODO: same as above */
}
+ /* Wrong session key */
if (session->key.cs_proto == 0)
goto trace;
udp0 = (udp_header_t *) (ip6 + 1);
}
+ /* Wrong session key */
if (session->key.cs_proto == 0)
goto trace;
vnet_feature_next (&arc_next0, b);
next0 = arc_next0;
- if (iproto != IP_PROTOCOL_UDP && iproto != IP_PROTOCOL_TCP
- && iproto != IP_PROTOCOL_ICMP && iproto != IP_PROTOCOL_ICMP6)
- {
- /* Dont translate */
- goto trace;
- }
+ /* Wrong session key */
+ if (session->key.cs_proto == 0)
+ goto trace;
if (!session_not_found)
{
a VIP) */
if (AF_IP4 == ctx->af)
{
+ if (!(cm->snat_ip4.ce_flags & CNAT_EP_FLAG_RESOLVED))
+ goto trace;
ip46_address_set_ip4 (&session->value.cs_ip[VLIB_RX],
&ip_addr_v4 (&cm->snat_ip4.ce_ip));
ip46_address_set_ip4 (&session->value.cs_ip[VLIB_TX],
}
else
{
+ if (!(cm->snat_ip6.ce_flags & CNAT_EP_FLAG_RESOLVED))
+ goto trace;
ip46_address_set_ip6 (&session->value.cs_ip[VLIB_RX],
&ip_addr_v6 (&cm->snat_ip6.ce_ip));
ip46_address_set_ip6 (&session->value.cs_ip[VLIB_TX],
cc = cnat_client_get (vnet_buffer (b)->ip.adj_index[VLIB_TX]);
- if (iproto != IP_PROTOCOL_UDP && iproto != IP_PROTOCOL_TCP
- && iproto != IP_PROTOCOL_ICMP && iproto != IP_PROTOCOL_ICMP6)
+ /* Wrong session key */
+ if (session->key.cs_proto == 0)
{
/* Dont translate & follow the fib programming */
next0 = cc->cc_parent.dpoi_next_node;
class TestCNatSourceNAT(VppTestCase):
""" CNat Source NAT """
extra_vpp_punt_config = ["cnat", "{",
+ "session-cleanup-timeout", "0.1",
"session-max-age", "1",
- "tcp-max-age", "1", "}"]
+ "tcp-max-age", "1",
+ "scanner", "off", "}"]
@classmethod
def setUpClass(cls):
self.pg1.configure_ipv4_neighbors()
self.pg1.configure_ipv6_neighbors()
- self.vapi.cli("test cnat scanner off")
self.vapi.cnat_set_snat_addresses(
snat_ip4=self.pg2.remote_hosts[0].ip4,
- snat_ip6=self.pg2.remote_hosts[0].ip6)
+ snat_ip6=self.pg2.remote_hosts[0].ip6,
+ sw_if_index=INVALID_INDEX)
self.vapi.feature_enable_disable(
enable=1,
arc_name="ip6-unicast",
self.pg0.sw_if_index, 1, True))
self.config_ips([1], is_add=0, is_v6=False)
self.config_ips([1], is_add=0, is_v6=True)
+ self.vapi.cnat_set_snat_addresses(sw_if_index=INVALID_INDEX)
if __name__ == '__main__':