[Dnsmasq-discuss] [PATCH] [BUGFIX] server parsing issue with empty domains

Simon Kelley simon at thekelleys.org.uk
Wed Aug 25 13:38:55 UTC 2021


Patch applied, thanks.

Cheers,


Simon.



On 20/08/2021 12:27, Dominik wrote:
> Dear Simon,
> 
> server=//1.2.3.4 can be used to specify a server to be used for
> unqualified names. However, if we want to combine this feature with
> other domains, the server config option is parsed incorrectly.
> 
> A fix is attached.
> 
> ---
> 
> Example 1:
>> server=//192.168.2.1
>> server=/fritz.box/192.168.2.1
> 
> Log:
>> Aug 20 13:00:34 dnsmasq[1151247]: using nameserver 192.168.2.1#53 for
>> unqualified names (no DNSSEC)
>> Aug 20 13:00:34 dnsmasq[1151247]: using nameserver 192.168.2.1#53 for
>> domain fritz.box (no DNSSEC)
> 
> CORRECT
> 
> Example 2:
>> server=//fritz.box/192.168.2.1
> 
> Log:
> 
>> Aug 20 12:33:41 dnsmasq[1147692]: using nameserver 192.168.2.1#53 for
>> unqualified names (no DNSSEC)
>> Aug 20 12:33:41 dnsmasq[1147692]: using nameserver 192.168.2.1#53 for
>> unqualified names (no DNSSEC)
> 
> WRONG (not using the server for fritz.box)
> 
> Example 3:
>> server=/fritz.box//192.168.2.1
> 
> Log:
>> Aug 20 12:30:27 dnsmasq[1147304]: using nameserver 192.168.2.1#53 for
>> domain fritz.box (no DNSSEC)
>> Aug 20 12:30:27 dnsmasq[1147304]: using nameserver 192.168.2.1#53
> 
> WRONG (uses server for all domains instead of only unqualified)
> 
> ----
> 
> The bug has been introduced about two months ago in
> 12a9aa7c628e2d7dcd34949603848a3fb53fce9c
> 
> The issue is now caused by interpreting the server flags only once. If
> // is the first domain, SERV_FOR_NODOTS is set to all domains extracted
> from a server config line. If // appears later on, SERV_FOR_NODOTS is
> never set, leading to the misinterpretation that server=//192.168.2.1
> is the same as server=192.168.2.1.
> 
> The attached patch fixes this by adding SERV_FOR_NODOTS *selectively*
> for empty domains. It does this only when // is detected.
> 
> All three examples work as expected now.
> 
> Best,
> Dominik
> 




More information about the Dnsmasq-discuss mailing list