From: Stefan Agner <stefan@agner.ch>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Android: TCP connection drop when disabling WiFi
Date: Thu, 05 Jul 2018 00:04:51 +0200 [thread overview]
Message-ID: <ef108e2dcc403e0e3aaf0d4b44df9568@agner.ch> (raw)
In-Reply-To: <CAHmME9odvkuvmpA6Fg0D-Cwy7zzokFDcaB7QP384AHL6VOd9RA@mail.gmail.com>
On 04.07.2018 23:13, Jason A. Donenfeld wrote:
> Hi Stefan,
>
> I wish this were the case too, but Android sends SOCK_DESTROY to
> everything when networks change, and there isn't a lot that can be
> done about it without rooting the device, as far as I can tell. If
> you've got some Android chops and can think of a way we can suppress
> that, I'd be very interested.
Ugh, so as I expected :-(
Unfortunately, I am not very familiar with Android.
It seems that Android only kills connection when addresses get removed.
The data connection stays on in background, so that is why 4G -> WiFi
works: No addresses get removed.
Same behavior when using "Always-on VPN" or "Block connections without
VPN". It really seems a silly behavior in the light of VPNs.
With SOCK_DESTROY I pretty quickly found netd and the code which
actually causes the connection drop. It seems to me that only
connections with an address which actually gets removed get dropped
NetlinkHandler::onEvent), but maybe I don't understand the full picture.
And after some more digging I found this commit with the promising title
"Do not destroy socket when VPN interface address is still in use":
https://android.googlesource.com/platform/system/netd/+/6c00b61656da32ce3223a2fc711f5649b6b7b5ac
However, it seems to me that this is not relly applicable in the
Wireguard case...
--
Stefan
next prev parent reply other threads:[~2018-07-04 21:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-04 21:11 Android: TCP connection drop when disabling WiFi Stefan Agner
2018-07-04 21:13 ` Jason A. Donenfeld
2018-07-04 22:04 ` Stefan Agner [this message]
2018-07-04 23:14 ` Stefan Agner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef108e2dcc403e0e3aaf0d4b44df9568@agner.ch \
--to=stefan@agner.ch \
--cc=Jason@zx2c4.com \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).