aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/netlink.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/netlink.c b/src/netlink.c
index 18bebb8..cae88bd 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -480,6 +480,13 @@ static int wg_set_device(struct sk_buff *skb, struct genl_info *info)
rtnl_lock();
mutex_lock(&wg->device_update_lock);
+
+ ret = -EPERM;
+ if ((info->attrs[WGDEVICE_A_LISTEN_PORT] ||
+ info->attrs[WGDEVICE_A_FWMARK]) &&
+ !ns_capable(wg->creating_net->user_ns, CAP_NET_ADMIN))
+ goto out;
+
++wg->device_update_gen;
if (info->attrs[WGDEVICE_A_FWMARK]) {