626e1f7
diff -up net-tools-1.60/lib/interface.c.cycle net-tools-1.60/lib/interface.c
2c75ca1
--- net-tools-1.60/lib/interface.c.cycle	2012-01-16 15:34:09.000000000 +0100
2c75ca1
+++ net-tools-1.60/lib/interface.c	2012-01-19 11:42:51.207536052 +0100
626e1f7
@@ -93,6 +93,7 @@ int if_list_all = 0;	/* do we have reque
cvsdist 5f913e2
 static struct interface *int_list, *int_last;
cvsdist 5f913e2
 
cvsdist 5f913e2
 static int if_readlist_proc(char *);
cvsdist 5f913e2
+static int if_readlist_rep(char *, struct interface *);
cvsdist 5f913e2
 
626e1f7
 static struct interface *if_cache_add(char *name)
cvsdist 5f913e2
 {
626e1f7
@@ -138,11 +139,14 @@ struct interface *lookup_interface(char
cvsdist 5f913e2
 int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie)
cvsdist 5f913e2
 {
cvsdist 5f913e2
     struct interface *ife;
cvsdist 5f913e2
+    int err;
cvsdist 5f913e2
 
626e1f7
     if (!if_list_all && (if_readlist() < 0))
cvsdist 5f913e2
 	return -1;
cvsdist 5f913e2
     for (ife = int_list; ife; ife = ife->next) {
cvsdist 5f913e2
-	int err = doit(ife, cookie);
626e1f7
+	if_readlist_rep(ife->name, ife);
cvsdist 5f913e2
+	err = doit(ife, cookie);
626e1f7
+
cvsdist 5f913e2
 	if (err)
cvsdist 5f913e2
 	    return err;
cvsdist 5f913e2
     }
3f72065
@@ -378,6 +382,41 @@ static int if_readlist_proc(char *target
626e1f7
     fclose(fh);
cvsdist 5f913e2
     return err;
cvsdist 5f913e2
 }
cvsdist 5f913e2
+
cvsdist 5f913e2
+static int if_readlist_rep(char *target, struct interface *ife)
cvsdist 5f913e2
+{
cvsdist 5f913e2
+    FILE *fh;
cvsdist 5f913e2
+    char buf[512];
cvsdist 5f913e2
+    int err;
cvsdist 5f913e2
+
cvsdist 5f913e2
+    fh = fopen(_PATH_PROCNET_DEV, "r");
cvsdist 5f913e2
+    if (!fh) {
cvsdist 5f913e2
+		fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"),
cvsdist 5f913e2
+			_PATH_PROCNET_DEV, strerror(errno)); 
cvsdist 5f913e2
+		return if_readconf();
cvsdist 5f913e2
+	}	
cvsdist 5f913e2
+    fgets(buf, sizeof buf, fh);	/* eat line */
cvsdist 5f913e2
+    fgets(buf, sizeof buf, fh);
cvsdist 5f913e2
+
cvsdist 5f913e2
+    procnetdev_vsn = procnetdev_version(buf);
cvsdist 5f913e2
+
cvsdist 5f913e2
+    err = 0;
cvsdist 5f913e2
+    while (fgets(buf, sizeof buf, fh)) {
cvsdist 5f913e2
+	char *s, name[IFNAMSIZ];
cvsdist 5f913e2
+	s = get_name(name, buf);    
cvsdist 5f913e2
+	get_dev_fields(s, ife);
cvsdist 5f913e2
+	ife->statistics_valid = 1;
cvsdist 5f913e2
+	if (target && !strcmp(target,name))
cvsdist 5f913e2
+		break;
cvsdist 5f913e2
+    }
cvsdist 5f913e2
+    if (ferror(fh)) {
cvsdist 5f913e2
+	perror(_PATH_PROCNET_DEV);
cvsdist 5f913e2
+	err = -1;
cvsdist 5f913e2
+    }
cvsdist 5f913e2
+
cvsdist 5f913e2
+    fclose(fh);
cvsdist 5f913e2
+    return err;
cvsdist 5f913e2
+}
626e1f7
 
cvsdist 5f913e2
 int if_readlist(void) 
cvsdist 5f913e2
 { 
626e1f7
diff -up net-tools-1.60/man/en_US/netstat.8.cycle net-tools-1.60/man/en_US/netstat.8
2c75ca1
--- net-tools-1.60/man/en_US/netstat.8.cycle	2012-01-16 15:34:09.000000000 +0100
2c75ca1
+++ net-tools-1.60/man/en_US/netstat.8	2012-01-19 11:42:51.208536039 +0100
626e1f7
@@ -33,6 +33,7 @@ netstat \- Print network connections, ro
cvsdist 5f913e2
 .RB [ \-\-verbose | \-v ]
cvsdist 5f913e2
 .RB [ \-\-continuous | \-c]
626e1f7
 .RB [ \-\-wide | \-W]
cvsdist 5f913e2
+.RB [delay]
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .B netstat 
cvsdist 5f913e2
 .RB { \-\-route | \-r }
626e1f7
@@ -42,6 +43,7 @@ netstat \- Print network connections, ro
cvsdist 5f913e2
 .RB [ \-\-numeric | \-n ]
626e1f7
 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
cvsdist 5f913e2
 .RB [ \-\-continuous | \-c]
cvsdist 5f913e2
+.RB [delay]
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .B netstat
cvsdist 5f913e2
 .RB { \-\-interfaces | \-i }
626e1f7
@@ -52,12 +54,14 @@ netstat \- Print network connections, ro
cvsdist 5f913e2
 .RB [ \-\-numeric | \-n ]
626e1f7
 .RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ]
cvsdist 5f913e2
 .RB [ \-\-continuous | \-c]
cvsdist 5f913e2
+.RB [delay]
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .B netstat
cvsdist 5f913e2
 .RB { \-\-groups | \-g }
cvsdist 5f913e2
 .RB [ \-\-numeric | \-n ]
626e1f7
 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
cvsdist 5f913e2
 .RB [ \-\-continuous | \-c]
cvsdist 5f913e2
+.RB [delay]
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .B netstat
cvsdist 5f913e2
 .RB { \-\-masquerade | \-M }
626e1f7
@@ -65,6 +69,7 @@ netstat \- Print network connections, ro
cvsdist 5f913e2
 .RB [ \-\-numeric | \-n ]
626e1f7
 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
cvsdist 5f913e2
 .RB [ \-\-continuous | \-c]
cvsdist 5f913e2
+.RB [delay]
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .B netstat
cvsdist 5f913e2
 .RB { \-\-statistics | -s }
626e1f7
@@ -72,6 +77,7 @@ netstat \- Print network connections, ro
cvsdist 5f913e2
 .RB [ \-\-udp | \-u ]
626e1f7
 .RB [ \-\-udplite | \-U ]
cvsdist 5f913e2
 .RB [ \-\-raw | \-w ]
cvsdist 5f913e2
+.RB [delay]
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .B netstat 
cvsdist 5f913e2
 .RB { \-\-version | \-V }
626e1f7
@@ -188,6 +194,10 @@ option, show interfaces that are not up
cvsdist 5f913e2
 Print routing information from the FIB.  (This is the default.)
cvsdist 5f913e2
 .SS "\-C"
cvsdist 5f913e2
 Print routing information from the route cache.
cvsdist 5f913e2
+.SS delay
cvsdist 5f913e2
+Netstat will cycle printing through statistics every 
cvsdist 5f913e2
+.B delay 
cvsdist 5f913e2
+seconds.
cvsdist 5f913e2
 .P
cvsdist 5f913e2
 .SH OUTPUT
626e1f7
 .P
626e1f7
diff -up net-tools-1.60/netstat.c.cycle net-tools-1.60/netstat.c
2c75ca1
--- net-tools-1.60/netstat.c.cycle	2012-01-16 15:34:09.000000000 +0100
2c75ca1
+++ net-tools-1.60/netstat.c	2012-01-19 11:49:59.836177456 +0100
2c75ca1
@@ -116,9 +116,9 @@
cvsdist 5f913e2
 #endif
cvsdist 5f913e2
 
cvsdist 5f913e2
 /* prototypes for statistics.c */
cvsdist 5f913e2
-void parsesnmp(int, int, int);
cvsdist 5f913e2
+int parsesnmp(int, int, int);
cvsdist 5f913e2
 void inittab(void);
626e1f7
-void parsesnmp6(int, int, int);
626e1f7
+int parsesnmp6(int, int, int);
626e1f7
 void inittab6(void);
cvsdist 5f913e2
 
cvsdist 5f913e2
 typedef enum {
2c75ca1
@@ -344,10 +344,10 @@ static void prg_cache_clear(void)
2c75ca1
     prg_cache_loaded = 0;
626e1f7
 }
626e1f7
 
626e1f7
-static void wait_continous(void)
626e1f7
+static void wait_continous(int reptimer)
626e1f7
 {
626e1f7
     fflush(stdout);
626e1f7
-    sleep(1);
626e1f7
+    sleep(reptimer);
626e1f7
 }
626e1f7
 
626e1f7
 static int extract_type_1_socket_inode(const char lname[], unsigned long * inode_p) {
2c75ca1
@@ -1785,6 +1785,8 @@ static int rfcomm_info(void)
cvsdist 5f913e2
 
cvsdist 5f913e2
 static int iface_info(void)
cvsdist 5f913e2
 {
cvsdist 5f913e2
+    static int count=0;
cvsdist 5f913e2
+
cvsdist 5f913e2
     if (skfd < 0) {
cvsdist 5f913e2
 	if ((skfd = sockets_open(0)) < 0) {
cvsdist 5f913e2
 	    perror("socket");
2c75ca1
@@ -1794,20 +1796,21 @@ static int iface_info(void)
cvsdist 5f913e2
     }
cvsdist 5f913e2
     if (flag_exp < 2) {
cvsdist 5f913e2
 	ife_short = 1;
9dd4855
-	printf(_("Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
cvsdist 5f913e2
+	if(!(count % 8))
9dd4855
+	    printf(_("Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
cvsdist 5f913e2
     }
cvsdist 5f913e2
 
cvsdist 5f913e2
     if (for_all_interfaces(do_if_print, &flag_all) < 0) {
cvsdist 5f913e2
 	perror(_("missing interface information"));
cvsdist 5f913e2
 	exit(1);
cvsdist 5f913e2
     }
cvsdist 5f913e2
-    if (flag_cnt)
cvsdist 5f913e2
+    if (!flag_cnt) {
626e1f7
 	if_cache_free();
cvsdist 5f913e2
-    else {
cvsdist 5f913e2
 	close(skfd);
cvsdist 5f913e2
 	skfd = -1;
cvsdist 5f913e2
     }
cvsdist 5f913e2
 
cvsdist 5f913e2
+    count++;
cvsdist 5f913e2
     return 0;
cvsdist 5f913e2
 }
cvsdist 5f913e2
 
2c75ca1
@@ -1823,7 +1826,7 @@ static void usage(void)
cvsdist 5f913e2
 {
626e1f7
     fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}\n"));
626e1f7
     fprintf(stderr, _("       netstat [-vWnNcaeol] [<Socket> ...]\n"));
626e1f7
-    fprintf(stderr, _("       netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-6tuw] }\n\n"));
626e1f7
+    fprintf(stderr, _("       netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]\n\n"));
cvsdist 5f913e2
 
cvsdist 5f913e2
     fprintf(stderr, _("        -r, --route              display routing table\n"));
cvsdist 5f913e2
     fprintf(stderr, _("        -i, --interfaces         display interface table\n"));
2c75ca1
@@ -1861,6 +1864,7 @@ int main
cvsdist 5f913e2
  (int argc, char *argv[]) {
cvsdist 5f913e2
     int i;
cvsdist 5f913e2
     int lop;
cvsdist 5f913e2
+    int reptimer = 1;
626e1f7
     static struct option longopts[] =
cvsdist 5f913e2
     {
cvsdist 5f913e2
 	AFTRANS_OPTS,
2c75ca1
@@ -2043,6 +2047,12 @@ int main
cvsdist 5f913e2
 	    flag_sta++;
cvsdist 5f913e2
 	}
cvsdist 5f913e2
 
cvsdist 5f913e2
+    if(argc == optind + 1) {
cvsdist 5f913e2
+      if((reptimer = atoi(argv[optind])) <= 0)
cvsdist 5f913e2
+	usage();
cvsdist 5f913e2
+      flag_cnt++;
cvsdist 5f913e2
+    }
cvsdist 5f913e2
+    
cvsdist 5f913e2
     if (flag_int + flag_rou + flag_mas + flag_sta > 1)
cvsdist 5f913e2
 	usage();
cvsdist 5f913e2
 
2c75ca1
@@ -2072,7 +2082,7 @@ int main
cvsdist 5f913e2
 			     flag_not & FLAG_NUM_PORT, flag_exp);
cvsdist 5f913e2
 	    if (i || !flag_cnt)
cvsdist 5f913e2
 		break;
626e1f7
-	    wait_continous();
626e1f7
+	    wait_continous(reptimer);
cvsdist 5f913e2
 	}
cvsdist 5f913e2
 #else
626e1f7
 	ENOSUPP("netstat", "FW_MASQUERADE");
2c75ca1
@@ -2084,18 +2094,18 @@ int main
cvsdist 5f913e2
     if (flag_sta) {
626e1f7
         if (!afname[0])
626e1f7
             strcpy(afname, DFLT_AF);
626e1f7
-            
626e1f7
+        for (;;) {
626e1f7
         if (!strcmp(afname, "inet")) {
626e1f7
 #if HAVE_AFINET
626e1f7
             inittab();
626e1f7
-            parsesnmp(flag_raw, flag_tcp, flag_udp);
626e1f7
+            i = parsesnmp(flag_raw, flag_tcp, flag_udp);
626e1f7
 #else
626e1f7
             ENOSUPP("netstat", "AF INET");
626e1f7
 #endif
626e1f7
         } else if(!strcmp(afname, "inet6")) {
626e1f7
 #if HAVE_AFINET6
626e1f7
             inittab6();
626e1f7
-            parsesnmp6(flag_raw, flag_tcp, flag_udp);
626e1f7
+            i = parsesnmp6(flag_raw, flag_tcp, flag_udp);
626e1f7
 #else
626e1f7
             ENOSUPP("netstat", "AF INET6");
626e1f7
 #endif
2c75ca1
@@ -2103,7 +2113,11 @@ int main
626e1f7
           printf(_("netstat: No statistics support for specified address family: %s\n"), afname);
626e1f7
           exit(1);
626e1f7
         }
626e1f7
-        exit(0);
cvsdist 5f913e2
+	if(i || !flag_cnt)
cvsdist 5f913e2
+	  break;
cvsdist 5f913e2
+	sleep(reptimer);
626e1f7
+        }
626e1f7
+        return (i);
cvsdist 5f913e2
     }
cvsdist 5f913e2
     
cvsdist 5f913e2
     if (flag_rou) {
2c75ca1
@@ -2125,7 +2139,7 @@ int main
cvsdist 5f913e2
 	    i = route_info(afname, options);
cvsdist 5f913e2
 	    if (i || !flag_cnt)
cvsdist 5f913e2
 		break;
626e1f7
-            wait_continous();
626e1f7
+            wait_continous(reptimer);
cvsdist 5f913e2
 	}
cvsdist 5f913e2
 	return (i);
cvsdist 5f913e2
     }
2c75ca1
@@ -2134,7 +2148,7 @@ int main
cvsdist 5f913e2
 	    i = iface_info();
cvsdist 5f913e2
 	    if (!flag_cnt || i)
cvsdist 5f913e2
 		break;
626e1f7
-            wait_continous();
626e1f7
+            wait_continous(reptimer);
cvsdist 5f913e2
 	}
cvsdist 5f913e2
 	return (i);
cvsdist 5f913e2
     }
2c75ca1
@@ -2321,7 +2335,7 @@ int main
3f72065
 
cvsdist 5f913e2
 	if (!flag_cnt || i)
cvsdist 5f913e2
 	    break;
626e1f7
-        wait_continous();
626e1f7
+        wait_continous(reptimer);
cvsdist 5f913e2
 	prg_cache_clear();
cvsdist 5f913e2
     }
cvsdist 5f913e2
     return (i);
626e1f7
diff -up net-tools-1.60/statistics.c.cycle net-tools-1.60/statistics.c
2c75ca1
--- net-tools-1.60/statistics.c.cycle	2012-01-16 15:34:09.000000000 +0100
2c75ca1
+++ net-tools-1.60/statistics.c	2012-01-19 11:42:51.220535890 +0100
626e1f7
@@ -502,7 +502,7 @@ void process6_fd(FILE *f)
cvsdist 5f913e2
 
626e1f7
 }
cvsdist 5f913e2
 
cvsdist 5f913e2
-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
cvsdist 5f913e2
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
cvsdist 5f913e2
 {
cvsdist 5f913e2
     FILE *f;
cvsdist 5f913e2
 
626e1f7
@@ -511,14 +511,17 @@ void parsesnmp(int flag_raw, int flag_tc
626e1f7
     f = proc_fopen("/proc/net/snmp");
cvsdist 5f913e2
     if (!f) {
cvsdist 5f913e2
 	perror(_("cannot open /proc/net/snmp"));
cvsdist 5f913e2
-	return;
cvsdist 5f913e2
+	return(1);
cvsdist 5f913e2
     }
626e1f7
 
626e1f7
     if (process_fd(f, 1, NULL) < 0)
626e1f7
       fprintf(stderr, _("Problem while parsing /proc/net/snmp\n"));
cvsdist 5f913e2
 
cvsdist 5f913e2
-    if (ferror(f))
cvsdist 5f913e2
+    if (ferror(f)) {
cvsdist 5f913e2
 	perror("/proc/net/snmp");
579c9b0
+	fclose(f);
cvsdist 5f913e2
+	return(1);
cvsdist 5f913e2
+    }
cvsdist 5f913e2
 
cvsdist 5f913e2
     fclose(f);
cvsdist 5f913e2
 
626e1f7
@@ -528,15 +531,18 @@ void parsesnmp(int flag_raw, int flag_tc
626e1f7
     	if (process_fd(f, 1, NULL) <0)
626e1f7
           fprintf(stderr, _("Problem while parsing /proc/net/netstat\n"));
cvsdist 5f913e2
 
cvsdist 5f913e2
-        if (ferror(f))
cvsdist 5f913e2
-	    perror("/proc/net/netstat");
cvsdist 5f913e2
+        if (ferror(f)) {
cvsdist 5f913e2
+	  perror("/proc/net/netstat");
579c9b0
+	  fclose(f);
cvsdist 5f913e2
+	  return(1);
626e1f7
+        }
cvsdist 5f913e2
     
cvsdist 5f913e2
         fclose(f);
cvsdist 5f913e2
     }
cvsdist 5f913e2
-    return;
cvsdist 5f913e2
+    return(0);
cvsdist 5f913e2
 }
cvsdist 5f913e2
     
626e1f7
-void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp)
626e1f7
+int parsesnmp6(int flag_raw, int flag_tcp, int flag_udp)
626e1f7
 {
626e1f7
     FILE *f;
626e1f7
 
626e1f7
@@ -545,7 +551,7 @@ void parsesnmp6(int flag_raw, int flag_t
626e1f7
     f = fopen("/proc/net/snmp6", "r");
626e1f7
     if (!f) {
626e1f7
         perror(_("cannot open /proc/net/snmp6"));
626e1f7
-        return;
626e1f7
+        return(1);
626e1f7
     }
626e1f7
     process6_fd(f);
626e1f7
     if (ferror(f))
626e1f7
@@ -555,13 +561,16 @@ void parsesnmp6(int flag_raw, int flag_t
626e1f7
     f = fopen("/proc/net/snmp", "r");
626e1f7
     if (!f) {
626e1f7
         perror(_("cannot open /proc/net/snmp"));
626e1f7
-        return;
626e1f7
+        return(1);
626e1f7
     }
626e1f7
     process_fd(f, 0, "Tcp");
626e1f7
-    if (ferror(f))
626e1f7
+    if (ferror(f)) {
626e1f7
         perror("/proc/net/snmp");
626e1f7
+        return(1);
626e1f7
+    }
626e1f7
 
626e1f7
     fclose(f);
626e1f7
+    return(0);
626e1f7
 }
cvsdist 5f913e2
 
626e1f7
 void inittab(void)