summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2015-09-11 08:54:54 +0000
committerdlg <dlg@openbsd.org>2015-09-11 08:54:54 +0000
commitdd93189c68e6d3e312e50c709d21485e120e0923 (patch)
treeb0a37063a22172bd7e178ec63260f80e9b155b65 /sys
parentUse explicit_bzero() when zeroing before free() (diff)
downloadwireguard-openbsd-dd93189c68e6d3e312e50c709d21485e120e0923.tar.xz
wireguard-openbsd-dd93189c68e6d3e312e50c709d21485e120e0923.zip
iterate over the new half of the if idx map rather than loop on the one
entry forever. this will fix hangs when you have more than 7 interfaces. ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 4f7987db59e..2c144af027a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.369 2015/09/10 18:11:05 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.370 2015/09/11 08:54:54 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -275,8 +275,10 @@ if_idxmap_insert(struct ifnet *ifp)
for (i = 0; i < if_map->limit; i++)
nmap[i] = map[i];
- while (i < nlimit)
+ while (i < nlimit) {
nmap[i] = NULL;
+ i++;
+ }
if_idxmap.map = nif_map;
free(if_map, M_IFADDR, sizeof(*nif_map) +