lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 Nov 2007 12:38:22 +0100
From:	Eric Dumazet <dada1@...mosbay.com>
To:	Bernd Eckenfels <ecki@...a.inka.de>
Cc:	akadwa@...ntek.com, linux-net@...r.kernel.org,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: Mcast packet loss 2.6.8.1 kernel

On Fri, 16 Nov 2007 09:22:13 +0100
Bernd Eckenfels <ecki@...a.inka.de> wrote:

> In article <1195112740.4853.14.camel@...ux-ak10.SGC> you wrote:
> > output of netstat after startup and before tx of packets
> > /flash/sbin/netstat -s
> ...
> > error parsing /proc/net/snmp: Success
> 
> Could you sent me (net-tools maintainer) the output of netstat -V as well as
> the content of "cat /proc/net/snmp > dump" so i can see if this is a fixable
> problem?

Hello Bernd

I did some investigations on the "netstat -s" problem and one
 fix is to change the size of char buf1[1024], buf2[1024];

(function process_fd(), file statistics.c)

from 1024 to say 2048, because one line of /proc/net/netstat exceeds 1024 chars in current kernels.

Thank you

BTW, a real usefull thing would be to force reads of various 
/proc files to use PAGE_SIZE buffers instead of standard 1024 ones.

This can speedup netstat by a four factor at least. (reading of /proc/net/tcp file is O(N^2))

--- netstat.c.orig	2007-11-16 12:28:15.000000000 +0100
+++ netstat.c	2007-11-16 12:33:12.000000000 +0100
@@ -152,8 +152,24 @@
 
 FILE *procinfo;
 
+FILE *myfopen_r(const char *name)
+{
+	static char *buffer;
+	static size_t pagesz;
+	FILE *res = fopen(name, "r");
+
+	if (res != NULL) {
+		if (!buffer) {
+			pagesz = getpagesize();
+			buffer = malloc(pagesz);
+		}
+		setvbuf(res, buffer, _IOFBF, pagesz); 
+	}
+	return res;
+}
+
 #define INFO_GUTS1(file,name,proc)			\
-  procinfo = fopen((file), "r");			\
+  procinfo = myfopen_r((file));			\
   if (procinfo == NULL) {				\
     if (errno != ENOENT) {				\
       perror((file));					\
@@ -174,7 +190,7 @@
 #if HAVE_AFINET6
 #define INFO_GUTS2(file,proc)				\
   lnr = 0;						\
-  procinfo = fopen((file), "r");		       	\
+  procinfo = myfopen_r((file));		       	\
   if (procinfo != NULL) {				\
     do {						\
       if (fgets(buffer, sizeof(buffer), procinfo))	\

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists