From 111e0566dce3fc3489cb75ee40b752b1b738e9c6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 11 Nov 2021 03:13:20 +0100 Subject: device: make new peers inherit broken mobile semantics Signed-off-by: Jason A. Donenfeld --- device/device.go | 1 + device/mobilequirks.go | 3 +++ device/uapi.go | 1 + 3 files changed, 5 insertions(+) diff --git a/device/device.go b/device/device.go index 7717494..91654c6 100644 --- a/device/device.go +++ b/device/device.go @@ -44,6 +44,7 @@ type Device struct { netlinkCancel *rwcancel.RWCancel port uint16 // listening port fwmark uint32 // mark value (0 = disabled) + brokenRoaming bool } staticIdentity struct { diff --git a/device/mobilequirks.go b/device/mobilequirks.go index f27d9d7..680f5c7 100644 --- a/device/mobilequirks.go +++ b/device/mobilequirks.go @@ -5,7 +5,10 @@ package device +// DisableSomeRoamingForBrokenMobileSemantics should ideally be called before peers are created, +// though it will try to deal with it, and race maybe, if called after. func (device *Device) DisableSomeRoamingForBrokenMobileSemantics() { + device.net.brokenRoaming = true device.peers.RLock() for _, peer := range device.peers.keyMap { peer.Lock() diff --git a/device/uapi.go b/device/uapi.go index 019249d..e33355d 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -261,6 +261,7 @@ func (peer *ipcSetPeer) handlePostConfig() { if peer.Peer == nil { return } + peer.disableRoaming = peer.device.net.brokenRoaming && peer.endpoint != nil if !peer.dummy && peer.device.isUp() { peer.Start() if peer.pkaOn { -- cgit v1.2.3