Condition that snmpd reads a register information on NIC

Solution Verified - Updated -

Issue

  • Snmpd seems to read a register information on NIC by issuing ioctl(,SIOCGMIIPHY,).
[agent/mibgroup/if-mib/data_access/interface_linux.c]
/**
 * Determines network interface speed from MII
 */
unsigned long long
#ifdef HAVE_LINUX_ETHTOOL_H
netsnmp_linux_interface_get_if_speed_mii(int fd, const char *name)
#else
netsnmp_linux_interface_get_if_speed(int fd, const char *name)
#endif
{
<snip>
    if (ioctl(fd, 0x8947, &ifr) >= 0) {  <- *** issue ioctl(,SIOCGMIIPHY,) ***
        new_ioctl_nums = 1;
    } else if (ioctl(fd, SIOCDEVPRIVATE, &ifr) >= 0) {
        new_ioctl_nums = 0;
    } else {
        DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIPHY on %s failed\n",
                    ifr.ifr_name));
        return retspeed;
    }

    /* Begin getting mii register values */
    phy_id = data[0];
    for (mii_reg = 0; mii_reg < 8; mii_reg++){
        data[0] = phy_id;
        data[1] = mii_reg;
        if(ioctl(fd, new_ioctl_nums ? 0x8948 : SIOCDEVPRIVATE+1, &ifr) <0){  <- *** issue ioctl(,SIOCGMIIPHY,) ***
            DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIREG on %s failed\n", ifr.ifr_name));
        }
        mii_val[mii_reg] = data[3];
    }
  • Could you tell us the condition of executing this processing?

Environment

  • Red Hat Enterprise Linux 5 Update 6
  • Architecture: x86_64
  • Kernel Version: kernel-2.6.18-238.5.1.el5
  • Package Version: net-snmp-5.3.2.2-9.el5_5.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content