FreeBSD/sys/net/if_clone.c
/*
 * Lookup and destroy a clone network interface.
 */
Lookup and destroy a clone network interface.
Lookup and destroy a clone network interface .
int
if_clone_destroy(const char *name)
{
	int err;
	struct if_clone *ifc;
	struct ifnet *ifp;
	ifp = ifunit_ref(name);
	if (ifp == NULL)
		return (ENXIO);
	IF_CLONERS_LOCK();
	LIST_FOREACH(ifc, &V_if_cloners, ifc_list) {
		if (strcmp(ifc->ifc_name, ifp->if_dname) == 0) {
			break;
		}
	}
#ifdef VIMAGE
	if (ifc == NULL && !IS_DEFAULT_VNET(curvnet)) {
		CURVNET_SET_QUIET(vnet0);
		LIST_FOREACH(ifc, &V_if_cloners, ifc_list)
			if (ifc->ifc_type == SIMPLE) {
				if (ifc_simple_match(ifc, name))
					break;
			} else {
				if (ifc->ifc_match(ifc, name))
					break;
			}
		CURVNET_RESTORE();
	}
#endif
	IF_CLONERS_UNLOCK();
	if (ifc == NULL) {
		if_rele(ifp);
		return (EINVAL);
	}
	err = if_clone_destroyif(ifc, ifp);
	if_rele(ifp);
	return err;
}
int if_clone_destroy ( const char * name ) { int err ; struct if_clone * ifc ; struct ifnet * ifp ; ifp = ifunit_ref ( name ) ; if ( ifp == NULL ) return ( ENXIO ) ; IF_CLONERS_LOCK ( ) ; LIST_FOREACH ( ifc , & V_if_cloners , ifc_list ) { if ( strcmp ( ifc -> ifc_name , ifp -> if_dname ) == 0 ) { break ; } } #ifdef VIMAGE if ( ifc == NULL && ! IS_DEFAULT_VNET ( curvnet ) ) { CURVNET_SET_QUIET ( vnet0 ) ; LIST_FOREACH ( ifc , & V_if_cloners , ifc_list ) if ( ifc -> ifc_type == SIMPLE ) { if ( ifc_simple_match ( ifc , name ) ) break ; } else { if ( ifc -> ifc_match ( ifc , name ) ) break ; } CURVNET_RESTORE ( ) ; } #endif IF_CLONERS_UNLOCK ( ) ; if ( ifc == NULL ) { if_rele ( ifp ) ; return ( EINVAL ) ; } err = if_clone_destroyif ( ifc , ifp ) ; if_rele ( ifp ) ; return err ; }
Lookup and destroy a clone network interface.
Lookup and destroy a clone network interface .
/* Find the cloner for this interface */