summaryrefslogtreecommitdiffhomepage
path: root/src/allowedips.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/allowedips.c')
-rw-r--r--src/allowedips.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/allowedips.c b/src/allowedips.c
index 293bb75..07b2a3c 100644
--- a/src/allowedips.c
+++ b/src/allowedips.c
@@ -279,11 +279,12 @@ void allowedips_init(struct allowedips *table)
void allowedips_free(struct allowedips *table, struct mutex *lock)
{
+ struct allowedips_node __rcu *old4 = table->root4, *old6 = table->root6;
++table->seq;
- free_root_node(table->root4, lock);
rcu_assign_pointer(table->root4, NULL);
- free_root_node(table->root6, lock);
rcu_assign_pointer(table->root6, NULL);
+ free_root_node(old4, lock);
+ free_root_node(old6, lock);
}
int allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip, u8 cidr, struct wireguard_peer *peer, struct mutex *lock)