aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/wireguard/wireguard_if.c
diff options
context:
space:
mode:
authorArtem Glazychev <artem.glazychev@xored.com>2020-09-30 01:07:46 +0700
committerMatthew Smith <mgsmith@netgate.com>2020-09-30 00:16:53 +0000
commit124d5e02b31c47a78dba709699408b4e9d9e29f5 (patch)
treebece5cc08655ee432e0ca5fc149e8444ddcca204 /src/plugins/wireguard/wireguard_if.c
parente2c9f234e1a3a657595d61996e376cf799f0a54b (diff)
wireguard: fix udp-port registration
Type: fix Signed-off-by: Artem Glazychev <artem.glazychev@xored.com> Change-Id: I698ef299316004b797da1e74b64d067caac4bd2d
Diffstat (limited to 'src/plugins/wireguard/wireguard_if.c')
-rw-r--r--src/plugins/wireguard/wireguard_if.c7
1 files changed, 7 insertions, 0 deletions
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.
*/