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

Function X_ip_mrouter_done

freebsd/netinet/ip_mroute.c:702–776  ·  view source on GitHub ↗

* Disable multicast forwarding. */

Source from the content-addressed store, hash-verified

700 * Disable multicast forwarding.
701 */
702static int
703X_ip_mrouter_done(void)
704{
705 struct ifnet *ifp;
706 u_long i;
707 vifi_t vifi;
708
709 MROUTER_LOCK();
710
711 if (V_ip_mrouter == NULL) {
712 MROUTER_UNLOCK();
713 return EINVAL;
714 }
715
716 /*
717 * Detach/disable hooks to the reset of the system.
718 */
719 V_ip_mrouter = NULL;
720 ip_mrouter_cnt--;
721 V_mrt_api_config = 0;
722
723 VIF_LOCK();
724
725 /*
726 * For each phyint in use, disable promiscuous reception of all IP
727 * multicasts.
728 */
729 for (vifi = 0; vifi < V_numvifs; vifi++) {
730 if (!in_nullhost(V_viftable[vifi].v_lcl_addr) &&
731 !(V_viftable[vifi].v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) {
732 ifp = V_viftable[vifi].v_ifp;
733 if_allmulti(ifp, 0);
734 }
735 }
736 bzero((caddr_t)V_viftable, sizeof(*V_viftable) * MAXVIFS);
737 V_numvifs = 0;
738 V_pim_assert_enabled = 0;
739
740 VIF_UNLOCK();
741
742 callout_stop(&V_expire_upcalls_ch);
743 callout_stop(&V_bw_upcalls_ch);
744 callout_stop(&V_bw_meter_ch);
745
746 MFC_LOCK();
747
748 /*
749 * Free all multicast forwarding cache entries.
750 * Do not use hashdestroy(), as we must perform other cleanup.
751 */
752 for (i = 0; i < mfchashsize; i++) {
753 struct mfc *rt, *nrt;
754
755 LIST_FOREACH_SAFE(rt, &V_mfchashtbl[i], mfc_hash, nrt) {
756 expire_mfc(rt);
757 }
758 }
759 free(V_mfchashtbl, M_MRTABLE);

Callers

nothing calls this directly

Calls 4

if_allmultiFunction · 0.85
bzeroFunction · 0.85
expire_mfcFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected