diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-23 16:37:42 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-23 17:04:17 +0200 |
commit | 88cf839c90e59823c4fee1e70e5525b943287a10 (patch) | |
tree | 2cb5400b7cd61944d7c7a3f843dd1c7e1502dc8c /app/tools | |
parent | a1c6f4b3b74aec0224045d9cd5f3345c4773919d (diff) |
Update application state based on wg-quick
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/tools')
-rw-r--r-- | app/tools/wg-quick.c | 10 | ||||
m--------- | app/tools/wireguard-go | 0 |
2 files changed, 10 insertions, 0 deletions
diff --git a/app/tools/wg-quick.c b/app/tools/wg-quick.c index 204c3c0f..0610d12f 100644 --- a/app/tools/wg-quick.c +++ b/app/tools/wg-quick.c @@ -446,6 +446,14 @@ static void set_config(const char *iface, const char *config) exit(WIFEXITED(ret) ? WEXITSTATUS(ret) : EIO); } +static void broadcast_change(void) +{ + const char *pkg = getenv("CALLING_PACKAGE"); + + if (!pkg || strcmp(pkg, "com.wireguard.android")) + cmd("am broadcast -a com.wireguard.android.WGQUICK_CHANGE com.wireguard.android"); +} + static void print_search_paths(FILE *file, const char *prefix) { _cleanup_free_ char *paths = strdup(WG_CONFIG_SEARCH_PATHS); @@ -502,6 +510,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); + broadcast_change(); free(cleanup_iface); cleanup_iface = NULL; @@ -528,6 +537,7 @@ static void cmd_down(const char *iface) } del_if(iface); + broadcast_change(); exit(EXIT_SUCCESS); } diff --git a/app/tools/wireguard-go b/app/tools/wireguard-go -Subproject 14c6c9a7a4427bd5f07276b501e7f61ed3dbeb6 +Subproject 0715bdf353dd670bf7c3af332a8dabbe30187a1 |