-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VPN-6523: Fix Android LAN exclusions #9757
Conversation
7913e85
to
b6c3b51
Compare
const auto localRoutes = Controller::getExcludedIPAddressRanges().flatten(); | ||
const auto fullAllowedIPs = | ||
IPAddress::excludeAddresses(config.m_allowedIPAddressRanges, localRoutes); | ||
// This could be done better with VpnService.Builder.excludeRoute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually went down the rabbit hole of implementing this with VpnService.Builder.excludeRoute()
and it worked great, and only afterwards did I realize that it requires a higher API level than we ship with. So this implementation here is just crudely working around the issue, but in a way that doesn't require a change to our minimum Android version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions answered via real time convo. Thanks!
Description
In PR #9674 we tried to improve the LAN exclusion implementation for Windows and Linux. However, this introduced a bug in Android where the LAN exclusion calculation would cause routes to the internal Mulvad network to get lost. This causes the VPN's connectivity checks to fail, and results in the client entering the
No Signal
state shortly after connecting.The cause of the bug is that
IPAddress::excludeAddresses()
doesn't handle routes nested inside an excluded route. For example,excludeAddresses({"0.0.0.0/0", "10.64.0.1/32"},{"10.0.0.0/8"})
will ignore the route to10.64.0.1
because it is excluded by10.0.0.0/8
despite having a longer prefix length.Reference
JIRA issue: VPN-6523
Previous PR: #9674
Checklist