[Dnsmasq-discuss] Option 66 Bug?

Dayton Turner dayton at voxter.ca
Fri Mar 26 23:38:16 GMT 2010


I am blown away not only by the explanation and fix/workaround, but that
nobody has ever tried doing a dhcp option where the IP started with a 7!
Quite Amazing.

The workaround for me was to use a hostname, as all of the deployments that
this matter to me in are inside of DD-WRT router firmware, and unfortunately
I am unable to modify the code that produces the .conf file dnsmasq reads
from, so I am unable to make the change in their GUI to put the ³ in the new
spot, but, at least the hostname workaround worked.

Thanks again guys! I¹ll alert the dd-wrt team of the new dnsmasq update, too
:)


On 3/26/10 2:53 PM, "Simon Kelley" <simon at thekelleys.org.uk> wrote:

> Don Muller wrote:
>> > Have you tried it without the double quotes?
>> >
>> > 
>> >
>> > dhcp-option=66,69.90.91.195
>> >
> 
> Without the quotes, dnsmasq will recognise a valid IP address and send
> it as a four-byte "binary" value, which isn't what's wanted here, it
> does need to be a string.
> 
> This turns out to be a real bug, which is almost too bizarre to explain.
> A workaround is to move the quotes:
> 
>  dhcp-option=66,7"4.114.208.195"
> 
> Explanation: characters inside quotes get protected from acting as
> themselves by being temporarily mapped to ASCII control characters: that
> way the code which looks for dotted-quad IP addresses, etc and treats
> them specially is disabled.
> 
> There's also some code which handles extra spaces around the commas,
> which used to  use isspace() to look for characters to elide. That's
> fine for spaces (spaces inside quotes  have been mapped to something
> else, so they don't get zapped) but is turns out that isspace() is also
> true for tabs and vertical tabs. the digit "7" gets mapped to a vertical
> tab, so it gets zapped by the "elide extra spaces" code. The fix is just
> to elide spaces, rather than anything which matches isspace().
> 
> The workaround works because it stops the '7' character from being
> mapped to vertical tab, but the other characters are still protected, so
> dnsmasq doesn't treat the argument as dotted-quad.
> 
> That bug has been there for _years_. Wow.
> 
> Thanks to Dayton for spotting it.
> 
> The fixed code is at:
> 
> http://www.thekelleys.org.uk/dnsmasq/test-releases/dnsmasq-2.53test13.tar.gz
> 
> 
> Cheers,
> 
> Simon.
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20100326/fc4d7c63/attachment.htm 


More information about the Dnsmasq-discuss mailing list