diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-31 16:38:06 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-31 16:38:08 +0200 |
commit | b57461ceb01e591525201a9b8db3bf5107e51f8d (patch) | |
tree | 166110ee7af0c41830322a36c2bc0215eaf025f3 | |
parent | version: bump snapshot (diff) | |
download | wireguard-monolithic-historical-b57461ceb01e591525201a9b8db3bf5107e51f8d.tar.xz wireguard-monolithic-historical-b57461ceb01e591525201a9b8db3bf5107e51f8d.zip |
wg-quick: android: delay setting users until end
`ndc users add` eventually invokes SOCK_DESTROY on user sockets, causing
them to reconnect. By delaying this until after routes are set, we
ensure that the sockets reconnect using the tunnel, rather than the old
route.
-rw-r--r-- | src/tools/wg-quick/android.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/wg-quick/android.c b/src/tools/wg-quick/android.c index 25f8f5f..cd43a13 100644 --- a/src/tools/wg-quick/android.c +++ b/src/tools/wg-quick/android.c @@ -280,7 +280,11 @@ static void up_if(unsigned int *netid, const char *iface) cndc("interface setcfg %s up", iface); cndc("network create %u vpn 1 1", *netid); cndc("network interface add %u %s", *netid, iface); - cndc("network users add %u 0-99999", *netid); +} + +static void set_users(unsigned int netid) +{ + cndc("network users add %u 0-99999", netid); } static void set_dnses(unsigned int netid, const char *dnses) @@ -510,6 +514,7 @@ static void cmd_up(const char *iface, const char *config, unsigned int mtu, cons set_dnses(netid, dnses); set_routes(iface, netid); set_mtu(iface, mtu); + set_users(netid); broadcast_change(); free(cleanup_iface); |