Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 20db51d70e6b59a061db97ce9b89c771 > files > 61

net-snmp-5.3.2.2-14.el5.src.rpm

diff -up net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface.c.ifspeed-10gbps net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface.c
--- net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface.c.ifspeed-10gbps	2008-09-29 13:49:08.000000000 +0200
+++ net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface.c	2008-09-29 13:49:09.000000000 +0200
@@ -665,6 +665,7 @@ netsnmp_access_interface_entry_guess_spe
         entry->speed = 4000000;
     else
         entry->speed = 0;
+    entry->speed_high = entry->speed / 1000000;
 }
 
 netsnmp_conf_if_list *
@@ -702,7 +703,12 @@ netsnmp_access_interface_entry_overrides
         netsnmp_access_interface_entry_overrides_get(entry->name);
     if (if_ptr) {
         entry->type = if_ptr->type;
-        entry->speed = if_ptr->speed;
+        if (if_ptr->speed > 0xffffffff) {
+            entry->speed = 0xffffffff;
+        } else {
+            entry->speed = if_ptr->speed;
+        }
+        entry->speed_high = if_ptr->speed / 1000000LL;
     }
 }
 
@@ -747,7 +753,7 @@ _parse_interface_config(const char *toke
         config_perror("Out of memory");
         return;
     }
-    if_new->speed = strtoul(speed, &ecp, 0);
+    if_new->speed = strtoull(speed, &ecp, 0);
     if (*ecp) {
         config_perror("Bad SPEED value");
         free(if_new);
diff -up net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface_linux.c.ifspeed-10gbps net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface_linux.c
--- net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface_linux.c.ifspeed-10gbps	2008-09-29 13:49:08.000000000 +0200
+++ net-snmp-5.3.2.2/agent/mibgroup/if-mib/data_access/interface_linux.c	2008-09-29 13:49:50.000000000 +0200
@@ -50,10 +50,10 @@ typedef __u8 u8;           /* ditto */
 #define SUPPORT_PREFIX_FLAGS 1
 #endif  /* RTMGRP_IPV6_PREFIX */
 #endif  /* INET6 */
-unsigned int
+unsigned long long
 netsnmp_linux_interface_get_if_speed(int fd, const char *name);
 #ifdef HAVE_LINUX_ETHTOOL_H
-unsigned int
+unsigned long long
 netsnmp_linux_interface_get_if_speed_mii(int fd, const char *name);
 #endif
 
@@ -683,9 +683,14 @@ netsnmp_arch_interface_container_load(ne
             break;
         }
 
-        if (IANAIFTYPE_ETHERNETCSMACD == entry->type)
-            entry->speed =
-                netsnmp_linux_interface_get_if_speed(fd, entry->name);
+        if (IANAIFTYPE_ETHERNETCSMACD == entry->type) {
+            unsigned long long speed = netsnmp_linux_interface_get_if_speed(fd, entry->name);
+            if (speed > 0xffffffffL) {
+                entry->speed = 0xffffffff;
+            } else
+                entry->speed = speed;
+            entry->speed_high = speed / 1000000LL;
+        }
 #ifdef APPLIED_PATCH_836390   /* xxx-rks ifspeed fixes */
         else if (IANAIFTYPE_PROPVIRTUAL == entry->type)
             entry->speed = _get_bonded_if_speed(entry);
@@ -727,8 +732,6 @@ netsnmp_arch_interface_container_load(ne
  
         netsnmp_access_interface_entry_overrides(entry);
 
-        entry->speed_high = entry->speed / 1000000;
-
         if (! (load_flags & NETSNMP_ACCESS_INTERFACE_LOAD_NO_STATS))
             _parse_stats(entry, stats, scan_expected);
 
@@ -774,7 +777,7 @@ netsnmp_arch_set_admin_status(netsnmp_in
 /**
  * Determines network interface speed from ETHTOOL_GSET
  */
-unsigned int
+unsigned long long
 netsnmp_linux_interface_get_if_speed(int fd, const char *name)
 {
     struct ifreq ifr;
@@ -793,7 +796,8 @@ netsnmp_linux_interface_get_if_speed(int
     }
     
     if (edata.speed != SPEED_10 && edata.speed != SPEED_100 &&
-        edata.speed != SPEED_1000) {
+        edata.speed != SPEED_1000 && edata.speed != SPEED_10000 &&
+        edata.speed != SPEED_2500) {
         DEBUGMSGTL(("mibII/interfaces", "fallback to mii for %s\n",
                     ifr.ifr_name));
         /* try MII */
@@ -745,21 +749,21 @@ netsnmp_linux_interface_get_if_speed(int fd, const char *name)
     /* return in bps */
     DEBUGMSGTL(("mibII/interfaces", "ETHTOOL_GSET on %s speed = %d\n",
                 ifr.ifr_name, edata.speed));
-    return edata.speed*1000*1000;
+    return edata.speed*1000LL*1000LL;
 }
 #endif
  
 /**
  * Determines network interface speed from MII
  */
-unsigned int
+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
 {
-    unsigned int retspeed = 10000000;
+    unsigned long long retspeed = 10000000;
     struct ifreq ifr;
 
     /* the code is based on mii-diag utility by Donald Becker
@@ -829,7 +833,7 @@ netsnmp_linux_interface_get_if_speed(int
     int mii_reg, i;
     ushort mii_val[32];
     ushort bmcr, bmsr, nway_advert, lkpar;
-    const unsigned int media_speeds[] = {10000000, 10000000, 100000000, 100000000, 10000000, 0};	
+    const unsigned long long media_speeds[] = {10000000, 10000000, 100000000, 100000000, 10000000, 0};
     /* It corresponds to "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4", "Flow-control", 0, */
 
     strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
diff -up net-snmp-5.3.2.2/include/net-snmp/data_access/interface.h.ifspeed-10gbps net-snmp-5.3.2.2/include/net-snmp/data_access/interface.h
--- net-snmp-5.3.2.2/include/net-snmp/data_access/interface.h.ifspeed-10gbps	2005-11-16 21:11:12.000000000 +0100
+++ net-snmp-5.3.2.2/include/net-snmp/data_access/interface.h	2008-09-29 13:49:09.000000000 +0200
@@ -171,7 +171,7 @@ typedef struct netsnmp_interface_entry_s
 typedef struct _conf_if_list {
     const char     *name;
     int             type;
-    u_long          speed;
+    unsigned long long speed;
     struct _conf_if_list *next;
 } netsnmp_conf_if_list;