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. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
2bca99893f
commit
2044bb026d
|
@ -280,7 +280,11 @@ static void up_if(unsigned int *netid, const char *iface)
|
||||||
cndc("interface setcfg %s up", iface);
|
cndc("interface setcfg %s up", iface);
|
||||||
cndc("network create %u vpn 1 1", *netid);
|
cndc("network create %u vpn 1 1", *netid);
|
||||||
cndc("network interface add %u %s", *netid, iface);
|
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)
|
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_dnses(netid, dnses);
|
||||||
set_routes(iface, netid);
|
set_routes(iface, netid);
|
||||||
set_mtu(iface, mtu);
|
set_mtu(iface, mtu);
|
||||||
|
set_users(netid);
|
||||||
broadcast_change();
|
broadcast_change();
|
||||||
|
|
||||||
free(cleanup_iface);
|
free(cleanup_iface);
|
||||||
|
|
Loading…
Reference in New Issue