FreeBSD/contrib/bsnmp/snmp_mibII/mibII.c
/*
 * Create a new ifa and verify it
 */
Create a new ifa and verify it
Create a new ifa and verify it
struct mibifa *
mib_create_ifa(u_int ifindex, struct in_addr addr, struct in_addr mask,
    struct in_addr bcast)
{
	struct mibif *ifp;
	struct mibifa *ifa;
	if ((ifp = mib_find_if(ifindex)) == NULL)
		return (NULL);
	if ((ifa = alloc_ifa(ifindex, addr)) == NULL)
		return (NULL);
	ifa->inmask = mask;
	ifa->inbcast = bcast;
	if (siocaifaddr(ifp->name, ifa->inaddr, ifa->inmask, ifa->inbcast)) {
		syslog(LOG_ERR, "%s: %m", __func__);
		destroy_ifa(ifa);
		return (NULL);
	}
	if (verify_ifa(ifp->name, ifa)) {
		destroy_ifa(ifa);
		return (NULL);
	}
	return (ifa);
}
struct mibifa * mib_create_ifa ( u_int ifindex , struct in_addr addr , struct in_addr mask , struct in_addr bcast ) { struct mibif * ifp ; struct mibifa * ifa ; if ( ( ifp = mib_find_if ( ifindex ) ) == NULL ) return ( NULL ) ; if ( ( ifa = alloc_ifa ( ifindex , addr ) ) == NULL ) return ( NULL ) ; ifa -> inmask = mask ; ifa -> inbcast = bcast ; if ( siocaifaddr ( ifp -> name , ifa -> inaddr , ifa -> inmask , ifa -> inbcast ) ) { syslog ( LOG_ERR , " " , __func__ ) ; destroy_ifa ( ifa ) ; return ( NULL ) ; } if ( verify_ifa ( ifp -> name , ifa ) ) { destroy_ifa ( ifa ) ; return ( NULL ) ; } return ( ifa ) ; }
Create a new ifa and verify it
Create a new ifa and verify it