From 599e84f19471ba7d6e55940aaa171891bfde6548 Mon Sep 17 00:00:00 2001 From: Cezar Craciunoiu Date: Wed, 8 Jan 2025 16:43:54 +0200 Subject: [PATCH] net/netmon: Do not iterate over problematic interfaces Iterating interfaces happens unrelated to the previous problematic interface check. Check here also to save time on initialization. Updates #1552 Signed-off-by: Cezar Craciunoiu --- net/netmon/state.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netmon/state.go b/net/netmon/state.go index d9b360f5e..c1a995027 100644 --- a/net/netmon/state.go +++ b/net/netmon/state.go @@ -188,6 +188,9 @@ func ForeachInterface(fn func(Interface, []netip.Prefix)) error { // the interface, and Bits are the subnet mask. func (ifaces InterfaceList) ForeachInterface(fn func(Interface, []netip.Prefix)) error { for _, iface := range ifaces { + if isProblematicInterface(iface.Interface) { + continue + } addrs, err := iface.Addrs() if err != nil { return err