From ccf091e4a6b19c9ffa9cae34634e506f7e8de77c Mon Sep 17 00:00:00 2001 From: Jordan Whited Date: Thu, 15 Aug 2024 14:54:25 -0700 Subject: [PATCH] wgengine/magicsock: don't upgrade to linuxBatchingConn on Android (#13161) In a93dc6cdb10bcc87742011d3746660f06cf8cd1e tryUpgradeToBatchingConn() moved to build tag gated files, but the runtime.GOOS condition excluding Android was removed unintentionally from batching_conn_linux.go. Add it back. Updates tailscale/corp#22348 Signed-off-by: Jordan Whited --- wgengine/magicsock/batching_conn_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wgengine/magicsock/batching_conn_linux.go b/wgengine/magicsock/batching_conn_linux.go index 2b58256b2..25bf974b0 100644 --- a/wgengine/magicsock/batching_conn_linux.go +++ b/wgengine/magicsock/batching_conn_linux.go @@ -9,6 +9,7 @@ import ( "fmt" "net" "net/netip" + "runtime" "strings" "sync" "sync/atomic" @@ -366,6 +367,10 @@ func setGSOSizeInControl(control *[]byte, gsoSize uint16) { // tryUpgradeToBatchingConn probes the capabilities of the OS and pconn, and // upgrades pconn to a *linuxBatchingConn if appropriate. func tryUpgradeToBatchingConn(pconn nettype.PacketConn, network string, batchSize int) nettype.PacketConn { + if runtime.GOOS != "linux" { + // Exclude Android. + return pconn + } if network != "udp4" && network != "udp6" { return pconn }