Don't forget to call bpfdetach in the clone destroy function.

While here, add a missing static and change some spaces to tabs.
This commit is contained in:
peter 2004-12-05 15:00:47 +00:00
parent 8194ddc3a5
commit cf47c76c1b
3 changed files with 36 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ppp.c,v 1.93 2004/12/05 13:32:03 he Exp $ */ /* $NetBSD: if_ppp.c,v 1.94 2004/12/05 15:00:47 peter Exp $ */
/* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */ /* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */
/* /*
@ -102,7 +102,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.93 2004/12/05 13:32:03 he Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.94 2004/12/05 15:00:47 peter Exp $");
#include "ppp.h" #include "ppp.h"
@ -336,6 +336,9 @@ ppp_clone_destroy(struct ifnet *ifp)
LIST_REMOVE(sc, sc_iflist); LIST_REMOVE(sc, sc_iflist);
simple_unlock(&ppp_list_mutex); simple_unlock(&ppp_list_mutex);
#if NBPFILTER > 0
bpfdetach(ifp);
#endif
if_detach(ifp); if_detach(ifp);
FREE(sc, M_DEVBUF); FREE(sc, M_DEVBUF);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sl.c,v 1.88 2004/12/05 14:56:50 he Exp $ */ /* $NetBSD: if_sl.c,v 1.89 2004/12/05 15:00:47 peter Exp $ */
/* /*
* Copyright (c) 1987, 1989, 1992, 1993 * Copyright (c) 1987, 1989, 1992, 1993
@ -60,7 +60,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.88 2004/12/05 14:56:50 he Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.89 2004/12/05 15:00:47 peter Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "bpfilter.h" #include "bpfilter.h"
@ -197,11 +197,11 @@ static struct mbuf *sl_btom __P((struct sl_softc *, int));
void void
slattach(void) slattach(void)
{ {
LIST_INIT(&sl_softc_list); LIST_INIT(&sl_softc_list);
if_clone_attach(&sl_cloner); if_clone_attach(&sl_cloner);
} }
int static int
sl_clone_create(struct if_clone *ifc, int unit) sl_clone_create(struct if_clone *ifc, int unit)
{ {
struct sl_softc *sc; struct sl_softc *sc;
@ -212,8 +212,7 @@ sl_clone_create(struct if_clone *ifc, int unit)
"%s%d", ifc->ifc_name, unit); "%s%d", ifc->ifc_name, unit);
sc->sc_if.if_softc = sc; sc->sc_if.if_softc = sc;
sc->sc_if.if_mtu = SLMTU; sc->sc_if.if_mtu = SLMTU;
sc->sc_if.if_flags = sc->sc_if.if_flags = IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST;
IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST;
sc->sc_if.if_type = IFT_SLIP; sc->sc_if.if_type = IFT_SLIP;
sc->sc_if.if_ioctl = slioctl; sc->sc_if.if_ioctl = slioctl;
sc->sc_if.if_output = sloutput; sc->sc_if.if_output = sloutput;
@ -232,17 +231,20 @@ sl_clone_create(struct if_clone *ifc, int unit)
static int static int
sl_clone_destroy(struct ifnet *ifp) sl_clone_destroy(struct ifnet *ifp)
{ {
struct sl_softc *sc = (struct sl_softc *)ifp->if_softc; struct sl_softc *sc = (struct sl_softc *)ifp->if_softc;
if (sc->sc_ttyp != NULL) if (sc->sc_ttyp != NULL)
return EBUSY; /* Not removing it */ return EBUSY; /* Not removing it */
LIST_REMOVE(sc, sc_iflist); LIST_REMOVE(sc, sc_iflist);
if_detach(ifp); #if NBPFILTER > 0
bpfdetach(ifp);
#endif
if_detach(ifp);
FREE(sc, M_DEVBUF); FREE(sc, M_DEVBUF);
return 0; return 0;
} }
static int static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_strip.c,v 1.55 2004/12/05 06:53:33 christos Exp $ */ /* $NetBSD: if_strip.c,v 1.56 2004/12/05 15:00:47 peter Exp $ */
/* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
/* /*
@ -87,7 +87,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_strip.c,v 1.55 2004/12/05 06:53:33 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_strip.c,v 1.56 2004/12/05 15:00:47 peter Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "bpfilter.h" #include "bpfilter.h"
@ -337,11 +337,11 @@ void strip_timeout __P((void *x));
void void
stripattach(void) stripattach(void)
{ {
LIST_INIT(&strip_softc_list); LIST_INIT(&strip_softc_list);
if_clone_attach(&strip_cloner); if_clone_attach(&strip_cloner);
} }
int static int
strip_clone_create(struct if_clone *ifc, int unit) strip_clone_create(struct if_clone *ifc, int unit)
{ {
struct strip_softc *sc; struct strip_softc *sc;
@ -378,17 +378,20 @@ strip_clone_create(struct if_clone *ifc, int unit)
static int static int
strip_clone_destroy(struct ifnet *ifp) strip_clone_destroy(struct ifnet *ifp)
{ {
struct strip_softc *sc = (struct strip_softc *)ifp->if_softc; struct strip_softc *sc = (struct strip_softc *)ifp->if_softc;
if (sc->sc_ttyp != NULL) if (sc->sc_ttyp != NULL)
return EBUSY; /* Not removing it */ return EBUSY; /* Not removing it */
LIST_REMOVE(sc, sc_iflist); LIST_REMOVE(sc, sc_iflist);
if_detach(ifp); #if NBPFILTER > 0
bpfdetach(ifp);
#endif
if_detach(ifp);
FREE(sc, M_DEVBUF); FREE(sc, M_DEVBUF);
return 0; return 0;
} }
static int static int