summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-05-08 19:35:12 +0000
committermelifaro <melifaro@FreeBSD.org>2014-05-08 19:35:12 +0000
commit0576e440912c1dc60e93e505b337ba5ce6f23148 (patch)
tree24a4db7a7d8960d039590cfdfd373acba8a7db28 /sbin
parent89bf7e80ea7ce88fd4bbd25c5f6576c40dea5acd (diff)
downloadFreeBSD-src-0576e440912c1dc60e93e505b337ba5ce6f23148.zip
FreeBSD-src-0576e440912c1dc60e93e505b337ba5ce6f23148.tar.gz
Merge r260524,r260540
r260524: Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8). r260540: Bump dates in nestat(1) and route(8) man pages. Fix several small errors introduced by r260524. Suggested by: glebius
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/keywords2
-rw-r--r--sbin/route/route.819
-rw-r--r--sbin/route/route.c24
3 files changed, 42 insertions, 3 deletions
diff --git a/sbin/route/keywords b/sbin/route/keywords
index adfba7c..676f781 100644
--- a/sbin/route/keywords
+++ b/sbin/route/keywords
@@ -1,6 +1,8 @@
# @(#)keywords 8.2 (Berkeley) 3/19/94
# $FreeBSD$
+4
+6
add
atalk
blackhole
diff --git a/sbin/route/route.8 b/sbin/route/route.8
index b786106..b194c75 100644
--- a/sbin/route/route.8
+++ b/sbin/route/route.8
@@ -28,7 +28,7 @@
.\" @(#)route.8 8.3 (Berkeley) 3/19/94
.\" $FreeBSD$
.\"
-.Dd November 17, 2012
+.Dd May 8, 2014
.Dt ROUTE 8
.Os
.Sh NAME
@@ -62,6 +62,14 @@ programmatic interface discussed in
.Pp
The following options are available:
.Bl -tag -width indent
+.It Fl 4
+Specify
+.Cm inet
+address family as family hint for subcommands.
+.It Fl 6
+Specify
+.Cm inet
+address family as family hint for subcommands.
.It Fl d
Run in debug-only mode, i.e., do not actually modify the routing table.
.It Fl n
@@ -142,6 +150,15 @@ or
.Fl inet
modifiers, only routes having destinations with addresses in the
delineated family will be deleted.
+Additionally,
+.Fl 4
+or
+.Fl 6
+can be used as aliases for
+.Fl inet
+and
+.Fl inet6
+modifiers.
When a
.Fl fib
option is specified, the operation will be applied to
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 6c2bbe2..35deba5 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -140,7 +140,7 @@ usage(const char *cp)
{
if (cp != NULL)
warnx("bad keyword: %s", cp);
- errx(EX_USAGE, "usage: route [-dnqtv] command [[modifiers] args]");
+ errx(EX_USAGE, "usage: route [-46dnqtv] command [[modifiers] args]");
/* NOTREACHED */
}
@@ -153,8 +153,24 @@ main(int argc, char **argv)
if (argc < 2)
usage(NULL);
- while ((ch = getopt(argc, argv, "nqdtv")) != -1)
+ while ((ch = getopt(argc, argv, "46nqdtv")) != -1)
switch(ch) {
+ case '4':
+#ifdef INET
+ af = AF_INET;
+ aflen = sizeof(struct sockaddr_in);
+#else
+ errx(1, "IPv4 support is not compiled in");
+#endif
+ break;
+ case '6':
+#ifdef INET6
+ af = AF_INET6;
+ aflen = sizeof(struct sockaddr_in6);
+#else
+ errx(1, "IPv6 support is not compiled in");
+#endif
+ break;
case 'n':
nflag = 1;
break;
@@ -368,11 +384,13 @@ flushroutes(int argc, char *argv[])
usage(*argv);
switch (keyword(*argv + 1)) {
#ifdef INET
+ case K_4:
case K_INET:
af = AF_INET;
break;
#endif
#ifdef INET6
+ case K_6:
case K_INET6:
af = AF_INET6;
break;
@@ -780,12 +798,14 @@ newroute(int argc, char **argv)
aflen = sizeof(struct sockaddr_dl);
break;
#ifdef INET
+ case K_4:
case K_INET:
af = AF_INET;
aflen = sizeof(struct sockaddr_in);
break;
#endif
#ifdef INET6
+ case K_6:
case K_INET6:
af = AF_INET6;
aflen = sizeof(struct sockaddr_in6);
OpenPOWER on IntegriCloud