summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2016-11-22 23:23:13 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2016-11-22 23:23:13 +0000
commit3f8834b6d2efc834f76c7ea7cfc4a80db075b12d (patch)
treea5d1e9d8576417cd9bf9b4c34083f39795d724d8
parent57390502005ad1cb099b2a79be4b33fa17c23d57 (diff)
Fix panic on detach hook when interfaces get destroyed.
ok reyk@
-rw-r--r--sys/net/if_switch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c
index c27edd1601c..e717b7885de 100644
--- a/sys/net/if_switch.c
+++ b/sys/net/if_switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_switch.c,v 1.14 2016/11/20 12:45:26 reyk Exp $ */
+/* $OpenBSD: if_switch.c,v 1.15 2016/11/22 23:23:12 rzalamena Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -625,10 +625,11 @@ void
switch_port_detach(void *arg)
{
struct ifnet *ifp = (struct ifnet *)arg;
- struct switch_softc *sc = ifp->if_softc;
+ struct switch_softc *sc;
struct switch_port *swpo;
swpo = (struct switch_port *)ifp->if_switchport;
+ sc = swpo->swpo_switch;
if (swpo->swpo_flags & IFBIF_LOCAL)
switch_port_unset_local(sc, swpo);