FreeBSD/sys/net/if_clone.c
/*
 * Lookup and create a clone network interface.
 */
Lookup and create a clone network interface.
Lookup and create a clone network interface .
int
if_clone_create(char *name, size_t len, caddr_t params)
{
	struct if_clone *ifc;
	IF_CLONERS_LOCK();
	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;
		}
#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)
		return (EINVAL);
	return (if_clone_createif(ifc, name, len, params));
}
int if_clone_create ( char * name , size_t len , caddr_t params ) { struct if_clone * ifc ; IF_CLONERS_LOCK ( ) ; 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 ; } #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 ) return ( EINVAL ) ; return ( if_clone_createif ( ifc , name , len , params ) ) ; }
Lookup and create a clone network interface.
Lookup and create a clone network interface .
/* Try to find an applicable cloner for this request */