]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: make new peers inherit broken mobile semantics
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 11 Nov 2021 02:13:20 +0000 (03:13 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 15 Nov 2021 22:40:47 +0000 (23:40 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
device/device.go
device/mobilequirks.go
device/uapi.go

index 7717494cf2844d6a952cd64ee2ede98a4bf79587..91654c6f5e3ffb0a5af532c4b5375c4ddf7db511 100644 (file)
@@ -44,6 +44,7 @@ type Device struct {
                netlinkCancel *rwcancel.RWCancel
                port          uint16 // listening port
                fwmark        uint32 // mark value (0 = disabled)
+               brokenRoaming bool
        }
 
        staticIdentity struct {
index f27d9d7009319a55b3c2a2ef3bac00881a6ddd48..680f5c7043a3ed2675b266a3bb30f95aab6d1e27 100644 (file)
@@ -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()
index 019249df394eeea1f6b08cefbf837550d7ae8338..e33355dec4dcd50dbe0ebddeec399427df8f55d9 100644 (file)
@@ -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 {