Subject: Re: inet6 userland and non-inet6 kernel
To: None <current-users@netbsd.org>
From: Rui Paulo <rpaulo@fnop.net>
List: current-users
Date: 05/28/2006 15:31:53
At Sat, 27 May 2006 18:04:18 +0200,
Jukka Salmi wrote:
>
> Index: usr.bin/netstat/inet6.c
> ===================================================================
> RCS file: /cvsroot/src/usr.bin/netstat/inet6.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 inet6.c
> --- usr.bin/netstat/inet6.c 21 May 2006 21:01:56 -0000 1.37
> +++ usr.bin/netstat/inet6.c 27 May 2006 16:03:24 -0000
> @@ -123,6 +123,7 @@ extern char *tcpstates[];
> #include <netdb.h>
>
> #include <err.h>
> +#include <errno.h>
> #include <kvm.h>
> #include <stdio.h>
> #include <stdlib.h>
> @@ -248,6 +249,7 @@ ip6protopr(off, name)
> int mib[8];
> size_t namelen = 0, size = 0, i;
> char *mibname = NULL;
> + extern int errno;
You don't need to do this, at least for NetBSD, if you include <errno.h>.
>
> memset(mib, 0, sizeof(mib));
>
> @@ -255,8 +257,10 @@ ip6protopr(off, name)
> err(1, "asprintf");
>
> /* get dynamic pcblist node */
> - if (sysctlnametomib(mibname, mib, &namelen) == -1)
> + if (sysctlnametomib(mibname, mib, &namelen) == -1) {
> + if (errno == ENOENT) return;
> err(1, "sysctlnametomib");
> + }
>
> if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
> NULL, 0) == -1)
Besides the style nit, I think the rest is fine.
I'll commit it soon.
--
Rui Paulo <rpaulo@{fnop.net,NetBSD.org}>