usr.bin/netstat: -n should not print symbolic names
AcceptedPublic

Authored by allanjude on Apr 8 2017, 4:12 PM.

Details

Summary

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

Diff Detail

allanjude created this revision.Apr 8 2017, 4:12 PM
ngie accepted this revision.Apr 10 2017, 12:58 AM
This revision is now accepted and ready to land.Apr 10 2017, 12:58 AM
ngie added a comment.Jul 10 2017, 1:39 AM

Ping (shouldn't this be committed)?

In my review of other systems the printing of "default" for this is common and has a long history, changing it at this point in the game would probably be a POLA and possibly break some scripts. I have worked around the issue that caused me to notice this in another way.

We may want to change this into a man page fix that adds the fact that 0.0.0.0/0 is printed as "default" even with the -n option.

ngie added a comment.Jul 10 2017, 8:42 PM

In my review of other systems the printing of "default" for this is common and has a long history, changing it at this point in the game would probably be a POLA and possibly break some scripts. I have worked around the issue that caused me to notice this in another way.

We may want to change this into a man page fix that adds the fact that 0.0.0.0/0 is printed as "default" even with the -n option.

  • Fedora Linux 22 does the conversion when -n isn't specified and doesn't do the conversion when it's specified.
  • NetBSD 7.x has the same bug as FreeBSD.

I think for the sake of correctness we should do what this CR suggests and follow Linux's lead.

emaste accepted this revision.Dec 5 2017, 8:29 PM

I agree with @ngie.

Also, definitely needs release notes.