FreeBSD/contrib/bsnmp/snmp_mibII/mibII.c
/*
 * Change the admin status of an interface
 */
Change the admin status of an interface
Change the admin status of an interface
int
mib_if_admin(struct mibif *ifp, int up)
{
	struct ifreq ifr;
	strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
	if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr) == -1) {
		syslog(LOG_ERR, "SIOCGIFFLAGS(%s): %m", ifp->name);
		return (-1);
	}
	if (up)
		ifr.ifr_flags |= IFF_UP;
	else
		ifr.ifr_flags &= ~IFF_UP;
	if (ioctl(mib_netsock, SIOCSIFFLAGS, &ifr) == -1) {
		syslog(LOG_ERR, "SIOCSIFFLAGS(%s): %m", ifp->name);
		return (-1);
	}
	(void)mib_fetch_ifmib(ifp);
	return (0);
}
int mib_if_admin ( struct mibif * ifp , int up ) { struct ifreq ifr ; strncpy ( ifr . ifr_name , ifp -> name , sizeof ( ifr . ifr_name ) ) ; if ( ioctl ( mib_netsock , SIOCGIFFLAGS , & ifr ) == -1 ) { syslog ( LOG_ERR , " " , ifp -> name ) ; return ( -1 ) ; } if ( up ) ifr . ifr_flags |= IFF_UP ; else ifr . ifr_flags &= ~ IFF_UP ; if ( ioctl ( mib_netsock , SIOCSIFFLAGS , & ifr ) == -1 ) { syslog ( LOG_ERR , " " , ifp -> name ) ; return ( -1 ) ; } ( void ) mib_fetch_ifmib ( ifp ) ; return ( 0 ) ; }
Change the admin status of an interface
Change the admin status of an interface