small bug plus fix for /proc/net/snmp (Imcp: field count)

small bug plus fix for /proc/net/snmp (Imcp: field count)

Post by Erik Schoenfelde » Mon, 30 Sep 2002 22:00:13



Hi,

i received a bug report plus fix from Gonzalo A. Arana Tagle

``Icmp:'' values in /proc/net/snmp:

       # awk '/Icmp/ { print NF; }' /proc/net/snmp
       27
       28

the code in snmp_get_info() from net/ipv4/proc.c prints a dummy value
present at the end of struct icmp_mib, which should not be included.

from include/net/snmp.h:

Quote:>  struct icmp_mib
>  {
>    unsigned long   IcmpInMsgs;
>  [...]
>    unsigned long   IcmpOutAddrMaskReps;
>    unsigned long   dummy;
>    unsigned long   __pad[0];
>  } ____cacheline_aligned;

instead of printing all values before the __pad field, printing the
values before the dummy field gives the right number of values:

--- linux-2.4.19/net/ipv4/proc.c-dist   Wed May 16 19:21:45 2001

        len += sprintf (buffer + len,
                "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps\n"
                  "Icmp:");
-       for (i=0; i<offsetof(struct icmp_mib, __pad)/sizeof(unsigned long); i++)
+       for (i=0; i<offsetof(struct icmp_mib, dummy)/sizeof(unsigned long); i++)
                len += sprintf(buffer+len, " %lu", fold_field((unsigned long*)icmp_statistics, sizeof(struct icmp_mib), i));

        len += sprintf (buffer + len,

please fix this.  thank's in advance,
                                                        Erik
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

small bug plus fix for /proc/net/snmp (Imcp: field count)

Post by David S. Mille » Tue, 01 Oct 2002 03:10:05


Patch applied, thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. /proc/net/snmp and SNMP MIB

We have several Red Hat 5.1 servers in our server pool.  On some of the servers, an snmp query on .iso.org.dod.internet.mgmt.mib-2.tcp.tcpOutSegs.0 will give me a number greater than zero.  On others it will give me exactly zero.  Now, on those that give me zero, I can display /proc/net/snmp and the field for Tcp: OutSegs is greater than zero.  Should there be a correllation between the snmp query and the same field in /proc/net/snmp?  If so, why does that not exist on this machine, or better yet, how can I make it exist?  On the boxes that return a number greater than zero for the snmp query, this number matches the one in the OutSegs field in /proc/net/snmp.

==================================
Posted via http://nodevice.com
Linux Programmer's Site

2. RedHat 4.1 Upgrade problem

3. SNMP tools which use /proc/net/snmp ?

4. EtherExpress + ISDN-Card doesn't work together

5. /proc/net/tcp and /proc/net/udp

6. knode and gpg

7. ipv4: move proc stuff from net/ipv4/af_inet.c to net/ipv4/proc.c

8. bsd.java.mk

9. /proc/net/route, /proc/net/rt_cach, sysctl ??

10. TCP/IP, /proc/net, snmp

11. 4gb limit count /proc/net/dev

12. small SCSI use count fix

13. 1.3.37: fixes for /proc/net/route and NFS client code?