netstat patch for bridge stats

Iasen Kostov tbyte at OTEL.net
Thu Nov 25 09:19:40 PST 2004


    Hi,
this is a small patch which will make bridge stats
look nicer (or at least look some way :) ), because
this is current situation:

-- Bridging statistics (bdg) --
Name          In      Out  Forward     Drop    Bcast    Mcast    Local  
Unknown
vlan5:1 709303965749269168687899969   123884 13908828  3236774    10765  
4123745
vlan904:1 759386539711221922749370414   447736  6319135   177242    
49244  3022768

It is really a mess :) and does not looks like other protocol stats do.
And this is how it looks after the patch:

-- Bridging statistics (bdg) --
vlan5:1:
        721198379 total packets recieved
        762906756 total packets sent
        699495544 forwarded
        124082 dropped
        14073971 broadcasts
        3251664 multicasts
        10784 for local interface
        4242334 unknown packets
vlan904:1:
        773320391 total packets recieved
        723117599 total packets sent
        763146879 forwarded
        447736 dropped
        6424601 broadcasts
        179482 multicasts
        49248 for local interface
        3072445 unknown packets

I'll be happy to see comments about this.

    regards.

-------------- next part --------------
--- usr.bin/netstat/if.org.c	Thu Nov 25 18:13:34 2004
+++ usr.bin/netstat/if.c	Thu Nov 25 18:59:29 2004
@@ -101,11 +101,12 @@
 	bdg_done = 1;
 #endif
     printf("-- Bridging statistics (%s) --\n", name) ;
-    printf(
-"Name          In      Out  Forward     Drop    Bcast    Mcast    Local  Unknown\n");
     for (i = 0 ; i < 16 ; i++) {
 	if (s.s[i].name[0])
-	printf("%-6s %9ld%9ld%9ld%9ld%9ld%9ld%9ld%9ld\n",
+	printf("%-6s:\n\t%ld total packets recieved\n\t%ld total packets sent\n\t" \
+	       "%ld forwarded\n\t%ld dropped\n\t" \
+	       "%ld broadcasts\n\t%ld multicasts\n\t%ld for local interface\n\t" \
+	       "%ld unknown packets\n",
 	  s.s[i].name,
 	  s.s[i].p_in[(int)BDG_IN],
 	  s.s[i].p_in[(int)BDG_OUT],


More information about the freebsd-net mailing list