* Remove prefix and default router list entries corresponding to ifp. Neighbor * cache entries are freed in in6_domifdetach(). */
| 1151 | * cache entries are freed in in6_domifdetach(). |
| 1152 | */ |
| 1153 | void |
| 1154 | nd6_purge(struct ifnet *ifp) |
| 1155 | { |
| 1156 | struct nd_prhead prl; |
| 1157 | struct nd_prefix *pr, *npr; |
| 1158 | |
| 1159 | LIST_INIT(&prl); |
| 1160 | |
| 1161 | /* Purge default router list entries toward ifp. */ |
| 1162 | nd6_defrouter_purge(ifp); |
| 1163 | |
| 1164 | ND6_WLOCK(); |
| 1165 | /* |
| 1166 | * Remove prefixes on ifp. We should have already removed addresses on |
| 1167 | * this interface, so no addresses should be referencing these prefixes. |
| 1168 | */ |
| 1169 | LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, npr) { |
| 1170 | if (pr->ndpr_ifp == ifp) |
| 1171 | nd6_prefix_unlink(pr, &prl); |
| 1172 | } |
| 1173 | ND6_WUNLOCK(); |
| 1174 | |
| 1175 | /* Delete the unlinked prefix objects. */ |
| 1176 | while ((pr = LIST_FIRST(&prl)) != NULL) { |
| 1177 | LIST_REMOVE(pr, ndpr_entry); |
| 1178 | nd6_prefix_del(pr); |
| 1179 | } |
| 1180 | |
| 1181 | /* cancel default outgoing interface setting */ |
| 1182 | if (V_nd6_defifindex == ifp->if_index) |
| 1183 | nd6_setdefaultiface(0); |
| 1184 | |
| 1185 | if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { |
| 1186 | /* Refresh default router list. */ |
| 1187 | defrouter_select_fib(ifp->if_fib); |
| 1188 | } |
| 1189 | } |
| 1190 | |
| 1191 | /* |
| 1192 | * the caller acquires and releases the lock on the lltbls |
no test coverage detected