NetBSD Problem Report #47704
From t-hash@abox3.so-net.ne.jp Thu Mar 28 21:07:19 2013
Return-Path: <t-hash@abox3.so-net.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id A0AE163F32B
for <gnats-bugs@gnats.NetBSD.org>; Thu, 28 Mar 2013 21:07:19 +0000 (UTC)
Message-Id: <201303282107.r2SL7D2g025160@ms-omx12.plus.so-net.ne.jp>
Date: Fri, 29 Mar 2013 06:07:13 +0900
From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
To: gnats-bugs@gnats.NetBSD.org
Subject: netstat ignores L option
>Number: 47704
>Category: bin
>Synopsis: netstat ignores L option
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 28 21:10:00 +0000 2013
>Closed-Date: Fri Dec 26 23:33:44 +0000 2014
>Last-Modified: Fri Dec 26 23:33:44 +0000 2014
>Originator: Takahiro Hayashi
>Release: NetBSD 6.99.17 (around Mar 17)
>Organization:
>Environment:
System: NetBSD halt 6.99.17 NetBSD 6.99.17 (UNION) #0: Sun Mar 17 14:09:02 JST 2013 root@halt:/usr/build2/obj.i386/sys/arch/i386/compile/UNION i386
Architecture: i386
Machine: i386
>Description:
The netstat(1) ignores option "-L" (dont show link-level routes).
The code handling option L is removed when cleaning up of
OSI network stack removal.
>How-To-Repeat:
run "netstat -nrL"
>Fix:
Re-add RTF_LLINFO handling to show.c.
or run "netstat -nrL | grep -v L"
Index: src/usr.bin/netstat/show.c
===================================================================
RCS file: /cvsroot/src/usr.bin/netstat/show.c,v
retrieving revision 1.15
diff -u -p -r1.15 show.c
--- src/usr.bin/netstat/show.c 11 Nov 2011 15:09:33 -0000 1.15
+++ src/usr.bin/netstat/show.c 28 Mar 2013 11:01:10 -0000
@@ -243,6 +243,9 @@ p_rtentry(struct rt_msghdr *rtm)
char ifbuf[IF_NAMESIZE];
+ if (Lflag && (rtm->rtm_flags & RTF_LLINFO))
+ return;
+
if (old_af != sa->sa_family) {
old_af = sa->sa_family;
pr_family(sa->sa_family);
>Release-Note:
>Audit-Trail:
From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: bin/47704: netstat ignores L option
Date: Fri, 29 Mar 2013 17:18:38 +0900
On Thu, 28 Mar 2013 21:10:01 +0000 (UTC)
I wrote:
> >Description:
> The netstat(1) ignores option "-L" (dont show link-level routes).
> The code handling option L is removed when cleaning up of
> OSI network stack removal.
This bug was appeared when changing to use sysctl based code,
not removal of OSI network stack.
The kmem based code has L option but sysctl based code does not.
Suggested by msaitoh@ thx.
--
t-hash
From: Takahiro HAYASHI <t.hash425@gmail.com>
To: gnats-bugs@NetBSD.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: bin/47704: netstat ignores L option
Date: Wed, 12 Nov 2014 12:00:00 +0900
Patch updated: sync with current netstat/route changes
Index: src/sbin/route/rtutil.c
===================================================================
RCS file: /cvsroot/src/sbin/route/rtutil.c,v
retrieving revision 1.2
diff -u -p -r1.2 rtutil.c
--- src/sbin/route/rtutil.c 8 Nov 2014 00:47:32 -0000 1.2
+++ src/sbin/route/rtutil.c 8 Nov 2014 02:47:14 -0000
@@ -261,6 +261,9 @@ p_rtentry(struct rt_msghdr *rtm, int fla
char ifbuf[IF_NAMESIZE];
#endif
+ if ((flags & RT_LFLAG) && (rtm->rtm_flags & RTF_LLINFO))
+ return;
+
if (old_af != sa->sa_family) {
old_af = sa->sa_family;
p_family(sa->sa_family);
Index: src/sbin/route/rtutil.h
===================================================================
RCS file: /cvsroot/src/sbin/route/rtutil.h,v
retrieving revision 1.1
diff -u -p -r1.1 rtutil.h
--- src/sbin/route/rtutil.h 6 Nov 2014 21:29:32 -0000 1.1
+++ src/sbin/route/rtutil.h 8 Nov 2014 02:47:14 -0000
@@ -34,6 +34,7 @@
#define RT_TFLAG 2
#define RT_VFLAG 4
#define RT_NFLAG 8
+#define RT_LFLAG __BIT(4) /* don't show LLINFO entries */
void p_rttables(int, int, int, int);
void p_rthdr(int, int);
Index: src/usr.bin/netstat/main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/netstat/main.c,v
retrieving revision 1.94
diff -u -p -r1.94 main.c
--- src/usr.bin/netstat/main.c 7 Nov 2014 12:42:27 -0000 1.94
+++ src/usr.bin/netstat/main.c 8 Nov 2014 02:47:14 -0000
@@ -454,7 +454,7 @@ main(int argc, char *argv[])
iflag = 1;
break;
case 'L':
- Lflag = 1;
+ Lflag = RT_LFLAG;
break;
case 'l':
lflag = 1;
@@ -639,7 +639,7 @@ main(int argc, char *argv[])
else {
if (use_sysctl)
p_rttables(af,
- nflag|tagflag|vflag, 0, ~0);
+ nflag|tagflag|vflag|Lflag, 0, ~0);
else
routepr(nl[N_RTREE].n_value);
}
Regards,
--
t-hash
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47704 CVS commit: src/sbin/route
Date: Tue, 11 Nov 2014 22:34:08 -0500
Module Name: src
Committed By: christos
Date: Wed Nov 12 03:34:08 UTC 2014
Modified Files:
src/sbin/route: route.8 route.c rtutil.c rtutil.h
Log Message:
PR/47704: Takahiro HAYASHI: Add -L flag
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sbin/route/route.8
cvs rdiff -u -r1.146 -r1.147 src/sbin/route/route.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/route/rtutil.c
cvs rdiff -u -r1.1 -r1.2 src/sbin/route/rtutil.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47704 CVS commit: src/usr.bin/netstat
Date: Tue, 11 Nov 2014 22:34:59 -0500
Module Name: src
Committed By: christos
Date: Wed Nov 12 03:34:59 UTC 2014
Modified Files:
src/usr.bin/netstat: main.c
Log Message:
PR/47704: Takahiro HAYASHI: Fix -L flag
To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/netstat/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Takahiro HAYASHI <t.hash425@gmail.com>
To: gnats-bugs@NetBSD.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: PR/47704 CVS commit: src/usr.bin/netstat
Date: Wed, 12 Nov 2014 20:37:09 +0900
On 11/12/14 12:40, Christos Zoulas wrote:
> The following reply was made to PR bin/47704; it has been noted by GNATS.
>
> From: "Christos Zoulas" <christos@netbsd.org>
> To: gnats-bugs@gnats.NetBSD.org
> Cc:
> Subject: PR/47704 CVS commit: src/usr.bin/netstat
> Date: Tue, 11 Nov 2014 22:34:59 -0500
>
> Module Name: src
> Committed By: christos
> Date: Wed Nov 12 03:34:59 UTC 2014
>
> Modified Files:
> src/usr.bin/netstat: main.c
>
> Log Message:
> PR/47704: Takahiro HAYASHI: Fix -L flag
Thank you for fixing this prob.
I've confirmed this is fixed on amd64.
--
t-hash
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 26 Dec 2014 23:33:44 +0000
State-Changed-Why:
confirmed fixed, thanks
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.