"Exclude Private IPs" in Android App

Denis Kisselev denis at dkisselev.net
Thu Jul 5 21:07:43 CEST 2018

Jason, that sounds like an amazing feature, but would it be possible with the current Go/Android VPN implementation?

In my (limited) experience, entering 2 or more comma-separated IP ranges does not work.
I get "Error bringing up tunnel: Bad Address" if I try to set Allowed IP's to "," but it works with "".

The Android VPN subsystem only seems to allow a single subnet in that parameter.

I'm running Wireguard for Android v0.0.20180625.
From: WireGuard <wireguard-bounces at lists.zx2c4.com> on behalf of Jason A. Donenfeld <Jason at zx2c4.com>
Sent: Thursday, July 5, 2018 10:46 AM
To: Eric Kuck
Cc: WireGuard mailing list
Subject: "Exclude Private IPs" in Android App

Hey Eric,

While you're iterating on the "Excluded Applications" feature, what
would you think of also taking a stab at the "Exclude Private IPs"
feature? It's kind of in the same ballpark and works over the same
code you're currently playing with.

First some background: Some people don't want packets intended for
their local network to go through a tunnel. On desktop linux's
wg-quick(8), this is the default with some very clever use of
ip-rule(8)'s suppress_prefixlength parameter. It works perfectly 100%
of the time, without any need for heuristics. I've written to the
folks I know working on Android's networking stack to allow for the
same kind of clever thing, but if that happens, it'd of course be
quite a ways off. So in the meantime, rather than introducing a switch
called "exclude local networks", which would have all sorts of races
with detecting local networks and making decisions about network types
and such, plus the need to toggle VpnService in a racy way, etc, I
have a much cleaner idea: "Exclude Private IPs".

"Exclude Private IPs" works in the most dumb and straightforward way
possible, that is guaranteed to not fail. We add a checkbox underneath
"AllowedIPs". The checkbox is visible if "" or ${MAGICRANGE}
is included in the AllowedIPs; otherwise it is hidden. When the
checkbox is checked, it replaces with ${MAGICRANGE}. When
the checkbox is unchecked, it replaces (after sorting) ${MAGICRANGE}
with "". ${MAGICRANGE} is defined to be modulo

I think this approach will be simple and consistent, and implementing
this as a static modification of AllowedIPs rather than runtime set
subtraction makes it more obvious what's going on.

What do you think of that idea?

WireGuard mailing list
WireGuard at lists.zx2c4.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20180705/77726f19/attachment.html>

More information about the WireGuard mailing list