static int bridge_rtable_prune_period = BRIDGE_RTABLE_PRUNE_PERIOD;
static int bridge_clone_create(struct if_clone *, int, caddr_t);
-static void bridge_clone_destroy(struct ifnet *);
+static int bridge_clone_destroy(struct ifnet *);
static int bridge_ioctl(struct ifnet *, u_long, caddr_t, struct ucred *);
static void bridge_mutecaps(struct bridge_ifinfo *, struct ifnet *, int);
*
* Destroy a bridge instance.
*/
-static void
+static int
bridge_clone_destroy(struct ifnet *ifp)
{
struct bridge_softc *sc = ifp->if_softc;
kfree(sc->sc_iflists, M_DEVBUF);
kfree(sc, M_DEVBUF);
+
+ return 0;
}
/*
LIST_HEAD(, faith_softc) faith_softc_list;
int faith_clone_create (struct if_clone *, int, caddr_t);
-void faith_clone_destroy (struct ifnet *);
+int faith_clone_destroy (struct ifnet *);
struct if_clone faith_cloner = IF_CLONE_INITIALIZER(FAITHNAME,
faith_clone_create, faith_clone_destroy, NFAITH, IF_MAXUNIT);
return (0);
}
-void
+int
faith_clone_destroy(struct ifnet *ifp)
{
struct faith_softc *sc = (struct faith_softc *) ifp;
if_detach(ifp);
kfree(sc, M_FAITH);
+
+ return 0;
}
int
LIST_HEAD(, gif_softc) gif_softc_list;
int gif_clone_create (struct if_clone *, int, caddr_t);
-void gif_clone_destroy (struct ifnet *);
+int gif_clone_destroy (struct ifnet *);
struct if_clone gif_cloner = IF_CLONE_INITIALIZER("gif", gif_clone_create,
gif_clone_destroy, 0, IF_MAXUNIT);
bpfattach(&sc->gif_if, DLT_NULL, sizeof(u_int));
}
-void
+int
gif_clone_destroy(struct ifnet *ifp)
{
struct gif_softc *sc = ifp->if_softc;
if_detach(ifp);
kfree(sc, M_GIF);
+
+ return 0;
}
static void
struct gre_softc_head gre_softc_list;
static int gre_clone_create(struct if_clone *, int, caddr_t);
-static void gre_clone_destroy(struct ifnet *);
+static int gre_clone_destroy(struct ifnet *);
static int gre_ioctl(struct ifnet *, u_long, caddr_t, struct ucred *);
static int gre_output(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *rt);
return (0);
}
-static void
+static int
gre_clone_destroy(struct ifnet *ifp)
{
struct gre_softc *sc = ifp->if_softc;
if_detach(ifp);
kfree(sc, M_GRE);
+
+ return 0;
}
/*
struct if_clone *ifc;
struct ifnet *ifp;
int bytoff, bitoff;
- int unit;
+ int unit, error;
ifc = if_clone_lookup(name, &unit);
if (ifc == NULL)
if (ifc->ifc_destroy == NULL)
return (EOPNOTSUPP);
- (*ifc->ifc_destroy)(ifp);
+ error = ifc->ifc_destroy(ifp);
+ if (error)
+ return error;
/*
* Compute offset in the bitmap and deallocate the unit.
int ifc_bmlen; /* bitmap length */
int (*ifc_create)(struct if_clone *, int, caddr_t);
- void (*ifc_destroy)(struct ifnet *);
+ int (*ifc_destroy)(struct ifnet *);
};
#define IF_CLONE_INITIALIZER(name, create, destroy, minifs, maxunit) \
void pflogrtrequest(int, struct rtentry *, struct sockaddr *);
void pflogstart(struct ifnet *);
int pflog_clone_create(struct if_clone *, int, caddr_t);
-void pflog_clone_destroy(struct ifnet *);
+int pflog_clone_destroy(struct ifnet *);
LIST_HEAD(, pflog_softc) pflogif_list;
struct if_clone pflog_cloner =
return (0);
}
-void
+int
pflog_clone_destroy(struct ifnet *ifp)
{
struct pflog_softc *pflogif = ifp->if_softc;
lwkt_gettoken(&pf_token);
kfree(pflogif, M_DEVBUF);
lwkt_reltoken(&pf_token);
+
+ return 0;
}
/*
struct pfsyncstats pfsyncstats;
void pfsyncattach(int);
-static void pfsync_clone_destroy(struct ifnet *);
+static int pfsync_clone_destroy(struct ifnet *);
static int pfsync_clone_create(struct if_clone *, int, caddr_t);
void pfsync_setmtu(struct pfsync_softc *, int);
int pfsync_alloc_scrub_memory(struct pfsync_state_peer *,
return (0);
}
-static void
+static int
pfsync_clone_destroy(struct ifnet *ifp)
{
lwkt_gettoken(&pf_token);
lwkt_gettoken(&pf_token);
kfree(pfsyncif, M_DEVBUF);
pfsyncif = NULL;
+
+ return 0;
}
/*
/* clone */
static int tap_clone_create(struct if_clone *, int, caddr_t);
-static void tap_clone_destroy(struct ifnet *);
+static int tap_clone_destroy(struct ifnet *);
/* network interface */
*
* Destroy a tap instance.
*/
-static void
+static int
tap_clone_destroy(struct ifnet *ifp)
{
struct tap_softc *tp = ifp->if_softc;
+ if ((tp->tap_flags & TAP_CLONE) == 0)
+ return ENXIO;
+
TAPDEBUG(&tp->tap_if, "clone destroyed. minor = %#x tap_flags = 0x%x\n",
minor(tp->tap_dev), tp->tap_flags);
- if (tp->tap_flags & TAP_CLONE)
- tapdestroy(tp);
+ tapdestroy(tp);
+
+ return 0;
}
/*
static LIST_HEAD(, ifvlan) ifv_list;
static int vlan_clone_create(struct if_clone *, int, caddr_t);
-static void vlan_clone_destroy(struct ifnet *);
+static int vlan_clone_destroy(struct ifnet *);
static void vlan_ifdetach(void *, struct ifnet *);
static void vlan_init(void *);
return (0);
}
-static void
+static int
vlan_clone_destroy(struct ifnet *ifp)
{
struct ifvlan *ifv = ifp->if_softc;
ether_ifdetach(ifp);
kfree(ifv, M_VLAN);
+
+ return 0;
}
static void
static void carp_setroute(struct carp_softc *, int);
static void carp_input_c(struct mbuf *, struct carp_header *, sa_family_t);
static int carp_clone_create(struct if_clone *, int, caddr_t);
-static void carp_clone_destroy(struct ifnet *);
+static int carp_clone_destroy(struct ifnet *);
static void carp_detach(struct carp_softc *, int);
static int carp_prepare_ad(struct mbuf *, struct carp_softc *,
struct carp_header *);
return (0);
}
-static void
+static int
carp_clone_destroy(struct ifnet *ifp)
{
struct carp_softc *sc = ifp->if_softc;
KASSERT(sc->sc_naddrs == 0, ("certain inet address is still active\n"));
kfree(sc, M_CARP);
+
+ return 0;
}
static void
MALLOC_DEFINE(M_80211_COM, "80211com", "802.11 com state");
-static void wlan_clone_destroy(struct ifnet *);
+static int wlan_clone_destroy(struct ifnet *);
static int wlan_clone_create(struct if_clone *, int, caddr_t);
static struct if_clone wlan_cloner =
return (vap == NULL ? EIO : 0);
}
-static void
+static int
wlan_clone_destroy(struct ifnet *ifp)
{
struct ieee80211vap *vap = ifp->if_softc;
wlan_serialize_enter(); /* WARNING must be global serializer */
ic->ic_vap_delete(vap);
wlan_serialize_exit();
+
+ return 0;
}
const char *wlan_last_enter_func;