summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-11-11 05:20:54 +0000
committerdlg <dlg@openbsd.org>2019-11-11 05:20:54 +0000
commit69884bb75911677266cee03686514e737367fd9f (patch)
treebabb5f2c256f5733162a297c59722e635d033eb3 /sys/net/if.c
parentmove /usr and var remounting (nfs diskless case...) earlier, so that (diff)
downloadwireguard-openbsd-69884bb75911677266cee03686514e737367fd9f.tar.xz
wireguard-openbsd-69884bb75911677266cee03686514e737367fd9f.zip
add linkstate hooks at the head of the tailq.
when vxlans parent interface has a link state change event, vxlan reconfigures the parent to cope with things not being as it expects when the interface comes back. it does this by removing its config and then adding it again. part of it's config removal is to take the link state hook away, and part of putting the config on is is adding the link state hook. if we're running an interfaces link state hooks from head to tail, and the vxlan hook adds itself back to the tail, we end up running the vxlan hook forever cos it always ends up at the tail. bluhm@ hit this infinite loop while running regress tests. if turns out we need to run link state hooks in the same order they were added, i have a way to avoid this situation, but this is simple.
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 2ce4ea964e8..c27988b3f17 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.593 2019/11/09 09:45:25 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.594 2019/11/11 05:20:54 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1686,7 +1686,7 @@ void
if_linkstatehook_add(struct ifnet *ifp, struct task *t)
{
mtx_enter(&if_hooks_mtx);
- TAILQ_INSERT_TAIL(&ifp->if_linkstatehooks, t, t_entry);
+ TAILQ_INSERT_HEAD(&ifp->if_linkstatehooks, t, t_entry);
mtx_leave(&if_hooks_mtx);
}