| 1624 | } |
| 1625 | |
| 1626 | static void |
| 1627 | carp_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 | |
| 1659 | static struct carp_if* |
| 1660 | carp_alloc_if(struct ifnet *ifp) |
no test coverage detected