summaryrefslogtreecommitdiffhomepage
path: root/src
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
commit0e4996e2c4fd414ef1554911a6401f353312829a (patch)
treeb5f2fc4ead2c73ffc74974ec208b8105b276f692 /src
parent003a4cad434fe216190a94f675b9c0a9e183cfeb (diff)
netlink: don't remove allowed ips for new peers
This causes needless traversal of the trie. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-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]),