From 0e4996e2c4fd414ef1554911a6401f353312829a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 25 Feb 2019 22:35:28 +0100 Subject: netlink: don't remove allowed ips for new peers This causes needless traversal of the trie. Signed-off-by: Jason A. Donenfeld --- src/netlink.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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]), -- cgit v1.2.3