[Dnsmasq-discuss] [PATCH] Logging of dhcp_script output
simon at thekelleys.org.uk
Sun Apr 16 20:29:21 BST 2017
I like this. Yes, I know you can do it with shell magic, but this is
easier and what I would expect to happen.
I've changed the patch quite a lot:
1) Don't go to large effort to report "never happen" errors from pipe(),
just silently handle them in the same way as fork()
2) Don't do any of this when the -d debug flag is in effect, as it's
already defined that the script gets stdin, stdout and stderr from the
dnsmasq process in that case.
3) Expand the subject-based logging that already exists, DHCP stuff
comes from dnsmasq-dhcp, script output comes from dhcp-script. That
avoids the wordy preamble to every line otherwise.
4) Pull the copy-to-log code out of the loop wait()ing for processes to
die, it makes more sense to iterate until the descriptors close, then
reap child processes.
5) Rationalise conditional compilation stuff. There may be more of that
in a subsequent commit.
6) Update the man page to reflect new reality (!)
Any remaining bugs are mine, but Petr please check that I didn't break
On 24/03/17 17:38, Petr Mensik wrote:
> Some guys using dnsmasq in virtual machines and OpenStack use custom dhcp_script to manage leases of clients.
> However they complain if there is anything wrong with them, then are just told broken pipe and no information.
> We understand it should not produce any output under normal operation. But it would be really helpful if at least anything was visible in logs. Especially for errors happening under rare circumstances.
> I have prepared patch to forward events from helper. It prevents SIGPIPE receiving if script does write anything. And logs it from dnsmasq.
> It seems very handy to me.
> It was not simple to forward it to main log. I would like opinions if it is useful or dangerous.
> Do you consider it worth merging Simon?
> Best Regards,
> Petr Menšík
> Software Engineer
> Red Hat, http://www.redhat.com/
> email: pemensik at redhat.com PGP: 65C6C973
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the Dnsmasq-discuss