Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/route PR/47704: Takahiro HAYASHI: Add -L flag



details:   https://anonhg.NetBSD.org/src/rev/4a25721edbcc
branches:  trunk
changeset: 333644:4a25721edbcc
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 12 03:34:08 2014 +0000

description:
PR/47704: Takahiro HAYASHI: Add -L flag

diffstat:

 sbin/route/route.8  |   8 +++++---
 sbin/route/route.c  |  16 ++++++++++------
 sbin/route/rtutil.c |   5 ++++-
 sbin/route/rtutil.h |   9 +++++----
 4 files changed, 24 insertions(+), 14 deletions(-)

diffs (131 lines):

diff -r 438ad8485106 -r 4a25721edbcc sbin/route/route.8
--- a/sbin/route/route.8        Wed Nov 12 03:24:25 2014 +0000
+++ b/sbin/route/route.8        Wed Nov 12 03:34:08 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: route.8,v 1.51 2014/11/07 14:57:08 christos Exp $
+.\"    $NetBSD: route.8,v 1.52 2014/11/12 03:34:08 christos Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)route.8    8.4 (Berkeley) 6/1/94
 .\"
-.Dd November 7, 2014
+.Dd November 11, 2014
 .Dt ROUTE 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd manually manipulate the routing tables
 .Sh SYNOPSIS
 .Nm
-.Op Fl dfnqSsTtv
+.Op Fl dfLnqSsTtv
 .Ar command
 .Oo
 .Op Ar modifiers
@@ -81,6 +81,8 @@
 commands,
 .Nm
 removes the routes before performing the command.
+.It Fl L
+Don't show link layer entries in routing table.
 .It Fl n
 Bypasses attempts to print host and network names symbolically
 when reporting actions.
diff -r 438ad8485106 -r 4a25721edbcc sbin/route/route.c
--- a/sbin/route/route.c        Wed Nov 12 03:24:25 2014 +0000
+++ b/sbin/route/route.c        Wed Nov 12 03:34:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.146 2014/11/07 14:57:08 christos Exp $     */
+/*     $NetBSD: route.c,v 1.147 2014/11/12 03:34:08 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)route.c    8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: route.c,v 1.146 2014/11/07 14:57:08 christos Exp $");
+__RCSID("$NetBSD: route.c,v 1.147 2014/11/12 03:34:08 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -126,15 +126,16 @@
 
 int    pid, rtm_addrs;
 int    sock;
-int    forcehost, forcenet, doflush, nflag, af, qflag, tflag, Sflag, Tflag;
-int    iflag, verbose, aflen = sizeof(struct sockaddr_in), rtag;
+int    forcehost, forcenet, doflush, af;
+int    iflag, Lflag, nflag, qflag, tflag, Sflag, Tflag;
+int    verbose, aflen = sizeof(struct sockaddr_in), rtag;
 int    locking, lockrest, debugonly, shortoutput;
 struct rt_metrics rt_metrics;
 int    rtm_inits;
 short ns_nullh[] = {0,0,0};
 short ns_bh[] = {-1,-1,-1};
 
-static const char opts[] = "dfnqSsTtv";
+static const char opts[] = "dfLnqSsTtv";
 
 void
 usage(const char *cp)
@@ -168,6 +169,9 @@
                case 'f':
                        doflush = 1;
                        break;
+               case 'L':
+                       Lflag = RT_LFLAG;
+                       break;
                case 'n':
                        nflag = RT_NFLAG;
                        break;
@@ -228,7 +232,7 @@
                return newroute(argc, argv);
 
        case K_SHOW:
-               show(argc, argv, nflag|Tflag|verbose);
+               show(argc, argv, Lflag|nflag|Tflag|verbose);
                return 0;
 
 #ifndef SMALL
diff -r 438ad8485106 -r 4a25721edbcc sbin/route/rtutil.c
--- a/sbin/route/rtutil.c       Wed Nov 12 03:24:25 2014 +0000
+++ b/sbin/route/rtutil.c       Wed Nov 12 03:34:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtutil.c,v 1.2 2014/11/08 00:47:32 christos Exp $      */
+/*     $NetBSD: rtutil.c,v 1.3 2014/11/12 03:34:08 christos Exp $      */
 /*     $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $        */
 
 /*
@@ -261,6 +261,9 @@
        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);
diff -r 438ad8485106 -r 4a25721edbcc sbin/route/rtutil.h
--- a/sbin/route/rtutil.h       Wed Nov 12 03:24:25 2014 +0000
+++ b/sbin/route/rtutil.h       Wed Nov 12 03:34:08 2014 +0000
@@ -30,10 +30,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define RT_AFLAG       1
-#define RT_TFLAG       2
-#define RT_VFLAG       4
-#define RT_NFLAG       8
+#define RT_AFLAG       __BIT(0)        /* show address field */
+#define RT_TFLAG       __BIT(1)        /* show tag field */
+#define RT_VFLAG       __BIT(2)        /* show verbose statistics */
+#define RT_NFLAG       __BIT(3)        /* numeric output */
+#define RT_LFLAG       __BIT(4)        /* don't show LLINFO entries */
 
 void p_rttables(int, int, int, int);
 void p_rthdr(int, int);



Home | Main Index | Thread Index | Old Index