From ac152ece0206b4cde28acf78abb21518e67513e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Dor=C5=88=C3=A1k?= Date: Wed, 25 Jul 2012 13:12:56 -0500 Subject: [PATCH] dnsmasq: allow custom configuration via files in /etc/NetworkManager/dnsmasq.d (bgo #679628) We don't use the default dnsmasq directory because packages often drop files there that don't take account of NM's specific use-case and end up conflicting with the specific local caching nameserver functionality that NM uses dnsmasq for. NM's private dnsmasq is orthogonal to whatever global dnsmasq daemon may be running, and with that daemons configuration. (dcbw: change directory to private one) --- src/dns-manager/Makefile.am | 3 ++- src/dns-manager/nm-dns-dnsmasq.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dns-manager/Makefile.am b/src/dns-manager/Makefile.am index fd31b140cf..c6c284461b 100644 --- a/src/dns-manager/Makefile.am +++ b/src/dns-manager/Makefile.am @@ -25,7 +25,8 @@ libdns_manager_la_CPPFLAGS = \ $(LIBNL_CFLAGS) \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - -DLOCALSTATEDIR=\"$(localstatedir)\" + -DLOCALSTATEDIR=\"$(localstatedir)\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" libdns_manager_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c index 8e216f4d29..9090e26bc6 100644 --- a/src/dns-manager/nm-dns-dnsmasq.c +++ b/src/dns-manager/nm-dns-dnsmasq.c @@ -41,6 +41,7 @@ G_DEFINE_TYPE (NMDnsDnsmasq, nm_dns_dnsmasq, NM_TYPE_DNS_PLUGIN) #define PIDFILE LOCALSTATEDIR "/run/nm-dns-dnsmasq.pid" #define CONFFILE LOCALSTATEDIR "/run/nm-dns-dnsmasq.conf" +#define CONFDIR SYSCONFDIR "/NetworkManager/dnsmasq.d" typedef struct { guint32 foo; @@ -246,7 +247,7 @@ update (NMDnsPlugin *plugin, NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin); GString *conf; GSList *iter; - const char *argv[11]; + const char *argv[12]; GError *error = NULL; int ignored; GPid pid = 0; @@ -309,7 +310,8 @@ update (NMDnsPlugin *plugin, argv[7] = "--conf-file=" CONFFILE; argv[8] = "--cache-size=400"; argv[9] = "--proxy-dnssec"; /* Allow DNSSEC to pass through */ - argv[10] = NULL; + argv[10] = "--conf-dir=" CONFDIR; + argv[11] = NULL; /* And finally spawn dnsmasq */ pid = nm_dns_plugin_child_spawn (NM_DNS_PLUGIN (self), argv, PIDFILE, "bin/dnsmasq");