Make extra IPs from interfaces optional

This commit is contained in:
Viktor Liu 2025-01-03 16:54:46 +01:00
parent 62a20f5f1a
commit f69dd6fb62

View File

@ -89,11 +89,6 @@ func (m *localIPManager) UpdateLocalIPs(iface common.IFaceMapper) (err error) {
} }
}() }()
interfaces, err := net.Interfaces()
if err != nil {
return fmt.Errorf("get interfaces: %w", err)
}
var newIPv4Bitmap [1 << 16]uint32 var newIPv4Bitmap [1 << 16]uint32
ipv4Set := make(map[string]struct{}) ipv4Set := make(map[string]struct{})
var ipv4Addresses []string var ipv4Addresses []string
@ -104,8 +99,13 @@ func (m *localIPManager) UpdateLocalIPs(iface common.IFaceMapper) (err error) {
} }
} }
for _, intf := range interfaces { interfaces, err := net.Interfaces()
m.processInterface(intf, &newIPv4Bitmap, ipv4Set, &ipv4Addresses) if err != nil {
log.Warnf("failed to get interfaces: %v", err)
} else {
for _, intf := range interfaces {
m.processInterface(intf, &newIPv4Bitmap, ipv4Set, &ipv4Addresses)
}
} }
m.mu.Lock() m.mu.Lock()