static int gre_clone_destroy(struct ifnet *ifp) { struct gre_softc *sc = ifp->if_softc; int cpu; #ifdef INET if (sc->encap != NULL) encap_detach(sc->encap); #endif LIST_REMOVE(sc, sc_list); bpfdetach(ifp); if_detach(ifp); for (cpu = 0; cpu < netisr_ncpus; ++cpu) { if (sc->route_pcpu[cpu].ro_rt != NULL) { rtfree_async(sc->route_pcpu[cpu].ro_rt); sc->route_pcpu[cpu].ro_rt = NULL; } } kfree(sc->route_pcpu, M_GRE); kfree(sc, M_GRE); return 0; }
static int gif_clone_destroy(struct ifnet *ifp) { struct gif_softc *sc = (void *) ifp; gif_delete_tunnel(&sc->gif_if); LIST_REMOVE(sc, gif_list); #ifdef INET6 encap_detach(sc->encap_cookie6); #endif #ifdef INET encap_detach(sc->encap_cookie4); #endif bpf_detach(ifp); if_detach(ifp); rtcache_free(&sc->gif_ro); free(sc, M_DEVBUF); return (0); }
static int gre_clone_destroy(struct ifnet *ifp) { struct gre_softc *sc = ifp->if_softc; #ifdef INET if (sc->encap != NULL) encap_detach(sc->encap); #endif LIST_REMOVE(sc, sc_list); bpfdetach(ifp); if_detach(ifp); kfree(sc, M_GRE); return 0; }
static int stf_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) { struct stf_softc *sc = ifp->if_softc; int err; err = encap_detach(sc->encap_cookie); KASSERT(err == 0, ("Unexpected error detaching encap_cookie")); mtx_destroy(&(sc)->sc_ro_mtx); bpfdetach(ifp); if_detach(ifp); if_free(ifp); free(sc, M_STF); ifc_free_unit(ifc, STFUNIT); return (0); }