| 604 | } |
| 605 | |
| 606 | static void |
| 607 | if_detached_event(void *arg __unused, struct ifnet *ifp) |
| 608 | { |
| 609 | vifi_t vifi; |
| 610 | u_long i; |
| 611 | |
| 612 | MROUTER_LOCK(); |
| 613 | |
| 614 | if (V_ip_mrouter == NULL) { |
| 615 | MROUTER_UNLOCK(); |
| 616 | return; |
| 617 | } |
| 618 | |
| 619 | VIF_LOCK(); |
| 620 | MFC_LOCK(); |
| 621 | |
| 622 | /* |
| 623 | * Tear down multicast forwarder state associated with this ifnet. |
| 624 | * 1. Walk the vif list, matching vifs against this ifnet. |
| 625 | * 2. Walk the multicast forwarding cache (mfc) looking for |
| 626 | * inner matches with this vif's index. |
| 627 | * 3. Expire any matching multicast forwarding cache entries. |
| 628 | * 4. Free vif state. This should disable ALLMULTI on the interface. |
| 629 | */ |
| 630 | for (vifi = 0; vifi < V_numvifs; vifi++) { |
| 631 | if (V_viftable[vifi].v_ifp != ifp) |
| 632 | continue; |
| 633 | for (i = 0; i < mfchashsize; i++) { |
| 634 | struct mfc *rt, *nrt; |
| 635 | |
| 636 | LIST_FOREACH_SAFE(rt, &V_mfchashtbl[i], mfc_hash, nrt) { |
| 637 | if (rt->mfc_parent == vifi) { |
| 638 | expire_mfc(rt); |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | del_vif_locked(vifi); |
| 643 | } |
| 644 | |
| 645 | MFC_UNLOCK(); |
| 646 | VIF_UNLOCK(); |
| 647 | |
| 648 | MROUTER_UNLOCK(); |
| 649 | } |
| 650 | |
| 651 | /* |
| 652 | * Enable multicast forwarding. |
nothing calls this directly
no test coverage detected