mirror of
https://github.com/syncthing/syncthing.git
synced 2025-12-23 22:18:14 -05:00
fix(beacon): skip point-to-point interfaces on Android (#10504)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/syncthing/syncthing/internal/slogutil"
|
"github.com/syncthing/syncthing/internal/slogutil"
|
||||||
|
"github.com/syncthing/syncthing/lib/build"
|
||||||
"github.com/syncthing/syncthing/lib/netutil"
|
"github.com/syncthing/syncthing/lib/netutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,6 +65,11 @@ func writeBroadcasts(ctx context.Context, inbox <-chan []byte, port int) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if build.IsAndroid && intf.Flags&net.FlagPointToPoint != 0 {
|
||||||
|
// skip cellular interfaces
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
addrs, err := netutil.InterfaceAddrsByInterface(&intf)
|
addrs, err := netutil.InterfaceAddrsByInterface(&intf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Debugln("Failed to list interface addresses:", err)
|
l.Debugln("Failed to list interface addresses:", err)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/syncthing/syncthing/lib/build"
|
||||||
"github.com/syncthing/syncthing/lib/netutil"
|
"github.com/syncthing/syncthing/lib/netutil"
|
||||||
|
|
||||||
"golang.org/x/net/ipv6"
|
"golang.org/x/net/ipv6"
|
||||||
@@ -74,6 +75,11 @@ func writeMulticasts(ctx context.Context, inbox <-chan []byte, addr string) erro
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if build.IsAndroid && intf.Flags&net.FlagPointToPoint != 0 {
|
||||||
|
// skip cellular interfaces
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
wcm.IfIndex = intf.Index
|
wcm.IfIndex = intf.Index
|
||||||
pconn.SetWriteDeadline(time.Now().Add(time.Second))
|
pconn.SetWriteDeadline(time.Now().Add(time.Second))
|
||||||
_, err = pconn.WriteTo(bs, wcm, gaddr)
|
_, err = pconn.WriteTo(bs, wcm, gaddr)
|
||||||
@@ -129,8 +135,12 @@ func readMulticasts(ctx context.Context, outbox chan<- recv, addr string) error
|
|||||||
pconn := ipv6.NewPacketConn(conn)
|
pconn := ipv6.NewPacketConn(conn)
|
||||||
joined := 0
|
joined := 0
|
||||||
for _, intf := range intfs {
|
for _, intf := range intfs {
|
||||||
if intf.Flags&net.FlagMulticast == 0 {
|
if intf.Flags&net.FlagRunning == 0 || intf.Flags&net.FlagMulticast == 0 {
|
||||||
slog.DebugContext(ctx, "Not joining multicast group on non-multicast interface", "name", intf.Name, slog.String("flags", intf.Flags.String()))
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if build.IsAndroid && intf.Flags&net.FlagPointToPoint != 0 {
|
||||||
|
// skip cellular interfaces
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user