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

Function in_purgemaddrs

freebsd/netinet/in.c:1209–1243  ·  view source on GitHub ↗

* Delete all IPv4 multicast address records, and associated link-layer * multicast address records, associated with ifp. * XXX It looks like domifdetach runs AFTER the link layer cleanup. * XXX This should not race with ifma_protospec being set during * a new allocation, if it does, we have bigger problems. */

Source from the content-addressed store, hash-verified

1207 * a new allocation, if it does, we have bigger problems.
1208 */
1209static void
1210in_purgemaddrs(struct ifnet *ifp)
1211{
1212 struct in_multi_head purgeinms;
1213 struct in_multi *inm;
1214 struct ifmultiaddr *ifma, *next;
1215
1216 SLIST_INIT(&purgeinms);
1217 IN_MULTI_LIST_LOCK();
1218
1219 /*
1220 * Extract list of in_multi associated with the detaching ifp
1221 * which the PF_INET layer is about to release.
1222 * We need to do this as IF_ADDR_LOCK() may be re-acquired
1223 * by code further down.
1224 */
1225 IF_ADDR_WLOCK(ifp);
1226 restart:
1227 CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) {
1228 if (ifma->ifma_addr->sa_family != AF_INET ||
1229 ifma->ifma_protospec == NULL)
1230 continue;
1231 inm = (struct in_multi *)ifma->ifma_protospec;
1232 inm_rele_locked(&purgeinms, inm);
1233 if (__predict_false(ifma_restart)) {
1234 ifma_restart = true;
1235 goto restart;
1236 }
1237 }
1238 IF_ADDR_WUNLOCK(ifp);
1239
1240 inm_release_list_deferred(&purgeinms);
1241 igmp_ifdetach(ifp);
1242 IN_MULTI_LIST_UNLOCK();
1243}
1244
1245struct in_llentry {
1246 struct llentry base;

Callers 2

in_ifscrub_allFunction · 0.85
in_ifdetachFunction · 0.85

Calls 3

igmp_ifdetachFunction · 0.85
inm_rele_lockedFunction · 0.70

Tested by

no test coverage detected