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.

Modified files:

Index: src/sbin/route/route.8
diff -u src/sbin/route/route.8:1.51 src/sbin/route/route.8:1.52
--- src/sbin/route/route.8:1.51	Fri Nov  7 09:57:08 2014
+++ src/sbin/route/route.8	Tue Nov 11 22:34:08 2014
@@ -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 @@ or
 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.

Index: src/sbin/route/route.c
diff -u src/sbin/route/route.c:1.146 src/sbin/route/route.c:1.147
--- src/sbin/route/route.c:1.146	Fri Nov  7 09:57:08 2014
+++ src/sbin/route/route.c	Tue Nov 11 22:34:08 2014
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #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 @@ static void sockaddr(const char *, struc
 
 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 @@ main(int argc, char * const *argv)
 		case 'f':
 			doflush = 1;
 			break;
+		case 'L':
+			Lflag = RT_LFLAG;
+			break;
 		case 'n':
 			nflag = RT_NFLAG;
 			break;
@@ -228,7 +232,7 @@ main(int argc, char * const *argv)
 		return newroute(argc, argv);
 
 	case K_SHOW:
-		show(argc, argv, nflag|Tflag|verbose);
+		show(argc, argv, Lflag|nflag|Tflag|verbose);
 		return 0;
 
 #ifndef SMALL

Index: src/sbin/route/rtutil.c
diff -u src/sbin/route/rtutil.c:1.2 src/sbin/route/rtutil.c:1.3
--- src/sbin/route/rtutil.c:1.2	Fri Nov  7 19:47:32 2014
+++ src/sbin/route/rtutil.c	Tue Nov 11 22:34:08 2014
@@ -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 @@ 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
diff -u src/sbin/route/rtutil.h:1.1 src/sbin/route/rtutil.h:1.2
--- src/sbin/route/rtutil.h:1.1	Thu Nov  6 16:29:32 2014
+++ src/sbin/route/rtutil.h	Tue Nov 11 22:34:08 2014
@@ -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);

Reply via email to