summaryrefslogtreecommitdiff
path: root/sys/net/if_sl.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2003-12-13 10:01:17 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2003-12-13 10:01:17 +0000
commiteb44ab8f06e509496e0fac097e6075641ace5524 (patch)
treee2b49f6fcad0815f99be2bb89c51f57d8d874b86 /sys/net/if_sl.c
parent1e9a3e001c114ae01cfe4b27637c6fb261e2ef68 (diff)
initial support ifconfig destroy; ok deraadt@
Diffstat (limited to 'sys/net/if_sl.c')
-rw-r--r--sys/net/if_sl.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 604cfc7939d..7cd01bbb346 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sl.c,v 1.24 2003/12/12 12:54:57 hshoexer Exp $ */
+/* $OpenBSD: if_sl.c,v 1.25 2003/12/13 10:01:16 markus Exp $ */
/* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */
/*
@@ -184,10 +184,11 @@ static int slinit(struct sl_softc *);
static struct mbuf *sl_btom(struct sl_softc *, int);
int sl_clone_create(struct if_clone *, int);
+void sl_clone_destroy(struct ifnet *);
LIST_HEAD(, sl_softc) sl_softc_list;
struct if_clone sl_cloner =
- IF_CLONE_INITIALIZER("sl", sl_clone_create, NULL);
+ IF_CLONE_INITIALIZER("sl", sl_clone_create, sl_clone_destroy);
/*
* Called from boot code to establish sl interfaces.
@@ -238,6 +239,28 @@ sl_clone_create(ifc, unit)
return (0);
}
+void
+sl_clone_destroy(ifp)
+ struct ifnet *ifp;
+{
+ struct sl_softc *sc = ifp->if_softc;
+ int s;
+
+ if (sc->sc_ttyp != NULL)
+ return;
+
+ s = splimp();
+ LIST_REMOVE(sc, sc_list);
+ splx(s);
+
+#if NBPFILTER > 0
+ bpfdetach(ifp);
+#endif
+ if_detach(ifp);
+
+ free(sc, M_DEVBUF);
+}
+
static int
slinit(sc)
struct sl_softc *sc;