portlist: ignore ports bound to localhost

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-03-17 20:19:39 -07:00
committed by Brad Fitzpatrick
parent c706731dc7
commit f8d67bb591
5 changed files with 63 additions and 33 deletions

View File

@@ -59,6 +59,10 @@ func listPorts() (List, error) {
rem := words[2]
inode := words[9]
// If a port is bound to 127.0.0.1, ignore it.
if strings.HasPrefix(local, "0100007F:") {
continue
}
if rem != "00000000:0000" {
// not a "listener" port
continue