diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-11-11 03:13:20 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-11-15 23:40:47 +0100 |
commit | 111e0566dce3fc3489cb75ee40b752b1b738e9c6 (patch) | |
tree | 0a107f1c0617ffb22f13f659e38b10645568b60b | |
parent | e3134bf6659b13bbc4713fe2b9147463cc9ff374 (diff) |
device: make new peers inherit broken mobile semantics
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | device/device.go | 1 | ||||
-rw-r--r-- | device/mobilequirks.go | 3 | ||||
-rw-r--r-- | device/uapi.go | 1 |
3 files changed, 5 insertions, 0 deletions
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 { |