[PATCH v2] wg-quick: linux: Don't fail systemd service when using systemd-resolved

Ronan Pigott rpigott314 at gmail.com
Wed Aug 28 03:42:14 CEST 2019


From: Ronan Pigott <rpigott at berkeley.edu>

v2 patch for systemd-resolved support.

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 at .service' to exit with failure.

This version uses the resolvconf '-f' flag to ignore non existent
interfaces, supported by both openresolv and sd-resolved resolvconf.

See v1 for the symlink test method and discussion.

Signed-off-by: Ronan Pigott <rpigott at berkeley.edu>
---
 src/tools/wg-quick/linux.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/wg-quick/linux.bash b/src/tools/wg-quick/linux.bash
index 2f36dee..e218be2 100755
--- a/src/tools/wg-quick/linux.bash
+++ b/src/tools/wg-quick/linux.bash
@@ -155,7 +155,7 @@ set_dns() {
 
 unset_dns() {
 	[[ ${#DNS[@]} -gt 0 ]] || return 0
-	cmd resolvconf -d "$(resolvconf_iface_prefix)$INTERFACE"
+	cmd resolvconf -fd "$(resolvconf_iface_prefix)$INTERFACE"
 }
 
 add_route() {
-- 
2.23.0



More information about the WireGuard mailing list