FreeBSD/sys/net/if_clone.c
/*
 * Create a clone network interface.
 */
Create a clone network interface.
Create a clone network interface .
static int
if_clone_createif(struct if_clone *ifc, char *name, size_t len, caddr_t params)
{
	int err;
	struct ifnet *ifp;
	if (ifunit(name) != NULL)
		return (EEXIST);
	if (ifc->ifc_type == SIMPLE)
		err = ifc_simple_create(ifc, name, len, params);
	else
		err = (*ifc->ifc_create)(ifc, name, len, params);
	if (!err) {
		ifp = ifunit(name);
		if (ifp == NULL)
			panic("%s: lookup failed for %s", __func__, name);
		if_addgroup(ifp, ifc->ifc_name);
		IF_CLONE_LOCK(ifc);
		IFC_IFLIST_INSERT(ifc, ifp);
		IF_CLONE_UNLOCK(ifc);
	}
	return (err);
}
static int if_clone_createif ( struct if_clone * ifc , char * name , size_t len , caddr_t params ) { int err ; struct ifnet * ifp ; if ( ifunit ( name ) != NULL ) return ( EEXIST ) ; if ( ifc -> ifc_type == SIMPLE ) err = ifc_simple_create ( ifc , name , len , params ) ; else err = ( * ifc -> ifc_create ) ( ifc , name , len , params ) ; if ( ! err ) { ifp = ifunit ( name ) ; if ( ifp == NULL ) panic ( " " , __func__ , name ) ; if_addgroup ( ifp , ifc -> ifc_name ) ; IF_CLONE_LOCK ( ifc ) ; IFC_IFLIST_INSERT ( ifc , ifp ) ; IF_CLONE_UNLOCK ( ifc ) ; } return ( err ) ; }
Create a clone network interface.
Create a clone network interface .