summaryrefslogtreecommitdiff
path: root/sys/net/if_trunk.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-06-20 12:03:41 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-06-20 12:03:41 +0000
commitc15d8852aa3337e78fbcc20cb4a51385e1cba4c0 (patch)
treebd2ecb37c6c503bdb2278f929290f5360d27b611 /sys/net/if_trunk.c
parentbb4310ae8425f0b8f24cd6eeb87a6738fec8777a (diff)
Revert previous and unbreak asr, the new include should be protected.
Reported by naddy@
Diffstat (limited to 'sys/net/if_trunk.c')
-rw-r--r--sys/net/if_trunk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index 6162da4ab78..8ef7749286b 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.83 2013/06/20 09:38:24 mpi Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.84 2013/06/20 12:03:40 mpi Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -381,8 +381,9 @@ trunk_port_create(struct trunk_softc *tr, struct ifnet *ifp)
trunk_ether_cmdmulti(tp, SIOCADDMULTI);
/* Register callback for physical link state changes */
- tp->lh_cookie = hook_establish(&ifp->if_linkstatehooks, 1,
- trunk_port_state, tp);
+ if (ifp->if_linkstatehooks != NULL)
+ tp->lh_cookie = hook_establish(ifp->if_linkstatehooks, 1,
+ trunk_port_state, tp);
if (tr->tr_port_create != NULL)
error = (*tr->tr_port_create)(tp);
@@ -432,7 +433,8 @@ trunk_port_destroy(struct trunk_port *tp)
ifp->if_ioctl = tp->tp_ioctl;
ifp->if_tp = NULL;
- hook_disestablish(&ifp->if_linkstatehooks, tp->lh_cookie);
+ if (ifp->if_linkstatehooks != NULL)
+ hook_disestablish(ifp->if_linkstatehooks, tp->lh_cookie);
/* Finally, remove the port from the trunk */
SLIST_REMOVE(&tr->tr_ports, tp, trunk_port, tp_entries);