diff options
author | 2019-11-07 07:36:31 +0000 | |
---|---|---|
committer | 2019-11-07 07:36:31 +0000 | |
commit | 4f5e51a4e9a138283295ab8b7f236f90bf0f58ce (patch) | |
tree | e8f67f65e4d04bf88cb83ad12c28409ae28f84d8 /sys/net/if_bpe.c | |
parent | Add -F flag to send-keys to expand formats in search-backward and (diff) | |
download | wireguard-openbsd-4f5e51a4e9a138283295ab8b7f236f90bf0f58ce.tar.xz wireguard-openbsd-4f5e51a4e9a138283295ab8b7f236f90bf0f58ce.zip |
turn the linkstate hooks into a task list, like the detach hooks.
this is largely mechanical, except for carp. this moves the addition
of the carp link state hook after we're committed to using the new
interface as a carpdev. because the add can't fail, we avoid a
complicated unwind dance. also, this tweaks the carp linkstate hook
so it only updates the relevant carp interface, not all of the
carpdevs on the parent.
hrvoje popovski has tested an early version of this diff and it's
generally ok, but there's some splasserts that this diff fires that
i'll fix in an upcoming diff.
ok claudio@
Diffstat (limited to 'sys/net/if_bpe.c')
-rw-r--r-- | sys/net/if_bpe.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/net/if_bpe.c b/sys/net/if_bpe.c index 5ad9a41b684..b9a88be8efa 100644 --- a/sys/net/if_bpe.c +++ b/sys/net/if_bpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bpe.c,v 1.9 2019/11/06 03:51:26 dlg Exp $ */ +/* $OpenBSD: if_bpe.c,v 1.10 2019/11/07 07:36:31 dlg Exp $ */ /* * Copyright (c) 2018 David Gwynne <dlg@openbsd.org> * @@ -102,7 +102,7 @@ struct bpe_softc { int sc_rxhprio; uint8_t sc_group[ETHER_ADDR_LEN]; - void * sc_lh_cookie; + struct task sc_ltask; struct task sc_dtask; struct bpe_map sc_bridge_map; @@ -174,6 +174,7 @@ bpe_clone_create(struct if_clone *ifc, int unit) sc->sc_txhprio = IF_HDRPRIO_PACKET; sc->sc_rxhprio = IF_HDRPRIO_OUTER; + task_set(&sc->sc_ltask, bpe_link_hook, sc); task_set(&sc->sc_dtask, bpe_detach_hook, sc); rw_init(&sc->sc_bridge_lock, "bpebr"); @@ -634,8 +635,7 @@ bpe_up(struct bpe_softc *sc) } /* Register callback for physical link state changes */ - sc->sc_lh_cookie = hook_establish(ifp0->if_linkstatehooks, 1, - bpe_link_hook, sc); + if_linkstatehook_add(ifp0, &sc->sc_ltask); /* Register callback if parent wants to unregister */ if_detachhook_add(ifp0, &sc->sc_dtask); @@ -676,7 +676,7 @@ bpe_down(struct bpe_softc *sc) ifp0 = if_get(sc->sc_key.k_if); if (ifp0 != NULL) { if_detachhook_del(ifp0, &sc->sc_dtask); - hook_disestablish(ifp0->if_linkstatehooks, sc->sc_lh_cookie); + if_linkstatehook_del(ifp0, &sc->sc_ltask); bpe_multi(sc, ifp0, SIOCDELMULTI); } if_put(ifp0); |