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

Function ip6_destroy

freebsd/netinet6/ip6_input.c:350–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348
349#ifdef VIMAGE
350static void
351ip6_destroy(void *unused __unused)
352{
353 struct ifaddr *ifa, *nifa;
354 struct ifnet *ifp;
355 int error;
356
357#ifdef RSS
358 netisr_unregister_vnet(&ip6_direct_nh);
359#endif
360 netisr_unregister_vnet(&ip6_nh);
361
362 pfil_head_unregister(V_inet6_pfil_head);
363 error = hhook_head_deregister(V_ipsec_hhh_in[HHOOK_IPSEC_INET6]);
364 if (error != 0) {
365 printf("%s: WARNING: unable to deregister input helper hook "
366 "type HHOOK_TYPE_IPSEC_IN, id HHOOK_IPSEC_INET6: "
367 "error %d returned\n", __func__, error);
368 }
369 error = hhook_head_deregister(V_ipsec_hhh_out[HHOOK_IPSEC_INET6]);
370 if (error != 0) {
371 printf("%s: WARNING: unable to deregister output helper hook "
372 "type HHOOK_TYPE_IPSEC_OUT, id HHOOK_IPSEC_INET6: "
373 "error %d returned\n", __func__, error);
374 }
375
376 /* Cleanup addresses. */
377 IFNET_RLOCK();
378 CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
379 /* Cannot lock here - lock recursion. */
380 /* IF_ADDR_LOCK(ifp); */
381 CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) {
382 if (ifa->ifa_addr->sa_family != AF_INET6)
383 continue;
384 in6_purgeaddr(ifa);
385 }
386 /* IF_ADDR_UNLOCK(ifp); */
387 in6_ifdetach_destroy(ifp);
388 mld_domifdetach(ifp);
389 }
390 IFNET_RUNLOCK();
391
392 /* Make sure any routes are gone as well. */
393 rib_flush_routes_family(AF_INET6);
394
395 frag6_destroy();
396 nd6_destroy();
397 in6_ifattach_destroy();
398
399 hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask);
400}
401
402VNET_SYSUNINIT(inet6, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_destroy, NULL);
403#endif

Callers

nothing calls this directly

Calls 12

netisr_unregister_vnetFunction · 0.85
pfil_head_unregisterFunction · 0.85
hhook_head_deregisterFunction · 0.85
in6_purgeaddrFunction · 0.85
in6_ifdetach_destroyFunction · 0.85
mld_domifdetachFunction · 0.85
rib_flush_routes_familyFunction · 0.85
frag6_destroyFunction · 0.85
nd6_destroyFunction · 0.85
in6_ifattach_destroyFunction · 0.85
printfFunction · 0.50
hashdestroyFunction · 0.50

Tested by

no test coverage detected