diff options
author | bt90 <btom1990@googlemail.com> | 2023-08-21 16:49:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 14:49:28 +0000 |
commit | c2c6133aa576004641971e48d8596e523b1052ee (patch) | |
tree | 66d06d651d7fd8cf15dfbbadbd21cb23e52c974c | |
parent | ccec8a4cdb0f6a777084b1da01565bd2fa9d9a93 (diff) | |
download | syncthing-c2c6133aa576004641971e48d8596e523b1052ee.tar.gz syncthing-c2c6133aa576004641971e48d8596e523b1052ee.zip |
lib/osutil, lib/upnp: Check FlagRunning (fixes #8767) (#9047)
-rw-r--r-- | lib/osutil/net.go | 2 | ||||
-rw-r--r-- | lib/upnp/upnp.go | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/osutil/net.go b/lib/osutil/net.go index 214284cf5..eeb8bafde 100644 --- a/lib/osutil/net.go +++ b/lib/osutil/net.go @@ -18,7 +18,7 @@ func GetLans() ([]*net.IPNet, error) { var addrs []net.Addr for _, currentIf := range ifs { - if currentIf.Flags&net.FlagUp != net.FlagUp { + if currentIf.Flags&net.FlagRunning == 0 { continue } currentAddrs, err := currentIf.Addrs() diff --git a/lib/upnp/upnp.go b/lib/upnp/upnp.go index 0553dd9eb..d566ce0e4 100644 --- a/lib/upnp/upnp.go +++ b/lib/upnp/upnp.go @@ -47,7 +47,6 @@ import ( "sync" "time" - "github.com/syncthing/syncthing/lib/build" "github.com/syncthing/syncthing/lib/dialer" "github.com/syncthing/syncthing/lib/nat" "github.com/syncthing/syncthing/lib/osutil" @@ -100,7 +99,7 @@ func Discover(ctx context.Context, _, timeout time.Duration) []nat.Device { for _, intf := range interfaces { // Interface flags seem to always be 0 on Windows - if !build.IsWindows && (intf.Flags&net.FlagUp == 0 || intf.Flags&net.FlagMulticast == 0) { + if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 { continue } |