mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
usr.bin/netstat: -n should not print symbolic names
In numeric mode, the default route is printed as "default" rather than 0.0.0.0/0 or ::/0 From the man page: "-n: Show network addresses and ports as numbers. Normally netstat attempts to resolve addresses and ports, and display them symbolically. If the -n option is specified, the address is printed numerically, according to the address family. For more information regarding the Internet IPv4 ``dot format'', refer to inet(3). Unspecified, or `wildcard'', addresses and ports appear as `*''." Reported By: rgrimes Reviewed by: emaste, ngie, eadler, seanc Relnotes: yes Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D10320
This commit is contained in:
parent
6d77827b96
commit
9206c79961
@ -578,7 +578,7 @@ netname4(in_addr_t in, in_addr_t mask)
|
||||
struct netent *np = 0;
|
||||
in_addr_t i;
|
||||
|
||||
if (in == INADDR_ANY && mask == 0) {
|
||||
if (!numeric_addr && in == INADDR_ANY && mask == 0) {
|
||||
strlcpy(line, "default", sizeof(line));
|
||||
return (line);
|
||||
}
|
||||
@ -673,7 +673,8 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask)
|
||||
else
|
||||
masklen = 128;
|
||||
|
||||
if (masklen == 0 && IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr))
|
||||
if (!numeric_addr && masklen == 0 &&
|
||||
IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr))
|
||||
return("default");
|
||||
|
||||
getnameinfo((struct sockaddr *)sa6, sa6->sin6_len, nline, sizeof(nline),
|
||||
|
Loading…
Reference in New Issue
Block a user