Created
November 11, 2021 01:48
-
-
Save josharian/7aac2021d419154d4b1d02e207e20335 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/device/device.go b/device/device.go | |
index 5644c8a..db017b6 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 AtomicBool | |
} | |
staticIdentity struct { | |
diff --git a/device/mobilequirks.go b/device/mobilequirks.go | |
index f27d9d7..1feadce 100644 | |
--- a/device/mobilequirks.go | |
+++ b/device/mobilequirks.go | |
@@ -14,3 +14,7 @@ func (device *Device) DisableSomeRoamingForBrokenMobileSemantics() { | |
} | |
device.peers.RUnlock() | |
} | |
+ | |
+func (device *Device) DisableAllRoaming() { | |
+ device.net.brokenRoaming.Set(true) | |
+} | |
diff --git a/device/peer.go b/device/peer.go | |
index c8b825d..4bdb202 100644 | |
--- a/device/peer.go | |
+++ b/device/peer.go | |
@@ -275,6 +275,9 @@ func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) { | |
return | |
} | |
peer.Lock() | |
+ defer peer.Unlock() | |
+ if peer.device.net.brokenRoaming.Get() { | |
+ return | |
+ } | |
peer.endpoint = endpoint | |
- peer.Unlock() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment