FreeBSD/contrib/bsnmp/snmp_mibII/mibII.c
/*
 * This is called for new interfaces after we have fetched the interface
 * MIB. If this is a broadcast interface try to guess the broadcast address
 * depending on the interface type.
 */
This is called for new interfaces after we have fetched the interface
MIB. If this is a broadcast interface try to guess the broadcast address
depending on the interface type.
This is called for new interfaces after we have fetched the interface MIB . If this is a broadcast interface try to guess the broadcast address depending on the interface type .
static void
check_llbcast(struct mibif *ifp)
{
	static u_char ether_bcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
	static u_char arcnet_bcast = 0;
	struct mibrcvaddr *rcv;
	if (!(ifp->mib.ifmd_flags & IFF_BROADCAST))
		return;
	switch (ifp->mib.ifmd_data.ifi_type) {
	  case IFT_ETHER:
	  case IFT_FDDI:
	  case IFT_ISO88025:
	  case IFT_L2VLAN:
		if (mib_find_rcvaddr(ifp->index, ether_bcast, 6) == NULL &&
		    (rcv = mib_rcvaddr_create(ifp, ether_bcast, 6)) != NULL)
			rcv->flags |= MIBRCVADDR_BCAST;
		break;
	  case IFT_ARCNET:
		if (mib_find_rcvaddr(ifp->index, &arcnet_bcast, 1) == NULL &&
		    (rcv = mib_rcvaddr_create(ifp, &arcnet_bcast, 1)) != NULL)
			rcv->flags |= MIBRCVADDR_BCAST;
		break;
	}
}
static void check_llbcast ( struct mibif * ifp ) { static u_char ether_bcast [ 6 ] = { 0xff , 0xff , 0xff , 0xff , 0xff , 0xff } ; static u_char arcnet_bcast = 0 ; struct mibrcvaddr * rcv ; if ( ! ( ifp -> mib . ifmd_flags & IFF_BROADCAST ) ) return ; switch ( ifp -> mib . ifmd_data . ifi_type ) { case IFT_ETHER : case IFT_FDDI : case IFT_ISO88025 : case IFT_L2VLAN : if ( mib_find_rcvaddr ( ifp -> index , ether_bcast , 6 ) == NULL && ( rcv = mib_rcvaddr_create ( ifp , ether_bcast , 6 ) ) != NULL ) rcv -> flags |= MIBRCVADDR_BCAST ; break ; case IFT_ARCNET : if ( mib_find_rcvaddr ( ifp -> index , & arcnet_bcast , 1 ) == NULL && ( rcv = mib_rcvaddr_create ( ifp , & arcnet_bcast , 1 ) ) != NULL ) rcv -> flags |= MIBRCVADDR_BCAST ; break ; } }
This is called for new interfaces after we have fetched the interface
 MIB.
This is called for new interfaces after we have fetched the interface MIB .