From 3147285c60ffe899e27495b8b6f5632f7b25e69b Mon Sep 17 00:00:00 2001 From: bt90 Date: Tue, 22 Aug 2023 11:27:43 +0200 Subject: [PATCH] lib/beacon: Check FlagRunning (#9051) --- lib/beacon/broadcast.go | 2 +- lib/beacon/multicast.go | 2 +- lib/upnp/upnp.go | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/beacon/broadcast.go b/lib/beacon/broadcast.go index 65687a959..e580bb7f1 100644 --- a/lib/beacon/broadcast.go +++ b/lib/beacon/broadcast.go @@ -52,7 +52,7 @@ func writeBroadcasts(ctx context.Context, inbox <-chan []byte, port int) error { var dsts []net.IP for _, intf := range intfs { - if intf.Flags&net.FlagBroadcast == 0 { + if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagBroadcast == 0 { continue } diff --git a/lib/beacon/multicast.go b/lib/beacon/multicast.go index 6e8501d00..4a2804c0d 100644 --- a/lib/beacon/multicast.go +++ b/lib/beacon/multicast.go @@ -67,7 +67,7 @@ func writeMulticasts(ctx context.Context, inbox <-chan []byte, addr string) erro success := 0 for _, intf := range intfs { - if intf.Flags&net.FlagMulticast == 0 { + if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 { continue } diff --git a/lib/upnp/upnp.go b/lib/upnp/upnp.go index d566ce0e4..3ceafb5f7 100644 --- a/lib/upnp/upnp.go +++ b/lib/upnp/upnp.go @@ -98,7 +98,6 @@ func Discover(ctx context.Context, _, timeout time.Duration) []nat.Device { wg := &sync.WaitGroup{} for _, intf := range interfaces { - // Interface flags seem to always be 0 on Windows if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 { continue }