~ubuntu-branches/ubuntu/precise/net-snmp/precise

« back to all changes in this revision

Viewing changes to agent/mibgroup/if-mib/data_access/interface_linux.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-26 01:27:00 UTC
  • mfrom: (1.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091126012700-pox7w0a5j2x305h9
Tags: 5.4.2.1~dfsg-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.
    (LP: #426813).
 * Dropped patches:
   - debian/patches/101-fix-ipalias.patch: Applied upstream.
   - debian/patches/99-fix-net-snmp-syslog.patch: Applied upstream.
   - debian/patches/99-fix-perl-counter-in-subagent.patch: Applied upstream.
   - ebian/patches/103-fix-ubuntu-lmsensors.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  Interface MIB architecture support
3
3
 *
4
 
 * $Id: interface_linux.c 16595 2007-07-06 21:14:03Z rstory $
 
4
 * $Id: interface_linux.c 16944 2008-05-14 13:35:40Z tanders $
5
5
 */
6
6
#include <net-snmp/net-snmp-config.h>
7
7
#include <net-snmp/net-snmp-includes.h>
126
126
 
127
127
    *flags &= ~NETSNMP_INTERFACE_FLAGS_HAS_IPV6;
128
128
 
 
129
#ifndef SIOCGMIIPHY
 
130
#define SIOCGMIIPHY 0x8947
 
131
#endif
 
132
 
 
133
#ifndef SIOCGMIIREG
 
134
#define SIOCGMIIREG 0x8948
 
135
#endif
 
136
 
129
137
#ifdef NETSNMP_ENABLE_IPV6
130
138
    /*
131
139
     * get ipv6 addresses
770
778
     */
771
779
    ushort *data = (ushort *)(&ifr.ifr_data);
772
780
    unsigned phy_id;
773
 
    unsigned char new_ioctl_nums = 0;
774
781
    int mii_reg, i;
775
782
    ushort mii_val[32];
776
783
    ushort bmcr, bmsr, nway_advert, lkpar;
781
788
    ifr.ifr_name[ sizeof(ifr.ifr_name)-1 ] = 0;
782
789
    data[0] = 0;
783
790
    
784
 
    if (ioctl(fd, 0x8947, &ifr) >= 0) {
785
 
        new_ioctl_nums = 1;
786
 
    } else if (ioctl(fd, SIOCDEVPRIVATE, &ifr) >= 0) {
787
 
        new_ioctl_nums = 0;
788
 
    } else {
 
791
    /*
 
792
     * SIOCGMIIPHY has been defined since at least kernel 2.4.10 (Sept 2001).
 
793
     * It's probably safe to drop the interim SIOCDEVPRIVATE handling now!
 
794
     */
 
795
    if (ioctl(fd, SIOCGMIIPHY, &ifr) < 0) {
789
796
        DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIPHY on %s failed\n",
790
797
                    ifr.ifr_name));
791
798
        return retspeed;
796
803
    for (mii_reg = 0; mii_reg < 8; mii_reg++){
797
804
        data[0] = phy_id;
798
805
        data[1] = mii_reg;
799
 
        if(ioctl(fd, new_ioctl_nums ? 0x8948 : SIOCDEVPRIVATE+1, &ifr) <0){
 
806
        if(ioctl(fd, SIOCGMIIREG, &ifr) <0){
800
807
            DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIREG on %s failed\n", ifr.ifr_name));
801
808
        }
802
809
        mii_val[mii_reg] = data[3];