Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8).
MFC after: 2 weeks
This commit is contained in:
parent
67619a4120
commit
17ed2e8ea8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260524
@ -1,6 +1,8 @@
|
|||||||
# @(#)keywords 8.2 (Berkeley) 3/19/94
|
# @(#)keywords 8.2 (Berkeley) 3/19/94
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
|
4
|
||||||
|
6
|
||||||
add
|
add
|
||||||
atalk
|
atalk
|
||||||
blackhole
|
blackhole
|
||||||
|
@ -62,6 +62,14 @@ programmatic interface discussed in
|
|||||||
.Pp
|
.Pp
|
||||||
The following options are available:
|
The following options are available:
|
||||||
.Bl -tag -width indent
|
.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
|
.It Fl d
|
||||||
Run in debug-only mode, i.e., do not actually modify the routing table.
|
Run in debug-only mode, i.e., do not actually modify the routing table.
|
||||||
.It Fl n
|
.It Fl n
|
||||||
@ -138,10 +146,20 @@ When the address family may is specified by any of the
|
|||||||
.Fl xns ,
|
.Fl xns ,
|
||||||
.Fl atalk ,
|
.Fl atalk ,
|
||||||
.Fl inet6 ,
|
.Fl inet6 ,
|
||||||
|
.Fl 6,
|
||||||
|
.Fl inet,
|
||||||
or
|
or
|
||||||
.Fl inet
|
.Fl 4
|
||||||
modifiers, only routes having destinations with addresses in the
|
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
|
When a
|
||||||
.Fl fib
|
.Fl fib
|
||||||
option is specified, the operation will be applied to
|
option is specified, the operation will be applied to
|
||||||
|
@ -154,7 +154,7 @@ usage(const char *cp)
|
|||||||
{
|
{
|
||||||
if (cp != NULL)
|
if (cp != NULL)
|
||||||
warnx("bad keyword: %s", cp);
|
warnx("bad keyword: %s", cp);
|
||||||
errx(EX_USAGE, "usage: route [-dnqtv] command [[modifiers] args]");
|
errx(EX_USAGE, "usage: route [-46dnqtv] command [[modifiers] args]");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,8 +167,24 @@ main(int argc, char **argv)
|
|||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
usage(NULL);
|
usage(NULL);
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "nqdtv")) != -1)
|
while ((ch = getopt(argc, argv, "46nqdtv")) != -1)
|
||||||
switch(ch) {
|
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':
|
case 'n':
|
||||||
nflag = 1;
|
nflag = 1;
|
||||||
break;
|
break;
|
||||||
@ -382,11 +398,13 @@ flushroutes(int argc, char *argv[])
|
|||||||
usage(*argv);
|
usage(*argv);
|
||||||
switch (keyword(*argv + 1)) {
|
switch (keyword(*argv + 1)) {
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
|
case K_4:
|
||||||
case K_INET:
|
case K_INET:
|
||||||
af = AF_INET;
|
af = AF_INET;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
|
case K_6:
|
||||||
case K_INET6:
|
case K_INET6:
|
||||||
af = AF_INET6;
|
af = AF_INET6;
|
||||||
break;
|
break;
|
||||||
@ -807,12 +825,14 @@ newroute(int argc, char **argv)
|
|||||||
aflen = sizeof(struct sockaddr_dl);
|
aflen = sizeof(struct sockaddr_dl);
|
||||||
break;
|
break;
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
|
case K_4:
|
||||||
case K_INET:
|
case K_INET:
|
||||||
af = AF_INET;
|
af = AF_INET;
|
||||||
aflen = sizeof(struct sockaddr_in);
|
aflen = sizeof(struct sockaddr_in);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
|
case K_6:
|
||||||
case K_INET6:
|
case K_INET6:
|
||||||
af = AF_INET6;
|
af = AF_INET6;
|
||||||
aflen = sizeof(struct sockaddr_in6);
|
aflen = sizeof(struct sockaddr_in6);
|
||||||
|
@ -350,9 +350,23 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
af = AF_UNSPEC;
|
af = AF_UNSPEC;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "AaBbdF:f:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
|
while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
|
||||||
!= -1)
|
!= -1)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
|
case '4':
|
||||||
|
#ifdef INET
|
||||||
|
af = AF_INET;
|
||||||
|
#else
|
||||||
|
errx(1, "IPv4 support is not compiled in");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
#ifdef INET6
|
||||||
|
af = AF_INET6;
|
||||||
|
#else
|
||||||
|
errx(1, "IPv6 support is not compiled in");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
Aflag = 1;
|
Aflag = 1;
|
||||||
break;
|
break;
|
||||||
@ -836,21 +850,21 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
||||||
"usage: netstat [-AaLnSTWx] [-f protocol_family | -p protocol]\n"
|
"usage: netstat [-46AaLnSTWx] [-f protocol_family | -p protocol]\n"
|
||||||
" [-M core] [-N system]",
|
" [-M core] [-N system]",
|
||||||
" netstat -i | -I interface [-abdhnW] [-f address_family]\n"
|
" netstat -i | -I interface [-46abdhnW] [-f address_family]\n"
|
||||||
" [-M core] [-N system]",
|
" [-M core] [-N system]",
|
||||||
" netstat -w wait [-I interface] [-d] [-M core] [-N system] [-q howmany]",
|
" netstat -w wait [-I interface] [-46d] [-M core] [-N system] [-q howmany]",
|
||||||
" netstat -s [-s] [-z] [-f protocol_family | -p protocol]\n"
|
" netstat -s [-s] [-46z] [-f protocol_family | -p protocol]\n"
|
||||||
" [-M core] [-N system]",
|
" [-M core] [-N system]",
|
||||||
" netstat -i | -I interface -s [-f protocol_family | -p protocol]\n"
|
" netstat -i | -I interface [-46s] [-f protocol_family | -p protocol]\n"
|
||||||
" [-M core] [-N system]",
|
" [-M core] [-N system]",
|
||||||
" netstat -m [-M core] [-N system]",
|
" netstat -m [-M core] [-N system]",
|
||||||
" netstat -B [-I interface]",
|
" netstat -B [-I interface]",
|
||||||
" netstat -r [-AanW] [-f address_family] [-M core] [-N system]",
|
" netstat -r [-46AanW] [-f address_family] [-M core] [-N system]",
|
||||||
" netstat -rs [-s] [-M core] [-N system]",
|
" netstat -rs [-s] [-M core] [-N system]",
|
||||||
" netstat -g [-W] [-f address_family] [-M core] [-N system]",
|
" netstat -g [-46W] [-f address_family] [-M core] [-N system]",
|
||||||
" netstat -gs [-s] [-f address_family] [-M core] [-N system]",
|
" netstat -gs [-46s] [-f address_family] [-M core] [-N system]",
|
||||||
" netstat -Q");
|
" netstat -Q");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ depending on the options for the information presented.
|
|||||||
.It Xo
|
.It Xo
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl AaLnSTWx
|
.Op Fl 46AaLnSTWx
|
||||||
.Op Fl f Ar protocol_family | Fl p Ar protocol
|
.Op Fl f Ar protocol_family | Fl p Ar protocol
|
||||||
.Op Fl M Ar core
|
.Op Fl M Ar core
|
||||||
.Op Fl N Ar system
|
.Op Fl N Ar system
|
||||||
@ -92,7 +92,7 @@ retransmits, out-of-order packets received, and zero-sized windows advertised.
|
|||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Fl i | I Ar interface
|
.Fl i | I Ar interface
|
||||||
.Op Fl abdhnW
|
.Op Fl 46abdhnW
|
||||||
.Op Fl f Ar address_family
|
.Op Fl f Ar address_family
|
||||||
.Ek
|
.Ek
|
||||||
.Xc
|
.Xc
|
||||||
@ -153,7 +153,7 @@ is also present, show the number of dropped packets.
|
|||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Fl s Op Fl s
|
.Fl s Op Fl s
|
||||||
.Op Fl z
|
.Op Fl 46z
|
||||||
.Op Fl f Ar protocol_family | Fl p Ar protocol
|
.Op Fl f Ar protocol_family | Fl p Ar protocol
|
||||||
.Op Fl M Ar core
|
.Op Fl M Ar core
|
||||||
.Op Fl N Ar system
|
.Op Fl N Ar system
|
||||||
@ -174,6 +174,7 @@ is also present, reset statistic counters after displaying them.
|
|||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Fl i | I Ar interface Fl s
|
.Fl i | I Ar interface Fl s
|
||||||
|
.Op Fl 46
|
||||||
.Op Fl f Ar protocol_family | Fl p Ar protocol
|
.Op Fl f Ar protocol_family | Fl p Ar protocol
|
||||||
.Op Fl M Ar core
|
.Op Fl M Ar core
|
||||||
.Op Fl N Ar system
|
.Op Fl N Ar system
|
||||||
@ -214,7 +215,7 @@ states.
|
|||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Fl r
|
.Fl r
|
||||||
.Op Fl AanW
|
.Op Fl 46AanW
|
||||||
.Op Fl F Ar fibnum
|
.Op Fl F Ar fibnum
|
||||||
.Op Fl f Ar address_family
|
.Op Fl f Ar address_family
|
||||||
.Op Fl M Ar core
|
.Op Fl M Ar core
|
||||||
@ -276,7 +277,7 @@ is repeated, counters with a value of zero are suppressed.
|
|||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Fl g
|
.Fl g
|
||||||
.Op Fl W
|
.Op Fl 46W
|
||||||
.Op Fl f Ar address_family
|
.Op Fl f Ar address_family
|
||||||
.Op Fl M Ar core
|
.Op Fl M Ar core
|
||||||
.Op Fl N Ar system
|
.Op Fl N Ar system
|
||||||
@ -295,7 +296,7 @@ address families.
|
|||||||
.Bk -words
|
.Bk -words
|
||||||
.Nm
|
.Nm
|
||||||
.Fl gs
|
.Fl gs
|
||||||
.Op Fl s
|
.Op Fl 46s
|
||||||
.Op Fl f Ar address_family
|
.Op Fl f Ar address_family
|
||||||
.Op Fl M Ar core
|
.Op Fl M Ar core
|
||||||
.Op Fl N Ar system
|
.Op Fl N Ar system
|
||||||
@ -324,6 +325,14 @@ The flags field shows available ISR handlers:
|
|||||||
.Pp
|
.Pp
|
||||||
Some options have the general meaning:
|
Some options have the general meaning:
|
||||||
.Bl -tag -width flag
|
.Bl -tag -width flag
|
||||||
|
.It Fl 4
|
||||||
|
Is shorthand for
|
||||||
|
.Fl f
|
||||||
|
.Ar inet
|
||||||
|
.It Fl 6
|
||||||
|
Is shorthand for
|
||||||
|
.Fl f
|
||||||
|
.Ar inet6
|
||||||
.It Fl f Ar address_family , Fl p Ar protocol
|
.It Fl f Ar address_family , Fl p Ar protocol
|
||||||
Limit display to those records
|
Limit display to those records
|
||||||
of the specified
|
of the specified
|
||||||
|
Loading…
Reference in New Issue
Block a user