aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-25 22:35:28 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-25 22:35:28 +0100
commit85a2dd8b6347233bd9f0056448d35fd2b9d03c40 (patch)
treee39e3ecd2a65263a3a0ddb597865fcc3ebb5ff56
parentMakefile: make the depmod path configurable (diff)
downloadwireguard-monolithic-historical-85a2dd8b6347233bd9f0056448d35fd2b9d03c40.tar.xz
wireguard-monolithic-historical-85a2dd8b6347233bd9f0056448d35fd2b9d03c40.zip
netlink: don't remove allowed ips for new peers
This causes needless traversal of the trie.
-rw-r--r--src/netlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/netlink.c b/src/netlink.c
index 9a33192..f44f211 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -375,6 +375,9 @@ static int set_peer(struct wg_device *wg, struct nlattr **attrs)
if (flags & WGPEER_F_REMOVE_ME)
goto out; /* Tried to remove a non-existing peer. */
+ /* The peer is new, so there aren't allowed IPs to remove. */
+ flags &= ~WGPEER_F_REPLACE_ALLOWEDIPS;
+
down_read(&wg->static_identity.lock);
if (wg->static_identity.has_identity &&
!memcmp(nla_data(attrs[WGPEER_A_PUBLIC_KEY]),