Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#1446 - dnsmasq init script may add a resolvfile argument when noresolv is requested. #5838

Closed
openwrt-bot opened this issue Mar 20, 2018 · 3 comments
Labels

Comments

@openwrt-bot
Copy link

philsauce:

Using OpenWrt trunk.

For a dhcp UCI file with multiple dnsmasq sections, if the first section has the noresolv option set, and a following section contains a resolvfile option, running the dnsmasq init script with the restart argument results in the resolvfile being added to both configuration files.

EG, with the config file:

config dnsmasq 'foo'
option noresolv 1

config dnsmasq 'bar'
option resolvfile '/tmp/resolv.bar.conf'

After running:
/etc/init.d/dnsmasq restart

The content of /var/etc/dnsmasq.conf.foo is:

auto-generated config file from /etc/config/dhcp

conf-file=/etc/dnsmasq.conf
no-resolv
bind-dynamic
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.bar.conf
stop-dns-rebind
dhcp-broadcast=tag:needs-broadcast
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d

bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf

This doesn't happen if the init script is given the start or reload argument.

The attached patch fixes the issue for me.

@openwrt-bot
Copy link
Author

dedeckeh:

I'm unable to reproduce the reported issue using OpenWRT trunk
resolvfile can only be set if -n resolvfile evaluates as true (https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/dnsmasq/files/dnsmasq.init;h=dcc18e34d74dade7dec597fec0ad39938368944d;hb=HEAD#l889) while resolvfile is declared as local (https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/dnsmasq/files/dnsmasq.init;h=dcc18e34d74dade7dec597fec0ad39938368944d;hb=HEAD#l733) in dnsmasq_start.
So I would like to understand how resolvfile can be set if noresolv equals 1 in your case

@openwrt-bot
Copy link
Author

philsauce:

Hi Hans,

Thanks for looking into this, I've investigated further and found this issue affects me because I'm using an older version of Busybox. It looks like Busybox since version 1.23.0 uses the bash behaviour for local declarations (regardless of whether it was compiled with bash compatibility).

I'll lodge an issue upstream.

For portability, would you consider patching the init script anyway? As well as older versions of Busybox, ash/dash etc are also affected.

@openwrt-bot
Copy link
Author

dedeckeh:

Thanks for investigating this further on your side; I will patch the dnsmasq init to improve portability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant