MCPcopy Create free account
hub / github.com/F-Stack/f-stack / carp_destroy

Function carp_destroy

freebsd/netinet/ip_carp.c:1626–1657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1624}
1625
1626static void
1627carp_destroy(struct carp_softc *sc)
1628{
1629 struct ifnet *ifp = sc->sc_carpdev;
1630 struct carp_if *cif = ifp->if_carp;
1631
1632 sx_assert(&carp_sx, SA_XLOCKED);
1633
1634 if (sc->sc_suppress)
1635 carp_demote_adj(-V_carp_ifdown_adj, "vhid removed");
1636 CARP_UNLOCK(sc);
1637
1638 CIF_LOCK(cif);
1639 TAILQ_REMOVE(&cif->cif_vrs, sc, sc_list);
1640 CIF_UNLOCK(cif);
1641
1642 mtx_lock(&carp_mtx);
1643 LIST_REMOVE(sc, sc_next);
1644 mtx_unlock(&carp_mtx);
1645
1646 callout_drain(&sc->sc_ad_tmo);
1647#ifdef INET
1648 callout_drain(&sc->sc_md_tmo);
1649#endif
1650#ifdef INET6
1651 callout_drain(&sc->sc_md6_tmo);
1652#endif
1653 CARP_LOCK_DESTROY(sc);
1654
1655 free(sc->sc_ifas, M_CARP);
1656 free(sc, M_CARP);
1657}
1658
1659static struct carp_if*
1660carp_alloc_if(struct ifnet *ifp)

Callers 1

carp_detachFunction · 0.85

Calls 4

carp_demote_adjFunction · 0.85
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected