Page MenuHomeFreeBSD

netstat: restore printing the "default" keyword, provide -nn option
ClosedPublic

Authored by glebius on Thu, Jan 30, 5:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 6, 12:10 PM
Unknown Object (File)
Tue, Feb 4, 7:46 PM
Unknown Object (File)
Mon, Feb 3, 6:49 PM
Unknown Object (File)
Sun, Feb 2, 8:22 PM
Unknown Object (File)
Sun, Feb 2, 3:01 PM
Unknown Object (File)
Sun, Feb 2, 2:21 PM
Unknown Object (File)
Sun, Feb 2, 11:06 AM
Unknown Object (File)
Sun, Feb 2, 10:55 AM

Details

Summary

Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself. There are scripts in the wild that rely
on the behavior.

Provide option to specify -nn twice to have a completely numeric
output of the routing tables.

Fixes: 9206c79961986c2114a9a2cfccf009ac010ad259

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

glebius created this revision.

Restore tests that were broken by 9206c7996198. This is partial revert
of 81b076e43aa63ac255996093233ab3560a23977e and a full one revert of
e090646d6f5a4a6848ecd4bcb1f2db498ea3b3e2.

markj added inline comments.
usr.bin/netstat/netstat.1
875
This revision is now accepted and ready to land.Thu, Jan 30, 6:36 PM
This revision now requires review to proceed.Thu, Jan 30, 6:42 PM

OK. We should really have a test for -nn though.

usr.bin/netstat/main.c
210โ€“211

What do we gain from making it a u_int? it doesn't need to be signed, indeed, but overflow is implausible either way.

This revision is now accepted and ready to land.Thu, Jan 30, 7:54 PM
usr.bin/netstat/main.c
210โ€“211

What do we gain from having it signed? Ideally all the flag options up and down should be bools, and only this one should take more than two values.

P.S. I can revert it back to original, if that helps the review process.

This seems like the best approach to avoid surprising users and breaking scripts.

P.S. I can revert it back to original, if that helps the review process.

I don't insist and am happy for you to go ahead with this - it's more the inconsistency of having a combination of int, u_int, and bool. This can be something that folks look at after this change.

I dislike the default, but I think -nn is a good tradeoff.