]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: linux: don't fail down when using systemd-resolved
authorRonan Pigott <rpigott@berkeley.edu>
Wed, 28 Aug 2019 01:42:14 +0000 (18:42 -0700)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 28 Aug 2019 02:29:17 +0000 (20:29 -0600)
systemd-resolved has a compatibility interface for use with resolvconf
scripts when resolvectl is called from a symlink from resolvconf.
However, when tearing down the interface, cmd_down calls del_if and then
unset_dns. In the case of systemd-resolved, deleting the interface also
removes the systemd-resolved entry and causes resolvconf -d to fail when
resolvconf really is a symlink to resolvectl. This causes `wg-quick
down` and 'wg-quick@.service' to exit with failure.

Instead we use the resolvconf '-f' flag to ignore non-existent
interfaces, supported by both openresolv and sd-resolved resolvconf.

Signed-off-by: Ronan Pigott <rpigott@berkeley.edu>
[zx2c4: moved -f argument to end to remain compatible with Debian's resolvconf]
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/linux.bash

index 2f36deebcad937f1522569c2ac515c4bb316ceb1..e690944d39c62fdff07daebab28f8e70b955775a 100755 (executable)
@@ -155,7 +155,7 @@ set_dns() {
 
 unset_dns() {
        [[ ${#DNS[@]} -gt 0 ]] || return 0
-       cmd resolvconf -d "$(resolvconf_iface_prefix)$INTERFACE"
+       cmd resolvconf -d "$(resolvconf_iface_prefix)$INTERFACE" -f
 }
 
 add_route() {