Adding 'log-facility=/tmp/dnsmasq.log' to /etc/dnsmasq.conf will not work.
Because /tmp/dnsmasq.log not allowed for jailed dnsmasq.
Need to use 'option logfacility /tmp/dnsmasq.log' in /etc/config/dhcp, instead.
OR to edit /etc/init.d/dnsmasq, as a brutal hack.
kill -SIGUSR1 $(cat /var/run/dnsmasq/dnsmasq*.pid)
is a reliable method to crash (read: STOP) my system.
Because 'cat /var/run/dnsmasq/dnsmasq*.pid' shows me 1 ....
I guess, this is a bug in the jailing of dnsmasq in /etc/init.d/dnsmasq:
PID-file needs to be writable for jailed dnsmasq.
Suggestion for improvement: It might be a good idea, to implement user-configurable jail-options,
i.e. by provision of /etc/config/jail, and sections for each jailed process.
To allow additions to ro-acces, and rw-access, from jail.
OR, even better, to define all jail opts for the various processes in /etc/conf/jail, only, and not to hard-code in /etc/init.d.
… a feature. This is a joke. Documented functionality of “dnsmasq …-x /var/run/dnsmasq/dnsmasq.cfg01411c.pid” is to store dnsmasqs pid . Period. Now I see, there is option ‘ -P create PIDFILE’ available for ujail. MAY BE, this should be used in /etc/init.d/dnsmasq when jailing.
that is quite reasonable. usually directly editing default config files is not recommended, should modify the corresponding config file under /etc/config. there is a logic in the init script to handle logfile, the default config file /etc/dnsmasq.conf is not parsed, just added to jail as-is.
I have the same code done on a Cudy_TR1200. Which worked with 24.10.4. Most likely, because there was no jail. Porting code to Cudy_TR3000 does not work any more, because jailing, all of a sudden. With some surprises. Anyway, solution found. But some more fun:
Implementing something like log-rotate with dnsmasq, using
kill -SIGUSR1 $PID
mv dnsmasq.log dnsmasq-"$DATE".log #touch /tmp/dnsmasq.log ; does not work, either #chown dnsmasq /tmp/dnsmasq.log; does not work, either
kill -SIGUSR2 $PID
does not work. (No new logfile created, or no data written into touched file) .Because change of /tmp/dnsmasq.log (because being closed/reopened by dnsmasq) not “recognized” by jail ?
you should not treat dnsmasq service as a native dnsmasq app. it runs as a procd+ujail service not a native app, you should not directly poke with it but use the service dnsmasq command and modify the corresponding /etc/config/dhcp.
Thre are quite a few sensible dnsmasq options, not available in /etc/config/dhcp.
Quote: The configuration is done with help of the uci-configuration file: /etc/config/dhcp, but you can use this together with the file /etc/dnsmasq.conf.
It might be a good idea, to make this jailing optional. Will try to remove ujail.
Hmm, I've always naively just done killall -s USR1 dnsmasq to get cache info, which doesn't seem very service-like. Is there an alternative offered somewhere in the service code? I can't find anything that looks promising in the init.d files...