Skip to contentSkip to conversation

resolve: allow setting default DNS resolver at compile time

PATCH In review John Zimmermann 2 participants 3 messages Oct 27, 2020 – Nov 1, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 resolve: allow setting default DNS resolver at compile time

---
 configure.ac  | 15 +++++++++++++++
 src/resolve.c |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)
configure.ac +15 -0
index 78db15e9..0adddd10 100644
@@ -250,6 +250,21 @@ if (test "${enable_systemd_service}" != "no" && test -z "${path_systemd_modloadd
 fi
 AC_SUBST(SYSTEMD_MODLOADDIR, [${path_systemd_modloaddir}])
 
+AC_ARG_WITH(resolver, AC_HELP_STRING([--with-resolver=(systemd|resolvconf)],
+			[Set default DNS resolver [default=systemd]]),,
+		[with_resolver=systemd])
+
+case "x$with_resolver" in
+	"xsystemd")
+		AC_DEFINE(DEFAULT_RESOLVER, "systemd", ["Default DNS resolver"])
+	;;
+	"xresolvconf")
+		AC_DEFINE(DEFAULT_RESOLVER, "resolvconf", ["Default DNS resolver"])
+	;;
+	*) AC_MSG_ERROR([Wrong value for --with-resolver: $with_resolver])
+	;;
+esac
+
 AC_ARG_ENABLE([external_ell], AC_HELP_STRING([--enable-external-ell],
 				[enable external Embedded Linux library]),
 					[enable_external_ell=${enableval}])
src/resolve.c +2 -2
index 066e4c87..8949edad 100644
@@ -553,8 +553,8 @@ static int resolve_init(void)
 		if (method_name)
 			l_warn("[General].dns_resolve_method is deprecated, "
 				"use [Network].NameResolvingService");
-		else /* Default to systemd-resolved service. */
-			method_name = "systemd";
+		else /* Default to compile time option (default: systemd-resolved) */
+			method_name = DEFAULT_RESOLVER;
 	}
 
 	for (i = 0; resolve_method_ops_list[i].name; i++) {
Signature · 1 line
2.29.0
#1 lore raw

Hi John,

Quoted 4 lines · John Zimmermann
---
  configure.ac  | 15 +++++++++++++++
  src/resolve.c |  4 ++--
  2 files changed, 17 insertions(+), 2 deletions(-)

Could you explain the motivation behind this change? Can't this be accomplished easily by shipping a default main.conf?

Regards,
-Denis

#2 lore raw

Hi Denis.

Quoted 8 lines · Denis Kenzior

Hi John,

Could you explain the motivation behind this change? Can't this be accomplished easily by shipping a default main.conf?

Regards,
-Denis

Yes in theory most of this can be achieved with a main.conf. Our problem is, that our package manager (xbps) would overwrite already exisiting main.conf files, since they aren't yet tracked by it.
So patching iwd is our most reliable method that won't break any users config.

Regards,
John