[PATCH wireguard-tools] wg-quick: android: add support for {Pre, Post}{Up, Down} hooks

Jason A. Donenfeld Jason at zx2c4.com
Sun May 25 12:45:29 UTC 2025


On Sun, May 25, 2025 at 06:04:57PM +1000, Claire Elaina wrote:
> +static void execute_hooks(const struct str_list *hooks)
> +{
> +	for (size_t i = 0; i < hooks->len; ++i)
> +		cmd("%s", hooks->items[i]);
> +}

This was also posted here, so copying Adam:
https://lore.kernel.org/wireguard/DM6PR13MB24579CD788EF28E019933C0A92609@DM6PR13MB2457.namprd13.prod.outlook.com/
https://github.com/WireGuard/wireguard-android/pull/23

This feature is appealing, but I've always held off on it because I'm
afraid of the malware potential on client platforms where people are
pretty looseygoosey with loading in random config files. Even on
Windows, it only got added behind a hidden registry setting. If we added
it here, maybe it'd need to be quite gated too. But then how do we
handle cases where a config had it but it was disabled and then it gets
enabled and it's there by surprise? Maybe strip it out on import if it's
disabled? What about the transition from root to non-root and back?
Anyway, many questions.

Wondering, what commands do you want to run?

Jason


More information about the WireGuard mailing list