diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2014-01-10 23:08:18 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2014-01-10 23:08:18 +0000 |
commit | 17ed2e8ea8d7432c4312ef81b07236cac96d965a (patch) | |
tree | f4617f8897892f4bfd8d685e4ce507b3239d0b82 /sbin/route | |
parent | 67619a4120eb99647d806a73a9967370e10db67a (diff) | |
download | src-17ed2e8ea8d7432c4312ef81b07236cac96d965a.tar.gz src-17ed2e8ea8d7432c4312ef81b07236cac96d965a.zip |
Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8).
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=260524
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/keywords | 2 | ||||
-rw-r--r-- | sbin/route/route.8 | 22 | ||||
-rw-r--r-- | sbin/route/route.c | 24 |
3 files changed, 44 insertions, 4 deletions
diff --git a/sbin/route/keywords b/sbin/route/keywords index f3fd1d8e0058..bb0968b8b7f4 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 ea41cb6c1dae..8906cf7a090a 100644 --- a/sbin/route/route.8 +++ b/sbin/route/route.8 @@ -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 @@ -138,10 +146,20 @@ When the address family may is specified by any of the .Fl xns , .Fl atalk , .Fl inet6 , +.Fl 6, +.Fl inet, or -.Fl inet +.Fl 4 modifiers, only routes having destinations with addresses in the -delineated family will be deleted. +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 2a76932f68cc..d3be6b7dbeb3 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -154,7 +154,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 */ } @@ -167,8 +167,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; @@ -382,11 +398,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; @@ -807,12 +825,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); |