Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: John Zimmermann <me@johnnynator.dev>
To: iwd@lists.01.org
Subject: [PATCH] resolve: allow setting default DNS resolver at compile time
Date: Tue, 27 Oct 2020 22:31:06 +0100	[thread overview]
Message-ID: <20201027213106.30028-1-me@johnnynator.dev> (raw)

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

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

diff --git a/configure.ac b/configure.ac
index 78db15e9..0adddd10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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}])
diff --git a/src/resolve.c b/src/resolve.c
index 066e4c87..8949edad 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -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++) {
-- 
2.29.0

             reply	other threads:[~2020-10-27 21:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 21:31 John Zimmermann [this message]
2020-10-28 20:38 ` [PATCH] resolve: allow setting default DNS resolver at compile time Denis Kenzior
2020-11-01 21:33   ` John Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027213106.30028-1-me@johnnynator.dev \
    --to=me@johnnynator.dev \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox