lib/beacon, lib/discover: Send IPv4 limited broadcast when address listing fails (fixes #1628) (#9087)

This commit is contained in:
bt90
2023-09-12 14:28:17 +02:00
committed by GitHub
parent 415f320005
commit ed66fba42b
3 changed files with 20 additions and 21 deletions
+6 -4
View File
@@ -46,8 +46,9 @@ func writeBroadcasts(ctx context.Context, inbox <-chan []byte, port int) error {
intfs, err := net.Interfaces()
if err != nil {
l.Debugln(err)
return err
l.Debugln("Failed to list interfaces:", err)
// net.Interfaces() is broken on Android. see https://github.com/golang/go/issues/40569
// Use the general broadcast address 255.255.255.255 instead.
}
var dsts []net.IP
@@ -58,8 +59,9 @@ func writeBroadcasts(ctx context.Context, inbox <-chan []byte, port int) error {
addrs, err := intf.Addrs()
if err != nil {
l.Debugln(err)
return err
l.Debugln("Failed to list interface addresses:", err)
// Interface discovery might work while retrieving the addresses doesn't. So log the error and carry on.
continue
}
for _, addr := range addrs {