summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vcl/test/test_vcl.py36
-rw-r--r--src/vnet/session/session_node.c7
-rw-r--r--src/vnet/udp/udp.c27
3 files changed, 61 insertions, 9 deletions
diff --git a/src/vcl/test/test_vcl.py b/src/vcl/test/test_vcl.py
index d9346ba77fa..d49bfbcaa35 100644
--- a/src/vcl/test/test_vcl.py
+++ b/src/vcl/test/test_vcl.py
@@ -646,6 +646,42 @@ class LDPThruHostStackIperf(VCLTestCase):
iperf3, self.client_iperf3_args)
+class LDPThruHostStackIperfUdp(VCLTestCase):
+ """ LDP Thru Host Stack Iperf UDP """
+
+ @classmethod
+ def setUpClass(cls):
+ super(LDPThruHostStackIperfUdp, cls).setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ super(LDPThruHostStackIperfUdp, cls).tearDownClass()
+
+ def setUp(self):
+ super(LDPThruHostStackIperfUdp, self).setUp()
+
+ self.thru_host_stack_setup()
+ self.client_iperf3_timeout = 20
+ self.client_iperf3_args = ["-V4d", "-t 2", "-u", "-l 1400",
+ "-c", self.loop0.local_ip4]
+ self.server_iperf3_args = ["-V4d", "-s"]
+
+ def tearDown(self):
+ self.thru_host_stack_tear_down()
+ super(LDPThruHostStackIperfUdp, self).tearDown()
+
+ def show_commands_at_teardown(self):
+ self.logger.debug(self.vapi.cli("show session verbose 2"))
+
+ @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
+ def test_ldp_thru_host_stack_iperf3_udp(self):
+ """ run LDP thru host stack iperf3 UDP test """
+
+ self.timeout = self.client_iperf3_timeout
+ self.thru_host_stack_test(iperf3, self.server_iperf3_args,
+ iperf3, self.client_iperf3_args)
+
+
class LDPIpv6CutThruTestCase(VCLTestCase):
""" LDP IPv6 Cut Thru Tests """
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 66300bc6024..7d727b7e008 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -50,6 +50,8 @@ session_mq_listen_handler (void *data)
clib_memset (a, 0, sizeof (*a));
a->sep.is_ip4 = mp->is_ip4;
clib_memcpy_fast (&a->sep.ip, &mp->ip, sizeof (mp->ip));
+ if (mp->is_ip4)
+ ip46_address_mask_ip4 (&a->sep.ip);
a->sep.port = mp->port;
a->sep.fib_index = mp->vrf;
a->sep.sw_if_index = ENDPOINT_INVALID_INDEX;
@@ -113,6 +115,11 @@ session_mq_connect_handler (void *data)
a->sep.transport_proto = mp->proto;
a->sep.peer.fib_index = mp->vrf;
clib_memcpy_fast (&a->sep.peer.ip, &mp->lcl_ip, sizeof (mp->lcl_ip));
+ if (mp->is_ip4)
+ {
+ ip46_address_mask_ip4 (&a->sep.ip);
+ ip46_address_mask_ip4 (&a->sep.peer.ip);
+ }
a->sep.peer.port = mp->lcl_port;
a->sep.peer.sw_if_index = ENDPOINT_INVALID_INDEX;
a->sep_ext.parent_handle = mp->parent_handle;
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 375e95bab58..ba1821a5026 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -132,15 +132,23 @@ udp_connection_free (udp_connection_t * uc)
pool_put (udp_main.connections[thread_index], uc);
}
-void
-udp_connection_delete (udp_connection_t * uc)
+static void
+udp_connection_cleanup (udp_connection_t * uc)
{
+ transport_endpoint_cleanup (TRANSPORT_PROTO_UDP, &uc->c_lcl_ip,
+ uc->c_lcl_port);
udp_connection_unregister_port (clib_net_to_host_u16 (uc->c_lcl_port),
uc->c_is_ip4);
- session_transport_delete_notify (&uc->connection);
udp_connection_free (uc);
}
+void
+udp_connection_delete (udp_connection_t * uc)
+{
+ session_transport_delete_notify (&uc->connection);
+ udp_connection_cleanup (uc);
+}
+
u32
udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
{
@@ -149,12 +157,14 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
transport_endpoint_cfg_t *lcl_ext;
udp_connection_t *listener;
udp_dst_port_info_t *pi;
+ u16 lcl_port_ho;
void *iface_ip;
- pi = udp_get_dst_port_info (um, clib_net_to_host_u16 (lcl->port),
- lcl->is_ip4);
+ lcl_port_ho = clib_net_to_host_u16 (lcl->port);
+ pi = udp_get_dst_port_info (um, lcl_port_ho, lcl->is_ip4);
- if (pi && !pi->n_connections)
+ if (pi && !pi->n_connections
+ && udp_is_valid_dst_port (lcl_port_ho, lcl->is_ip4))
{
clib_warning ("port already used");
return -1;
@@ -186,8 +196,7 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
listener->c_flags |= TRANSPORT_CONNECTION_F_CLESS;
clib_spinlock_init (&listener->rx_lock);
- udp_connection_register_port (vm, clib_net_to_host_u16 (lcl->port),
- lcl->is_ip4);
+ udp_connection_register_port (vm, lcl_port_ho, lcl->is_ip4);
return listener->c_c_index;
}
@@ -276,7 +285,7 @@ udp_session_cleanup (u32 connection_index, u32 thread_index)
udp_connection_t *uc;
uc = udp_connection_get (connection_index, thread_index);
if (uc)
- udp_connection_free (uc);
+ udp_connection_cleanup (uc);
}
u8 *