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

Function carp_alloc_if

freebsd/netinet/ip_carp.c:1659–1683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1657}
1658
1659static struct carp_if*
1660carp_alloc_if(struct ifnet *ifp)
1661{
1662 struct carp_if *cif;
1663 int error;
1664
1665 cif = malloc(sizeof(*cif), M_CARP, M_WAITOK|M_ZERO);
1666
1667 if ((error = ifpromisc(ifp, 1)) != 0)
1668 printf("%s: ifpromisc(%s) failed: %d\n",
1669 __func__, ifp->if_xname, error);
1670 else
1671 cif->cif_flags |= CIF_PROMISC;
1672
1673 CIF_LOCK_INIT(cif);
1674 cif->cif_ifp = ifp;
1675 TAILQ_INIT(&cif->cif_vrs);
1676
1677 IF_ADDR_WLOCK(ifp);
1678 ifp->if_carp = cif;
1679 if_ref(ifp);
1680 IF_ADDR_WUNLOCK(ifp);
1681
1682 return (cif);
1683}
1684
1685static void
1686carp_free_if(struct carp_if *cif)

Callers 1

carp_allocFunction · 0.85

Calls 4

mallocFunction · 0.85
ifpromiscFunction · 0.85
if_refFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected