lib/osutil, lib/upnp: Check FlagRunning (fixes #8767) (#9047)

This commit is contained in:
bt90 2023-08-21 16:49:28 +02:00 committed by GitHub
parent ccec8a4cdb
commit c2c6133aa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -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()

View File

@ -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
}