Skip to content

Replace stdlib net.Interface* with vishvananda/netlink to avoid blocked forever goroutines #15051

@brb

Description

@brb

Netlink is not reliable protocol, and recv without a timeout might block infinitely. See #14710 and #14746 (comment) for more ctx.

The Go's stdlib net.Interface*() function family when built for Linux (https://github.com/golang/go/blob/master/src/net/interface_linux.go) is using netlink socket w/o timeout to retrieve ifaces. Currently, we have the following net.Interface*() users in the code:

cilium@master > gg -l net.Interface
pkg/mcastmanager/mcastmanager_test.go
pkg/mtu/detect_linux.go
pkg/multicast/multicast.go
pkg/multicast/multicast_test.go
vendor/github.com/google/gopacket/layers/sflow.go
vendor/github.com/google/uuid/node_net.go
vendor/github.com/shirou/gopsutil/net/net.go
vendor/github.com/shirou/gopsutil/net/net_windows.go
vendor/github.com/vishvananda/netns/README.md
vendor/golang.org/x/net/icmp/helper_posix.go
vendor/golang.org/x/net/icmp/interface.go
vendor/golang.org/x/net/internal/socket/sys_posix.go
vendor/golang.org/x/net/ipv4/dgramopt.go
vendor/golang.org/x/net/ipv4/doc.go
vendor/golang.org/x/net/ipv4/sockopt_posix.go
vendor/golang.org/x/net/ipv4/sockopt_stub.go
vendor/golang.org/x/net/ipv4/sys_asmreq.go
vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go
vendor/golang.org/x/net/ipv4/sys_asmreqn.go
vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go
vendor/golang.org/x/net/ipv4/sys_ssmreq.go
vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go
vendor/golang.org/x/net/ipv6/dgramopt.go
vendor/golang.org/x/net/ipv6/doc.go
vendor/golang.org/x/net/ipv6/sockopt_posix.go
vendor/golang.org/x/net/ipv6/sockopt_stub.go
vendor/golang.org/x/net/ipv6/sys_asmreq.go
vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go
vendor/golang.org/x/net/ipv6/sys_ssmreq.go
vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go
vendor/k8s.io/apimachinery/pkg/util/net/interface.go

Once #14710 has been resolved, switch to vishvananda/netlink to avoid the blocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentCilium agent related.area/daemonImpacts operation of the Cilium daemon.kind/bugThis is a bug in the Cilium logic.pinnedThese issues are not marked stale by our issue bot.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions