Skip to content

Commit

Permalink
Skipping the IPs assigned to interfaces in the DOWN state while resol…
Browse files Browse the repository at this point in the history
…ving `0.0.0.0` in TCP LISTEN sockets (coroot/coroot#22)
  • Loading branch information
apetruhin committed Mar 2, 2023
1 parent 920bf23 commit 674a5a5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proc/ns.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func GetNsIps(ns netns.NsHandle) ([]netaddr.IP, error) {
}
var res []netaddr.IP
for _, link := range links {
attrs := link.Attrs()
if attrs.OperState == netlink.OperDown {
continue
}
addrs, err := h.AddrList(link, unix.AF_UNSPEC)
if err != nil {
return nil, err
Expand Down

0 comments on commit 674a5a5

Please sign in to comment.