From c15d8852aa3337e78fbcc20cb4a51385e1cba4c0 Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Thu, 20 Jun 2013 12:03:41 +0000 Subject: Revert previous and unbreak asr, the new include should be protected. Reported by naddy@ --- sys/net/if_trunk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/net/if_trunk.c') 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 @@ -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); -- cgit v1.2.3