portlist: reduce log spam on macOS

Running tailscaled on my machine yields lots of entries like:

weird: missing {tcp 6060}

parsePortsNetstat is filtering out loopback addresses as uninteresting.
Then addProcesses is surprised to discover these listening ports,
which results in spurious logging.
Teach addProcesses to also ignore loopback addresses.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder
2020-09-02 15:42:33 -07:00
committed by Josh Bleecher Snyder
parent 3b05cbacfb
commit a570c27577
2 changed files with 11 additions and 4 deletions

View File

@@ -95,9 +95,12 @@ func addProcesses(pl []Port) ([]Port, error) {
if port > 0 {
pp := ProtoPort{proto, uint16(port)}
p := m[pp]
if p != nil {
switch {
case p != nil:
p.Process = cmd
} else {
case isLoopbackAddr(val):
// ignore
default:
fmt.Fprintf(os.Stderr, "weird: missing %v\n", pp)
}
}