FreeBSD/sys/net/if_vlan.c
/*
 * Check for <etherif>.<vlan> style interface names.
 */
Check for . style interface names.
Check for . style interface names .
static struct ifnet *
vlan_clone_match_ethervid(const char *name, int *vidp)
{
	char ifname[IFNAMSIZ];
	char *cp;
	struct ifnet *ifp;
	int vid;
	strlcpy(ifname, name, IFNAMSIZ);
	if ((cp = strchr(ifname, '.')) == NULL)
		return (NULL);
	*cp = '\0';
	if ((ifp = ifunit(ifname)) == NULL)
		return (NULL);
	if (*++cp == '\0')
		return (NULL);
	vid = 0;
	for(; *cp >= '0' && *cp <= '9'; cp++)
		vid = (vid * 10) + (*cp - '0');
	if (*cp != '\0')
		return (NULL);
	if (vidp != NULL)
		*vidp = vid;
	return (ifp);
}
static struct ifnet * vlan_clone_match_ethervid ( const char * name , int * vidp ) { char ifname [ IFNAMSIZ ] ; char * cp ; struct ifnet * ifp ; int vid ; strlcpy ( ifname , name , IFNAMSIZ ) ; if ( ( cp = strchr ( ifname , ' ' ) ) == NULL ) return ( NULL ) ; * cp = ' \0 ' ; if ( ( ifp = ifunit ( ifname ) ) == NULL ) return ( NULL ) ; if ( * ++ cp == ' \0 ' ) return ( NULL ) ; vid = 0 ; for ( ; * cp >= ' ' && * cp <= ' ' ; cp ++ ) vid = ( vid * 10 ) + ( * cp - ' ' ) ; if ( * cp != ' \0 ' ) return ( NULL ) ; if ( vidp != NULL ) * vidp = vid ; return ( ifp ) ; }
Check for <etherif>.<vlan> style interface names.
Check for <etherif > . <vlan > style interface names .
/* Parse VID. */