* NOTE: in6_ifdetach() does not support loopback if at this moment. * * When shutting down a VNET we clean up layers top-down. In that case * upper layer protocols (ulp) are cleaned up already and locks are destroyed * and we must not call into these cleanup functions anymore, thus purgeulp * is set to 0 in that case by in6_ifdetach_destroy(). * The normal case of destroying a (cloned) inte
| 752 | * everything related to the interface and will have purgeulp set to 1. |
| 753 | */ |
| 754 | static void |
| 755 | _in6_ifdetach(struct ifnet *ifp, int purgeulp) |
| 756 | { |
| 757 | struct ifaddr *ifa, *next; |
| 758 | |
| 759 | if (ifp->if_afdata[AF_INET6] == NULL) |
| 760 | return; |
| 761 | |
| 762 | /* |
| 763 | * nuke any of IPv6 addresses we have |
| 764 | */ |
| 765 | CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { |
| 766 | if (ifa->ifa_addr->sa_family != AF_INET6) |
| 767 | continue; |
| 768 | in6_purgeaddr(ifa); |
| 769 | } |
| 770 | if (purgeulp) { |
| 771 | IN6_MULTI_LOCK(); |
| 772 | in6_pcbpurgeif0(&V_udbinfo, ifp); |
| 773 | in6_pcbpurgeif0(&V_ulitecbinfo, ifp); |
| 774 | in6_pcbpurgeif0(&V_ripcbinfo, ifp); |
| 775 | IN6_MULTI_UNLOCK(); |
| 776 | } |
| 777 | /* leave from all multicast groups joined */ |
| 778 | in6_purgemaddrs(ifp); |
| 779 | |
| 780 | /* |
| 781 | * Remove neighbor management table. |
| 782 | * Enabling the nd6_purge will panic on vmove for interfaces on VNET |
| 783 | * teardown as the IPv6 layer is cleaned up already and the locks |
| 784 | * are destroyed. |
| 785 | */ |
| 786 | if (purgeulp) |
| 787 | nd6_purge(ifp); |
| 788 | } |
| 789 | |
| 790 | void |
| 791 | in6_ifdetach(struct ifnet *ifp) |
no test coverage detected