Subject: bin/31347: netstat err message sysctlnametomib too brief
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <gcw@primenet.com.au>
List: netbsd-bugs
Date: 09/19/2005 07:25:00
>Number: 31347
>Category: bin
>Synopsis: netstat err message is ambiguous about cause
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 19 07:25:00 +0000 2005
>Originator: Geoff C. Wing
>Release: NetBSD 3.99.9
>Organization:
>Environment:
System: NetBSD g.primenet.com.au 3.99.9 NetBSD 3.99.9 (G) #0: Mon Sep 19 16:59:29 EST 2005 gcw@g.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/G i386
Architecture: i386
Machine: i386
>Description:
netstat can give an ambiguous error message when it can't find
certain information. e.g. on my machine without INET6 I'll get
a vague:
netstat: sysctlnametomib: No such file or directory
which doesn't help me determine the cause. The patch below will
expand it slightly (even if I'd rather not have the error in the
first place) to:
netstat: sysctlnametomib: net.inet6.tcp6.pcblist: No such file or directory
where I can immediately say, "ah, that's because my kernal doesn't
have INET6 option"
>How-To-Repeat:
Obvious, yes?
>Fix:
--- usr.bin/netstat/bpf.c.org 2005-09-05 14:56:30.000000000 +1000
+++ usr.bin/netstat/bpf.c 2005-09-19 17:14:19.000000000 +1000
@@ -91,7 +91,7 @@
sz = CTL_MAXNAME;
if (sysctlnametomib("net.bpf.peers", &name[0], &sz) == -1)
- err(1, "sysctlnametomib");
+ err(1, "sysctlnametomib: net.bpf.peers");
namelen = sz;
name[namelen++] = sizeof(*dpe);
--- usr.bin/netstat/inet.c.org 2005-08-15 11:35:11.000000000 +1000
+++ usr.bin/netstat/inet.c 2005-09-19 17:13:37.000000000 +1000
@@ -199,7 +199,7 @@
/* get dynamic pcblist node */
if (sysctlnametomib(mibname, mib, &namelen) == -1)
- err(1, "sysctlnametomib");
+ err(1, "sysctlnametomib: %s", mibname);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
NULL, 0) == -1)
--- usr.bin/netstat/inet6.c.org 2005-09-02 13:34:05.000000000 +1000
+++ usr.bin/netstat/inet6.c 2005-09-19 17:13:40.000000000 +1000
@@ -256,7 +256,7 @@
/* get dynamic pcblist node */
if (sysctlnametomib(mibname, mib, &namelen) == -1)
- err(1, "sysctlnametomib");
+ err(1, "sysctlnametomib: %s", mibname);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
NULL, 0) == -1)
--- usr.bin/netstat/unix.c.org 2005-09-05 14:56:30.000000000 +1000
+++ usr.bin/netstat/unix.c 2005-09-19 17:14:30.000000000 +1000
@@ -159,7 +159,7 @@
if (sysctlnametomib(mibname, mib,
&namelen) == -1)
- err(1, "sysctlnametomib");
+ err(1, "sysctlnametomib: %s", mibname);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
NULL, 0) == -1)