aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/plugins/wireguard/test/test_wireguard.py6
-rw-r--r--src/plugins/wireguard/wireguard_if.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/wireguard/test/test_wireguard.py b/src/plugins/wireguard/test/test_wireguard.py
index cee1e938bb0..82ba2625498 100755
--- a/src/plugins/wireguard/test/test_wireguard.py
+++ b/src/plugins/wireguard/test/test_wireguard.py
@@ -488,7 +488,7 @@ class TestWg(VppTestCase):
wg_output_node_name = '/err/wg-output-tun/'
wg_input_node_name = '/err/wg-input/'
- port = 12323
+ port = 12333
# Create interfaces
wg0 = VppWgInterface(self,
@@ -602,7 +602,7 @@ class TestWg(VppTestCase):
def test_wg_multi_peer(self):
""" multiple peer setup """
- port = 12323
+ port = 12343
# Create interfaces
wg0 = VppWgInterface(self,
@@ -670,7 +670,7 @@ class WireguardHandoffTests(TestWg):
wg_output_node_name = '/err/wg-output-tun/'
wg_input_node_name = '/err/wg-input/'
- port = 12323
+ port = 12353
# Create interfaces
wg0 = VppWgInterface(self,
diff --git a/src/plugins/wireguard/wireguard_if.c b/src/plugins/wireguard/wireguard_if.c
index 46abdf6eb4d..3c59407e3b7 100644
--- a/src/plugins/wireguard/wireguard_if.c
+++ b/src/plugins/wireguard/wireguard_if.c
@@ -251,6 +251,13 @@ wg_if_create (u32 user_instance,
*sw_if_indexp = (u32) ~ 0;
/*
+ * Check if the required port is already in use
+ */
+ udp_dst_port_info_t *pi = udp_get_dst_port_info (&udp_main, port, UDP_IP4);
+ if (pi)
+ return VNET_API_ERROR_UDP_PORT_TAKEN;
+
+ /*
* Allocate a wg_if instance. Either select on dynamically
* or try to use the desired user_instance number.
*/