From 2caa06d9fb945fb8c3677e60bd320dac141dd64d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 26 Dec 2017 20:02:42 +0100 Subject: [PATCH] wg-quick: set mtu after addresses This has all sorts of terrible implications and fixes a problem in a pretty terrible way. If the interface MTU is less than 1280, IPv6 addresses will fail to be added. Rather than explictly trying to catch this and do something particular about it -- such as nicely warning the user that there could be a v6 isolation issue, for example -- we just set the MTU _after_ we set the addresses, so that in setting the MTU, we wind up removing the addresses that were just added. This is pretty bad, but it makes things a bit smoother. Signed-off-by: Jason A. Donenfeld --- app/tools/wg-quick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/tools/wg-quick.c b/app/tools/wg-quick.c index db744d39..e424caad 100644 --- a/app/tools/wg-quick.c +++ b/app/tools/wg-quick.c @@ -492,11 +492,11 @@ static void cmd_up(const char *iface, const char *config, unsigned int mtu, cons add_if(iface); set_config(iface, config); - set_mtu(iface, mtu); set_addr(iface, addrs); up_if(&netid, iface); set_dnses(netid, dnses); set_routes(iface, netid); + set_mtu(iface, mtu); free(cleanup_iface); cleanup_iface = NULL;