]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commit
wg-quick: run PreUp hook after creating interface
authorDaniel Gröber <dxld@darkboxed.org>
Wed, 7 Dec 2022 18:00:31 +0000 (19:00 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 18 May 2023 14:38:34 +0000 (16:38 +0200)
commite6888dd74ee4215449517f43aba9c11a1633ea4e
tree04f7e1c38db20a607a535c2619349660cde17c60
parentb4f6b4f229d291daf7c35c6f1e7f4841cc6d69bc
wg-quick: run PreUp hook after creating interface

Currently PreUp hooks run before the interface is created. This is
problematic for moving the device into a Linux VRFs as this will
currently clear all assigned IPv6 addressess (possibly a bug), so if we
did this in PostUp (i.e. before add_addr) we'll have to manually re-add
all assigned addresses. This is obviously less than ideal.

Instead create the wg device just before running PreUp hooks. We apply
this to all platforms for consistency.

Test case:

    $ ip link add vrf-test type vrf table 1234
    $ ip link add wg-test type wireguard
    $ ip addr add dev wg-test 192.168.42.42/24
    $ ip addr add dev wg-test fe80::/64

    $ ip -br addr show wg-test
    wg-test          DOWN           192.168.42.42/24 fe80::/64

    $ ip link set dev wg-test master vrf-test

    $ ip -br addr show wg-test
    wg-test          DOWN           192.168.42.42/32

Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/darwin.bash
src/wg-quick/freebsd.bash
src/wg-quick/linux.bash
src/wg-quick/openbsd.bash