Date: Wed, 22 Feb 2006 15:50:17 +0200 From: Nikos Vassiliadis <nvass@teledomenet.gr> To: freebsd-hackers@freebsd.org Subject: (feature change request) remove link-layer generated routes from netstat -r Message-ID: <200602221550.17842.nvass@teledomenet.gr>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi,
netstat -r prints link-layer generated routes and many
times the output becomes somehow obscure. For
example:
root@brad:0:/usr/home/src/FreeBSD-6/src/usr.bin/netstat# netstat -ranfinet
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 10.1.1.244 UGS 0 31016 rl0
10.1.1/24 link#1 UC 0 0 rl0
10.1.1.181 00:0f:1f:fb:02:f5 UHLW 1 0 rl0
10.1.1.182 00:e0:fc:38:d4:40 UHLW 1 0 rl0
10.1.1.183 00:e0:fc:65:07:fd UHLW 1 0 rl0
10.1.1.244 00:50:fc:fe:74:3b UHLW 2 1 rl0
10.1.1.254 00:0c:cf:70:50:06 UHLW 1 0 rl0
127.0.0.1 127.0.0.1 UH 0 1117 lo0
192.168.1 link#5 UC 0 0 fxp0
192.168.1.25 00:05:5d:4d:19:58 UHLW 1 0 fxp0
192.168.1.45 00:11:43:b6:a1:55 UHLW 1 0 fxp0
192.168.1.71 00:0c:f1:b9:38:50 UHLW 1 1645 fxp0
192.168.1.84 00:04:23:af:79:66 UHLW 1 0 fxp0
192.168.1.112 00:30:4f:21:3b:8a UHLW 1 0 fxp0
192.168.1.196 00:07:e9:40:1f:c5 UHLW 1 0 fxp0
192.168.1.199 00:e0:81:21:28:21 UHLW 1 0 fxp0
192.168.1.200 00:30:4f:03:88:03 UHLW 1 0 fxp0
when the information I was actually looking for is:
root@brad:0:/usr/home/src/FreeBSD-6/src/usr.bin/netstat# netstat -rnfinet
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 10.1.1.244 UGS 0 31016 rl0
10.1.1/24 link#1 UC 0 0 rl0
127.0.0.1 127.0.0.1 UH 0 1117 lo0
192.168.1 link#5 UC 0 0 fxp0
root@brad:0:/usr/home/src/FreeBSD-6/src/usr.bin/netstat#
The attachment patch ("cvs diff -u -rHEAD route.c" generated) prints
link-layer generated routes when -a is specified and ignores them
the rest of the time.
Thoughts? POLA violation?
Nikos
[-- Attachment #2 --]
Index: route.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/route.c,v
retrieving revision 1.76
diff -u -r1.76 route.c
--- route.c 13 May 2005 16:31:10 -0000 1.76
+++ route.c 22 Feb 2006 13:35:39 -0000
@@ -285,11 +285,16 @@
int len;
/*
- * Don't print protocol-cloned routes unless -a.
+ * Don't print protocol-cloned routes and
+ * link-layer generated routes unless -a.
*/
- if (rt->rt_flags & RTF_WASCLONED && !aflag) {
- kget(rt->rt_parent, parent);
- if (parent.rt_flags & RTF_PRCLONING)
+ if (!aflag) {
+ if (rt->rt_flags & RTF_WASCLONED) {
+ kget(rt->rt_parent, parent);
+ if (parent.rt_flags & RTF_PRCLONING)
+ return;
+ }
+ if (rt->rt_flags & RTF_LLINFO)
return;
}
@@ -712,11 +717,16 @@
sa_u addr, mask;
/*
- * Don't print protocol-cloned routes unless -a.
+ * Don't print protocol-cloned routes and
+ * link-layer generated routes unless -a.
*/
- if (rt->rt_flags & RTF_WASCLONED && !aflag) {
- kget(rt->rt_parent, parent);
- if (parent.rt_flags & RTF_PRCLONING)
+ if (!aflag) {
+ if (rt->rt_flags & RTF_WASCLONED) {
+ kget(rt->rt_parent, parent);
+ if (parent.rt_flags & RTF_PRCLONING)
+ return;
+ }
+ if (rt->rt_flags & RTF_LLINFO)
return;
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602221550.17842.nvass>
