[Dnsmasq-discuss] DNSMASQ_SERVER_DUID is empty with --leasefile-ro

Simon Kelley simon at thekelleys.org.uk
Thu Nov 7 10:43:47 GMT 2013

On 06/11/13 11:53, unDEFER wrote:
> Hello, Simon!
> Thank you for the great tool!
> I have the bug report for you:
> I'm using very simple script to test behaviour of dnsmasq with
> --dhcp-script= option and DHCPv6. It looks like:
> #!/bin/sh
> echo "$*">>/tmp/dnsmasq...
> env>>/tmp/dnsmasq...
> echo>>/tmp/dnsmasq...
> And also I want to use --leasefile-ro option. But environment variable
> DNSMASQ_SERVER_DUID keeps empty string with this option.
> Without --leasefile-ro it works correctly.
> If I use dnsmasq only to get IPv4 addresses it also works fine.
Thanks for the bug report. I think there are two bugs here, one is yours 
and one is mine.

Your bug is that with --leasefile-ro, there is _no_ leasefile (the 
option is very badly named) At startup, dnsmasq calls the dhcp-script 
with argument "init" and the script should output the lease database in 
the same format as the leases file to stdout. Your script isn't doing 
that, so dnsmasq is starting with an empty lease database and no DUID 
each time.

That brings us to my bug. If dnsmasq doesn't read the value of the DUID 
from the leasefile/script, it creates a new one. When dnsmasq has to 
created a new DUID, it gets saved in the leasefile, but doesn't appear 
in the DNSMASQ_SERVER_DUID variable: that only happens after dnsmasq 
has been restarted and reads the DUID from the leasefile. That bug is 
normally very hard to see, but your bug made it happen every time, so 
you spotted it. I've just pushed the fix to git.



More information about the Dnsmasq-discuss mailing list