FreeBSD/sys/netinet/ip_mroute.c
/*
 * Delete a vif from the vif table
 */
Delete a vif from the vif table
Delete a vif from the vif table
static int
del_vif_locked(vifi_t vifi)
{
    struct vif *vifp;
    VIF_LOCK_ASSERT();
    if (vifi >= V_numvifs) {
	return EINVAL;
    }
    vifp = &V_viftable[vifi];
    if (in_nullhost(vifp->v_lcl_addr)) {
	return EADDRNOTAVAIL;
    }
    if (!(vifp->v_flags & (VIFF_TUNNEL | VIFF_REGISTER)))
	if_allmulti(vifp->v_ifp, 0);
    if (vifp->v_flags & VIFF_REGISTER)
	V_reg_vif_num = VIFI_INVALID;
    bzero((caddr_t)vifp, sizeof (*vifp));
    CTR2(KTR_IPMF, "%s: delete vif %d", __func__, (int)vifi);
    for (vifi = V_numvifs; vifi > 0; vifi--)
	if (!in_nullhost(V_viftable[vifi-1].v_lcl_addr))
	    break;
    V_numvifs = vifi;
    return 0;
}
static int del_vif_locked ( vifi_t vifi ) { struct vif * vifp ; VIF_LOCK_ASSERT ( ) ; if ( vifi >= V_numvifs ) { return EINVAL ; } vifp = & V_viftable [ vifi ] ; if ( in_nullhost ( vifp -> v_lcl_addr ) ) { return EADDRNOTAVAIL ; } if ( ! ( vifp -> v_flags & ( VIFF_TUNNEL | VIFF_REGISTER ) ) ) if_allmulti ( vifp -> v_ifp , 0 ) ; if ( vifp -> v_flags & VIFF_REGISTER ) V_reg_vif_num = VIFI_INVALID ; bzero ( ( caddr_t ) vifp , sizeof ( * vifp ) ) ; CTR2 ( KTR_IPMF , " " , __func__ , ( int ) vifi ) ; for ( vifi = V_numvifs ; vifi > 0 ; vifi -- ) if ( ! in_nullhost ( V_viftable [ vifi - 1 ] . v_lcl_addr ) ) break ; V_numvifs = vifi ; return 0 ; }
Delete a vif from the vif table
Delete a vif from the vif table
/* Adjust numvifs down */