FreeBSD/sys/netinet6/ip6_mroute.c
/*
 * Delete a mif from the mif table
 */
Delete a mif from the mif table
Delete a mif from the mif table
static int
del_m6if_locked(mifi_t *mifip)
{
	struct mif6 *mifp = mif6table + *mifip;
	mifi_t mifi;
	struct ifnet *ifp;
	MIF6_LOCK_ASSERT();
	if (*mifip >= nummifs)
		return (EINVAL);
	if (mifp->m6_ifp == NULL)
		return (EINVAL);
	if (!(mifp->m6_flags & MIFF_REGISTER)) {
		ifp = mifp->m6_ifp;
		if_allmulti(ifp, 0);
	} else {
		if (reg_mif_num != (mifi_t)-1 &&
		    multicast_register_if6 != NULL) {
			if_detach(multicast_register_if6);
			if_free(multicast_register_if6);
			reg_mif_num = (mifi_t)-1;
			multicast_register_if6 = NULL;
		}
	}
	bzero((caddr_t)mifp, sizeof(*mifp));
	for (mifi = nummifs; mifi > 0; mifi--)
		if (mif6table[mifi - 1].m6_ifp)
			break;
	nummifs = mifi;
	MRT6_DLOG(DEBUG_ANY, "mif %d, nummifs %d", *mifip, nummifs);
	return (0);
}
static int del_m6if_locked ( mifi_t * mifip ) { struct mif6 * mifp = mif6table + * mifip ; mifi_t mifi ; struct ifnet * ifp ; MIF6_LOCK_ASSERT ( ) ; if ( * mifip >= nummifs ) return ( EINVAL ) ; if ( mifp -> m6_ifp == NULL ) return ( EINVAL ) ; if ( ! ( mifp -> m6_flags & MIFF_REGISTER ) ) { ifp = mifp -> m6_ifp ; if_allmulti ( ifp , 0 ) ; } else { if ( reg_mif_num != ( mifi_t ) - 1 && multicast_register_if6 != NULL ) { if_detach ( multicast_register_if6 ) ; if_free ( multicast_register_if6 ) ; reg_mif_num = ( mifi_t ) - 1 ; multicast_register_if6 = NULL ; } } bzero ( ( caddr_t ) mifp , sizeof ( * mifp ) ) ; for ( mifi = nummifs ; mifi > 0 ; mifi -- ) if ( mif6table [ mifi - 1 ] . m6_ifp ) break ; nummifs = mifi ; MRT6_DLOG ( DEBUG_ANY , " " , * mifip , nummifs ) ; return ( 0 ) ; }
Delete a mif from the mif table
Delete a mif from the mif table
/* XXX: TODO: Maintain an ALLMULTI refcount in struct ifnet. */ /* Adjust nummifs down */