Subject: pkg/13206: netstat2mrtg wont work on gif0
To: None <gnats-bugs@gnats.netbsd.org>
From: None <lannet@ixgate.org>
List: netbsd-bugs
Date: 06/14/2001 16:12:08
>Number:         13206
>Category:       pkg
>Synopsis:       netstat2mrtg wont work on gif0
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 14 00:11:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Hayashi
>Release:        5/26/2001
>Organization:
>Environment:
System: NetBSD fork.ixgate.org 1.5V NetBSD 1.5V (FORK) #66: Sat May 26 16:45:41 JST 2001 ayu@fork.ixgate.org:/exp/sources/src/sys/arch/i386/compile/FORK i386
Architecture: i386
Machine: i386
>Description:
	'netstat2mrtg' in mrtg pkg works on IFT_ETHER, IFT_FDDI,
	IFT_IEEE1394 interfaces, but doesn't work on others(e.g. gif0)
	because netstat wont show link-address.

>How-To-Repeat:
	"netstat2mrtg lo0" doesn't show transferred bytes.
>Fix:
	Apply following patch:

--- pkgsrc/net/mrtg/files/netstat2mrtg	Tue May 18 23:16:53 1999
+++ netstat2mrtg	Sun Jun  3 16:09:14 2001
@@ -2,10 +2,15 @@
 
 $if = $ARGV[0];
-open(NET, "netstat -I $if -b|");
+open(NET, "netstat -I $if -bn|");
 while ($line = <NET>)
 {
 	chop $line;
 	if ($line =~ m|^.+<Link>[\s\t]+\S+[\s\t]+(\w+)[\s\t]+(\w+)$|)
+	{
+		print "$1\n";
+		print "$2\n";
+	}
+	elsif ($line =~ m|^.+<Link>[\s\t]+(\w+)[\s\t]+(\w+)$|)
 	{
 		print "$1\n";
 		print "$2\n";
>Release-Note:
>Audit-Trail:
>Unformatted: