Re: relocate dnsmasq --conf-dir location?


Another option is also possible. You can add
conf-dir=/modifiable/dnsmasq.d,*.conf into

That would be fixed part, which would stay read-only. And any
configuration generated on-fly would be in modifiable directory. dnsmasq
should support multiple directories read for configuration. It allows
additional directory instead of moving existing directory.


On 10/29/21 11:14, Thomas Haller via networkmanager-list wrote:
On Thu, 2021-10-28 at 07:21 -0700, mailinglist bentleyemail net wrote:
Our embedded device has a readonly partition for configuration and
such.  /etc/ is on this readonly partition.

We currently use keyfile path=/writable partition in order to get
system-connections off the readonly partition.  Is there a way to get
the dnsmasq --conf-dir parameter to point to a different location as

Currently I see:
# ps | grep dns
 340 nobody /usr/sbin/dnsmasq --conf-file=/dev/null --no-hosts --keep-
in-foreground --bind-interfaces --except-interface=lo --clear-on-reload
--strict-order --listen-address= --dhcp-
range=,,60m --dhcp-lease-max=50 --dhcp-
leasefile=/var/lib/NetworkManager/dnsmasq-br0.leases --pid-
file=/var/run/ --conf-
 345 nobody /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-
hosts --bind-interfaces --pid-file=/var/run/NetworkManager/
--listen-address= --cache-size=400 --clear-on-reload --conf-
file=/dev/null --proxy-dnssec --enable-
dbus=org.freedesktop.NetworkManager.dnsmasq --conf-

I have not seen where I can influence this location.  Can you advise? 
I'd like to be able to have something like:

/usr/sbin/dnsmasq --conf-file=/dev/null --no-hosts --keep-in-foreground
--bind-interfaces --except-interface=lo --clear-on-reload --strict-
order --listen-address= --dhcp-
range=,,60m --dhcp-lease-max=50 --dhcp-
leasefile=/var/lib/NetworkManager/dnsmasq-br0.leases --pid-
file=/var/run/ --conf-
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-
interfaces --pid-file=/var/run/NetworkManager/ --listen-
address= --cache-size=400 --clear-on-reload --conf-
file=/dev/null --proxy-dnssec --enable-
dbus=org.freedesktop.NetworkManager.dnsmasq --conf-



no, that's not currently possible.

You could:

1) bind-mount the directory "/modifiable/NetworkManager/dnsmasq*.d" to

2) you could replace /usr/sbin/dnsmasq with a wrapper script that hacks
the configuration option. 

3) the code does

  if (g_file_test(CONFDIR, G_FILE_TEST_IS_DIR))
        argv[argv_idx++] = "--conf-dir=" CONFDIR;

You could patch the code (welcome upstream) to also accept SYMLINKS,
then you could symlink the /modifiable dir from /etc.

4) maybe this could be made configurable in NetworkManager.conf (patch
maybe welcome upstream). But with 1) and 3) you would have alternatives
for that. Beside, dropping files to --conf-dir entirely bypasses
NetworkManager and it would be better to natively support the features
that are hacked this way.

5) any other patch that works for you.

1) seems best. 3) is best otherwise, if you invest the work and can
wait for a new version of NetworkManager.


networkmanager-list mailing list
networkmanager-list gnome org

Petr Menšík
Software Engineer
Red Hat,
email: pemensik redhat com
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]