mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.4.19] small bug plus fix for /proc/net/snmp (Imcp: field count)
@ 2002-09-29 19:55 Erik Schoenfelder
  2002-09-30  0:54 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Erik Schoenfelder @ 2002-09-29 19:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Marcelo Tosatti

Hi,

i received a bug report plus fix from Gonzalo A. Arana Tagle
<garana@uolsinectis.com.ar> about a extra dummy value printed for the
``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:

>  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
+++ linux-2.4.19/net/ipv4/proc.c	Sat Sep 28 22:03:05 2002
@@ -128,7 +128,7 @@
 	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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.4.19] small bug plus fix for /proc/net/snmp (Imcp: field count)
  2002-09-29 19:55 [2.4.19] small bug plus fix for /proc/net/snmp (Imcp: field count) Erik Schoenfelder
@ 2002-09-30  0:54 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2002-09-30  0:54 UTC (permalink / raw)
  To: schoenfr; +Cc: linux-kernel, marcelo


Patch applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-30  0:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-29 19:55 [2.4.19] small bug plus fix for /proc/net/snmp (Imcp: field count) Erik Schoenfelder
2002-09-30  0:54 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®