<div dir="ltr">Hi.<div><br></div><div>I'm not good enough in Android development to say for sure. I found a similar bud fixed different ways:</div><div>OpenVPN: <a href="https://github.com/schwabe/ics-openvpn/blob/450e99c135ebabbf911d6880e39811d88454cdd1/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java#L877">https://github.com/schwabe/ics-openvpn/blob/450e99c135ebabbf911d6880e39811d88454cdd1/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java#L877</a></div><div>Outline: <a href="https://github.com/Jigsaw-Code/outline-client/commit/3a9dad6a3cbe962cb10e443cfea21c929e98ef32">https://github.com/Jigsaw-Code/outline-client/commit/3a9dad6a3cbe962cb10e443cfea21c929e98ef32</a><br></div><div><br></div><div>Since OpenVPN uses the same I suppose it should help. But looks like it should still be wrapped with an Android version check.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">чт, 16 янв. 2020 г. в 01:29, Jason A. Donenfeld <<a href="mailto:Jason@zx2c4.com">Jason@zx2c4.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Andrey,<br>
<br>
Thanks for the bug report.<br>
<br>
On 1/13/20 12:00 AM, Andrey Kupreychik wrote:<br>
> My Android phone running wireguard VPN threats it as a metered <br>
> connection and does not do anything it should do on Wi-Fi only<br>
> <br>
> What I found is this discussion <br>
> <a href="https://issuetracker.google.com/issues/114309459" rel="noreferrer" target="_blank">https://issuetracker.google.com/issues/114309459</a><br>
> I've looked thru the GitHub mirror code and found no evidance of <br>
> setUnderlyingNetworks called in WireGuard client code.<br>
> <br>
> As seen in the issue tracker link above, it's needed in order to take <br>
> advantage of this <br>
> (<a href="https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn" rel="noreferrer" target="_blank">https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn</a>) <br>
> behavior change. As described in the issue tracker link, this prevents <br>
> Pie devices from properly using unmetered WiFi networks.<br>
<br>
Are you suggesting something like the below? According to the docs, the <br>
null value is the "default", and the others don't fit the wireguard <br>
model. Are you saying we should still be calling this anyway because the <br>
android system is expecting it?<br>
<br>
From 4ae0e9688e4edfdad06e6db49f414a95c5663d07 Mon Sep 17 00:00:00 2001<br>
From: "Jason A. Donenfeld" <<a href="mailto:Jason@zx2c4.com" target="_blank">Jason@zx2c4.com</a>><br>
Date: Wed, 15 Jan 2020 13:25:56 -0500<br>
Subject: [PATCH] GoBackend: set empty underlying networks<br>
<br>
<a href="https://lists.zx2c4.com/pipermail/wireguard/2020-January/004859.html" rel="noreferrer" target="_blank">https://lists.zx2c4.com/pipermail/wireguard/2020-January/004859.html</a><br>
<a href="https://issuetracker.google.com/issues/114309459" rel="noreferrer" target="_blank">https://issuetracker.google.com/issues/114309459</a><br>
<a href="https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn" rel="noreferrer" target="_blank">https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn</a><br>
<br>
Apparently we need to call this at least once.<br>
<br>
Reported-by: Andrey Kupreychik <<a href="mailto:foxel@quickfox.ru" target="_blank">foxel@quickfox.ru</a>><br>
---<br>
app/src/main/java/com/wireguard/android/backend/GoBackend.java | 1 +<br>
1 file changed, 1 insertion(+)<br>
<br>
diff --git <br>
a/app/src/main/java/com/wireguard/android/backend/GoBackend.java <br>
b/app/src/main/java/com/wireguard/android/backend/GoBackend.java<br>
index 3e8e1ec..3c4c893 100644<br>
--- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java<br>
+++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java<br>
@@ -224,6 +224,7 @@ public final class GoBackend implements Backend {<br>
<br>
currentTunnel = tunnel;<br>
<br>
+ service.setUnderlyingNetworks(null);<br>
service.protect(wgGetSocketV4(currentTunnelHandle));<br>
service.protect(wgGetSocketV6(currentTunnelHandle));<br>
} else {<br>
-- <br>
2.24.1<br>
<br>
<br>
Regards,<br>
Jason<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Andrey Kupreychik <<a href="mailto:foxel@quickfox.ru" target="_blank">foxel@quickfox.ru</a>><br><a href="http://foxel.quickfox.ru" target="_blank">http://foxel.quickfox.ru</a></div></div>