From cf47c76c1b66a14a5a324f27a0a3056832ce2585 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 5 Dec 2004 15:00:47 +0000 Subject: [PATCH] Don't forget to call bpfdetach in the clone destroy function. While here, add a missing static and change some spaces to tabs. --- sys/net/if_ppp.c | 7 +++++-- sys/net/if_sl.c | 30 ++++++++++++++++-------------- sys/net/if_strip.c | 27 +++++++++++++++------------ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index d878d6971374..42961d861db3 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -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 */ /* @@ -102,7 +102,7 @@ */ #include -__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" @@ -336,6 +336,9 @@ ppp_clone_destroy(struct ifnet *ifp) LIST_REMOVE(sc, sc_iflist); simple_unlock(&ppp_list_mutex); +#if NBPFILTER > 0 + bpfdetach(ifp); +#endif if_detach(ifp); FREE(sc, M_DEVBUF); diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index db145483cc7b..66aaf99733df 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -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 @@ -60,7 +60,7 @@ */ #include -__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 "bpfilter.h" @@ -197,11 +197,11 @@ static struct mbuf *sl_btom __P((struct sl_softc *, int)); void slattach(void) { - LIST_INIT(&sl_softc_list); - if_clone_attach(&sl_cloner); + LIST_INIT(&sl_softc_list); + if_clone_attach(&sl_cloner); } -int +static int sl_clone_create(struct if_clone *ifc, int unit) { struct sl_softc *sc; @@ -212,8 +212,7 @@ sl_clone_create(struct if_clone *ifc, int unit) "%s%d", ifc->ifc_name, unit); sc->sc_if.if_softc = sc; sc->sc_if.if_mtu = SLMTU; - sc->sc_if.if_flags = - IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST; + sc->sc_if.if_flags = IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST; sc->sc_if.if_type = IFT_SLIP; sc->sc_if.if_ioctl = slioctl; sc->sc_if.if_output = sloutput; @@ -232,17 +231,20 @@ sl_clone_create(struct if_clone *ifc, int unit) static int 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) - return EBUSY; /* Not removing it */ + if (sc->sc_ttyp != NULL) + 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); - return 0; + FREE(sc, M_DEVBUF); + return 0; } static int diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index 8dace7172847..2d00e17f33a4 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -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 $ */ /* @@ -87,7 +87,7 @@ */ #include -__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 "bpfilter.h" @@ -337,11 +337,11 @@ void strip_timeout __P((void *x)); void stripattach(void) { - LIST_INIT(&strip_softc_list); - if_clone_attach(&strip_cloner); + LIST_INIT(&strip_softc_list); + if_clone_attach(&strip_cloner); } -int +static int strip_clone_create(struct if_clone *ifc, int unit) { struct strip_softc *sc; @@ -378,17 +378,20 @@ strip_clone_create(struct if_clone *ifc, int unit) static int 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) - return EBUSY; /* Not removing it */ + if (sc->sc_ttyp != NULL) + 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); - return 0; + FREE(sc, M_DEVBUF); + return 0; } static int