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

Function in_pcbpurgeif0

freebsd/netinet/in_pcb.c:2019–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2017}
2018
2019void
2020in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp)
2021{
2022 struct inpcb *inp;
2023 struct in_multi *inm;
2024 struct in_mfilter *imf;
2025 struct ip_moptions *imo;
2026
2027 INP_INFO_WLOCK(pcbinfo);
2028 CK_LIST_FOREACH(inp, pcbinfo->ipi_listhead, inp_list) {
2029 INP_WLOCK(inp);
2030 imo = inp->inp_moptions;
2031 if ((inp->inp_vflag & INP_IPV4) &&
2032 imo != NULL) {
2033 /*
2034 * Unselect the outgoing interface if it is being
2035 * detached.
2036 */
2037 if (imo->imo_multicast_ifp == ifp)
2038 imo->imo_multicast_ifp = NULL;
2039
2040 /*
2041 * Drop multicast group membership if we joined
2042 * through the interface being detached.
2043 *
2044 * XXX This can all be deferred to an epoch_call
2045 */
2046restart:
2047 IP_MFILTER_FOREACH(imf, &imo->imo_head) {
2048 if ((inm = imf->imf_inm) == NULL)
2049 continue;
2050 if (inm->inm_ifp != ifp)
2051 continue;
2052 ip_mfilter_remove(&imo->imo_head, imf);
2053 IN_MULTI_LOCK_ASSERT();
2054 in_leavegroup_locked(inm, NULL);
2055 ip_mfilter_free(imf);
2056 goto restart;
2057 }
2058 }
2059 INP_WUNLOCK(inp);
2060 }
2061 INP_INFO_WUNLOCK(pcbinfo);
2062}
2063
2064/*
2065 * Lookup a PCB based on the local address and port. Caller must hold the

Callers 1

in_ifdetachFunction · 0.85

Calls 3

in_leavegroup_lockedFunction · 0.85
ip_mfilter_freeFunction · 0.85
ip_mfilter_removeFunction · 0.70

Tested by

no test coverage detected