lib/libatm/ioctl_subr.c
int
verify_nif_name(char *name)
{
	int	rc, s;
	struct atminfreq	air;
	struct air_netif_rsp    *nif_info;

	/*
	 * Check whether name is of a valid length
	 */
	if (strlen(name) > IFNAMSIZ - 1 ||
			strlen(name) < 1) {
		return(FALSE);
	}

	/*
	 * Open a socket for the IOCTL
	 */
	s = socket(AF_ATM, SOCK_DGRAM, 0);
	if (s < 0) {
		return(-1);
	}

	/*
	 * Get memory for returned information
	 */
	nif_info = (struct air_netif_rsp *)UM_ALLOC(
			sizeof(struct air_netif_rsp));
	if (nif_info == NULL) {
		errno = ENOMEM;
		return(-1);
	}

	/*
	 * Set up the request
	 */
	air.air_opcode = AIOCS_INF_NIF;
	air.air_buf_addr = (caddr_t)nif_info;
	air.air_buf_len = sizeof(struct air_netif_rsp);
	UM_ZERO(air.air_netif_intf, sizeof(air.air_netif_intf));
	strlcpy(air.air_netif_intf, name, sizeof(air.air_netif_intf));

	/*
	 * Issue the IOCTL
	 */
	rc = ioctl(s, AIOCINFO, (caddr_t)&air);
	UM_FREE(nif_info);
	(void)close(s);

	/*
	 * Base return value on IOCTL return code
	 */
	if (rc)
		return(FALSE);
	else
		return(TRUE);
}
/*
 * Verify netif name
 * 
 * This routine issues an IOCTL to check whether the passed string is
 * a valid network interface name.
 * 
 * Arguments:
 *	req	pointer to an ATM information request IOCTL structure
 *
 * Returns:
 *	-1		error encountered
 *	FALSE (0) 	the string is not a NIF name
 *	TRUE (> 0) 	the string is a valid NIF name
 *
 */
Verify netif name

This routine issues an IOCTL to check whether the passed string is
a valid network interface name.

req     pointer to an ATM information request IOCTL structure

-1              error encountered
FALSE (0)       the string is not a NIF name
TRUE (> 0)      the string is a valid NIF name
Verify netif name This routine issues an IOCTL to check whether the passed string is a valid network interface name . req pointer to an ATM information request IOCTL structure - 1 error encountered FALSE ( 0 ) the string is not a NIF name TRUE ( > 0 ) the string is a valid NIF name
int
verify_nif_name(char *name)
{
	int	rc, s;
	struct atminfreq	air;
	struct air_netif_rsp    *nif_info;
	if (strlen(name) > IFNAMSIZ - 1 ||
			strlen(name) < 1) {
		return(FALSE);
	}
	s = socket(AF_ATM, SOCK_DGRAM, 0);
	if (s < 0) {
		return(-1);
	}
	nif_info = (struct air_netif_rsp *)UM_ALLOC(
			sizeof(struct air_netif_rsp));
	if (nif_info == NULL) {
		errno = ENOMEM;
		return(-1);
	}
	air.air_opcode = AIOCS_INF_NIF;
	air.air_buf_addr = (caddr_t)nif_info;
	air.air_buf_len = sizeof(struct air_netif_rsp);
	UM_ZERO(air.air_netif_intf, sizeof(air.air_netif_intf));
	strlcpy(air.air_netif_intf, name, sizeof(air.air_netif_intf));
	rc = ioctl(s, AIOCINFO, (caddr_t)&air);
	UM_FREE(nif_info);
	(void)close(s);
	if (rc)
		return(FALSE);
	else
		return(TRUE);
}
int verify_nif_name ( char * name ) { int rc , s ; struct atminfreq air ; struct air_netif_rsp * nif_info ; if ( strlen ( name ) > IFNAMSIZ - 1 || strlen ( name ) < 1 ) { return ( FALSE ) ; } s = socket ( AF_ATM , SOCK_DGRAM , 0 ) ; if ( s < 0 ) { return ( -1 ) ; } nif_info = ( struct air_netif_rsp * ) UM_ALLOC ( sizeof ( struct air_netif_rsp ) ) ; if ( nif_info == NULL ) { errno = ENOMEM ; return ( -1 ) ; } air . air_opcode = AIOCS_INF_NIF ; air . air_buf_addr = ( caddr_t ) nif_info ; air . air_buf_len = sizeof ( struct air_netif_rsp ) ; UM_ZERO ( air . air_netif_intf , sizeof ( air . air_netif_intf ) ) ; strlcpy ( air . air_netif_intf , name , sizeof ( air . air_netif_intf ) ) ; rc = ioctl ( s , AIOCINFO , ( caddr_t ) & air ) ; UM_FREE ( nif_info ) ; ( void ) close ( s ) ; if ( rc ) return ( FALSE ) ; else return ( TRUE ) ; }
Verify netif name
Verify netif name
/*
	 * Check whether name is of a valid length
	 */ /*
	 * Open a socket for the IOCTL
	 */ /*
	 * Get memory for returned information
	 */ /*
	 * Set up the request
	 */ /*
	 * Issue the IOCTL
	 */ /*
	 * Base return value on IOCTL return code
	 */