WireGuard Archive on lore.kernel.org
 help / color / Atom feed
* Bug report: WireGuard client not setting underlying network on Android Pie
@ 2020-01-13  5:00 Andrey Kupreychik
  2020-01-15 18:29 ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Kupreychik @ 2020-01-13  5:00 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1.1: Type: text/plain, Size: 714 bytes --]

My Android phone running wireguard VPN threats it as a metered connection
and does not do anything it should do on Wi-Fi only

What I found is this discussion
https://issuetracker.google.com/issues/114309459
I've looked thru the GitHub mirror code and found no evidance of
setUnderlyingNetworks called in WireGuard client code.

As seen in the issue tracker link above, it's needed in order to take
advantage of this (
https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn)
behavior change. As described in the issue tracker link, this prevents Pie
devices from properly using unmetered WiFi networks.

-- 
Andrey Kupreychik <foxel@quickfox.ru>
http://foxel.quickfox.ru

[-- Attachment #1.2: Type: text/html, Size: 2402 bytes --]

<div dir="ltr"><p class="gmail-_1qeIAgB0cPwnLhDF9XSiJM" style="margin:0px;padding:0px 0px 0.25em;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;font-size:14px;line-height:inherit;font-family:&quot;Noto Sans&quot;,Arial,sans-serif;vertical-align:baseline;color:rgb(26,26,27)">My Android phone running wireguard VPN threats it as a metered connection and does not do anything it should do on Wi-Fi only</p><p class="gmail-_1qeIAgB0cPwnLhDF9XSiJM" style="margin:0px;padding:0px 0px 0.25em;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;font-size:14px;line-height:inherit;font-family:&quot;Noto Sans&quot;,Arial,sans-serif;vertical-align:baseline;color:rgb(26,26,27)">What I found is this discussion <a href="https://issuetracker.google.com/issues/114309459" class="gmail-_3t5uN8xUmg0TOwRCOGQEcU" rel="noopener noreferrer" target="_blank" style="font:inherit;margin:0px;padding:0px;border:0px;vertical-align:baseline">https://issuetracker.google.com/issues/114309459</a><br>I&#39;ve looked thru the GitHub mirror code and found no evidance of setUnderlyingNetworks called in WireGuard client code. </p><p class="gmail-_1qeIAgB0cPwnLhDF9XSiJM" style="margin:0px;padding:0px 0px 0.25em;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;font-size:14px;line-height:inherit;font-family:&quot;Noto Sans&quot;,Arial,sans-serif;vertical-align:baseline;color:rgb(26,26,27)">As seen in the issue tracker link above, it&#39;s needed in order to take advantage of this (<a href="https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn" class="gmail-_3t5uN8xUmg0TOwRCOGQEcU" rel="noopener noreferrer" target="_blank" style="font:inherit;margin:0px;padding:0px;border:0px;vertical-align:baseline">https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn</a>) behavior change. As described in the issue tracker link, this prevents Pie devices from properly using unmetered WiFi networks.</p><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Andrey Kupreychik &lt;<a href="mailto:foxel@quickfox.ru" target="_blank">foxel@quickfox.ru</a>&gt;<br><a href="http://foxel.quickfox.ru" target="_blank">http://foxel.quickfox.ru</a></div></div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug report: WireGuard client not setting underlying network on Android Pie
  2020-01-13  5:00 Bug report: WireGuard client not setting underlying network on Android Pie Andrey Kupreychik
@ 2020-01-15 18:29 ` Jason A. Donenfeld
  2020-01-23  6:47   ` Andrey Kupreychik
  0 siblings, 1 reply; 4+ messages in thread
From: Jason A. Donenfeld @ 2020-01-15 18:29 UTC (permalink / raw)
  To: Andrey Kupreychik, wireguard

Hi Andrey,

Thanks for the bug report.

On 1/13/20 12:00 AM, Andrey Kupreychik wrote:
> My Android phone running wireguard VPN threats it as a metered 
> connection and does not do anything it should do on Wi-Fi only
> 
> What I found is this discussion 
> https://issuetracker.google.com/issues/114309459
> I've looked thru the GitHub mirror code and found no evidance of 
> setUnderlyingNetworks called in WireGuard client code.
> 
> As seen in the issue tracker link above, it's needed in order to take 
> advantage of this 
> (https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn) 
> behavior change. As described in the issue tracker link, this prevents 
> Pie devices from properly using unmetered WiFi networks.

Are you suggesting something like the below? According to the docs, the 
null value is the "default", and the others don't fit the wireguard 
model. Are you saying we should still be calling this anyway because the 
android system is expecting it?

 From 4ae0e9688e4edfdad06e6db49f414a95c5663d07 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Wed, 15 Jan 2020 13:25:56 -0500
Subject: [PATCH] GoBackend: set empty underlying networks

https://lists.zx2c4.com/pipermail/wireguard/2020-January/004859.html
https://issuetracker.google.com/issues/114309459
https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn

Apparently we need to call this at least once.

Reported-by: Andrey Kupreychik <foxel@quickfox.ru>
---
  app/src/main/java/com/wireguard/android/backend/GoBackend.java | 1 +
  1 file changed, 1 insertion(+)

diff --git 
a/app/src/main/java/com/wireguard/android/backend/GoBackend.java 
b/app/src/main/java/com/wireguard/android/backend/GoBackend.java
index 3e8e1ec..3c4c893 100644
--- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -224,6 +224,7 @@ public final class GoBackend implements Backend {

              currentTunnel = tunnel;

+            service.setUnderlyingNetworks(null);
              service.protect(wgGetSocketV4(currentTunnelHandle));
              service.protect(wgGetSocketV6(currentTunnelHandle));
          } else {
-- 
2.24.1


Regards,
Jason
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug report: WireGuard client not setting underlying network on Android Pie
  2020-01-15 18:29 ` Jason A. Donenfeld
@ 2020-01-23  6:47   ` Andrey Kupreychik
  2020-01-23 12:49     ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Kupreychik @ 2020-01-23  6:47 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: wireguard

[-- Attachment #1.1: Type: text/plain, Size: 3136 bytes --]

Hi.

I'm not good enough in Android development to say for sure. I found a
similar bud fixed different ways:
OpenVPN:
https://github.com/schwabe/ics-openvpn/blob/450e99c135ebabbf911d6880e39811d88454cdd1/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java#L877
Outline:
https://github.com/Jigsaw-Code/outline-client/commit/3a9dad6a3cbe962cb10e443cfea21c929e98ef32

Since OpenVPN uses the same I suppose it should help. But looks like it
should still be wrapped with an Android version check.

чт, 16 янв. 2020 г. в 01:29, Jason A. Donenfeld <Jason@zx2c4.com>:

> Hi Andrey,
>
> Thanks for the bug report.
>
> On 1/13/20 12:00 AM, Andrey Kupreychik wrote:
> > My Android phone running wireguard VPN threats it as a metered
> > connection and does not do anything it should do on Wi-Fi only
> >
> > What I found is this discussion
> > https://issuetracker.google.com/issues/114309459
> > I've looked thru the GitHub mirror code and found no evidance of
> > setUnderlyingNetworks called in WireGuard client code.
> >
> > As seen in the issue tracker link above, it's needed in order to take
> > advantage of this
> > (
> https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn)
>
> > behavior change. As described in the issue tracker link, this prevents
> > Pie devices from properly using unmetered WiFi networks.
>
> Are you suggesting something like the below? According to the docs, the
> null value is the "default", and the others don't fit the wireguard
> model. Are you saying we should still be calling this anyway because the
> android system is expecting it?
>
>  From 4ae0e9688e4edfdad06e6db49f414a95c5663d07 Mon Sep 17 00:00:00 2001
> From: "Jason A. Donenfeld" <Jason@zx2c4.com>
> Date: Wed, 15 Jan 2020 13:25:56 -0500
> Subject: [PATCH] GoBackend: set empty underlying networks
>
> https://lists.zx2c4.com/pipermail/wireguard/2020-January/004859.html
> https://issuetracker.google.com/issues/114309459
>
> https://developer.android.com/about/versions/pie/android-9.0-changes-all#network-capabilities-vpn
>
> Apparently we need to call this at least once.
>
> Reported-by: Andrey Kupreychik <foxel@quickfox.ru>
> ---
>   app/src/main/java/com/wireguard/android/backend/GoBackend.java | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git
> a/app/src/main/java/com/wireguard/android/backend/GoBackend.java
> b/app/src/main/java/com/wireguard/android/backend/GoBackend.java
> index 3e8e1ec..3c4c893 100644
> --- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java
> +++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java
> @@ -224,6 +224,7 @@ public final class GoBackend implements Backend {
>
>               currentTunnel = tunnel;
>
> +            service.setUnderlyingNetworks(null);
>               service.protect(wgGetSocketV4(currentTunnelHandle));
>               service.protect(wgGetSocketV6(currentTunnelHandle));
>           } else {
> --
> 2.24.1
>
>
> Regards,
> Jason
>


-- 
Andrey Kupreychik <foxel@quickfox.ru>
http://foxel.quickfox.ru

[-- Attachment #1.2: Type: text/html, Size: 4918 bytes --]

<div dir="ltr">Hi.<div><br></div><div>I&#39;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 &lt;<a href="mailto:Jason@zx2c4.com">Jason@zx2c4.com</a>&gt;:<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>
&gt; My Android phone running wireguard VPN threats it as a metered <br>
&gt; connection and does not do anything it should do on Wi-Fi only<br>
&gt; <br>
&gt; What I found is this discussion <br>
&gt; <a href="https://issuetracker.google.com/issues/114309459" rel="noreferrer" target="_blank">https://issuetracker.google.com/issues/114309459</a><br>
&gt; I&#39;ve looked thru the GitHub mirror code and found no evidance of <br>
&gt; setUnderlyingNetworks called in WireGuard client code.<br>
&gt; <br>
&gt; As seen in the issue tracker link above, it&#39;s needed in order to take <br>
&gt; advantage of this <br>
&gt; (<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>
&gt; behavior change. As described in the issue tracker link, this prevents <br>
&gt; 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 &quot;default&quot;, and the others don&#39;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: &quot;Jason A. Donenfeld&quot; &lt;<a href="mailto:Jason@zx2c4.com" target="_blank">Jason@zx2c4.com</a>&gt;<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 &lt;<a href="mailto:foxel@quickfox.ru" target="_blank">foxel@quickfox.ru</a>&gt;<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 &lt;<a href="mailto:foxel@quickfox.ru" target="_blank">foxel@quickfox.ru</a>&gt;<br><a href="http://foxel.quickfox.ru" target="_blank">http://foxel.quickfox.ru</a></div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug report: WireGuard client not setting underlying network on Android Pie
  2020-01-23  6:47   ` Andrey Kupreychik
@ 2020-01-23 12:49     ` Jason A. Donenfeld
  0 siblings, 0 replies; 4+ messages in thread
From: Jason A. Donenfeld @ 2020-01-23 12:49 UTC (permalink / raw)
  To: Andrey Kupreychik; +Cc: WireGuard mailing list

Thanks for those commits. The next version will have this addressed.
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13  5:00 Bug report: WireGuard client not setting underlying network on Android Pie Andrey Kupreychik
2020-01-15 18:29 ` Jason A. Donenfeld
2020-01-23  6:47   ` Andrey Kupreychik
2020-01-23 12:49     ` Jason A. Donenfeld

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com
	public-inbox-index wireguard

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git