[Dnsmasq-discuss] [PATCH] Fix --server=/#/...... which was lostin 2.86

Simon Kelley simon at thekelleys.org.uk
Mon Aug 8 14:35:26 UTC 2022


Testing, I did find a configuration which is broken:

address=/#/1.1.1.1
server=/some.domain/#

ought to forward queries for some.domain to the default server(s) read 
from /etc/resolv.conf (or any other default servers) but it returns 
1.1.1.1 instead.

https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=f4b281381853df6b275332d4cd0ec1d150bffa86

Fixes this.

Simon.


On 08/08/2022 11:27, Simon Kelley wrote:
> I'm not sure what you are trying to do here.
> 
> the /#/ domain is only defined in the man page for --address and it 
> states that it matches any domain which doesn't have a more specific match.
> 
> Even though,
> 
> server=/#/<ip>
> 
> is not defined in the documentation; by extension it is exactly the same as
> 
> server=<ip>
> 
> 
> Which uses that server when a more specific domain doesn't match.
> 
> 
> 
> Please could you detail the configuration you are using, what the 
> current behaviour is, and what behaviour you think it should have?
> 
> 
> Cheers,
> 
> Simon.
> 
> 
> 
> 
> 
> On 23/07/2022 17:06, 谢致邦(XIE Zhibang) via Dnsmasq-discuss wrote:
>>  > If the proposed change is related to commit 26bbf5a314d833bea say so.
>>  > (Yes, I'm asking for an even better commit message.)
>> I don't think the two are related, the only connection is that they 
>> are both victims.
>>
>>  > Why the reshuffle?  What about SERV_DEFAULT 65536 and avoiding the 
>> reshuffle?
>> Then the order will be default server, IPv6 literal, IPv4 literal, 
>> all-zero literal......
>> Just check the order_qsort() in domain-match.c.
>>
>> ---Original---
>> *From:* "Geert Stappers via 
>> Dnsmasq-discuss"<dnsmasq-discuss at lists.thekelleys.org.uk>
>> *Date:* Sat, Jul 23, 2022 23:08 PM
>> *To:* "dnsmasq-discuss"<dnsmasq-discuss at lists.thekelleys.org.uk>;
>> *Subject:* Re: [Dnsmasq-discuss] [PATCH] Fix --server=/#/...... which 
>> was lostin 2.86
>>
>> On Sat, Jul 23, 2022 at 02:02:31PM +0000, 谢致邦 (XIE Zhibang) via 
>> Dnsmasq-discuss wrote:
>>  > A victim of the domain-search rewrite.
>>  > --server=/#/...... means to use the server for default. The new
>>  > implementation orders the default server first, but because of the
>>  > rewrote domain-search, it needs strict-order to ensure the default.
>>
>>
>> Much better as only the "git commit summary".
>>
>>
>> If the proposed change is related to commit 26bbf5a314d833bea say so.
>> (Yes, I'm asking for an even better commit message.)
>>
>>
>>  > Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking at Red54.com>
>>  > ---
>>  >  src/dnsmasq.h      | 34 ++++++++++++++++++----------------
>>  >  src/domain-match.c | 15 +++++++++++----
>>  >  src/network.c      |  2 +-
>>  >  3 files changed, 30 insertions(+), 21 deletions(-)
>>  >
>>  > diff --git a/src/dnsmasq.h b/src/dnsmasq.h
>>  > index a8937ce..7512756 100644
>>  > --- a/src/dnsmasq.h
>>  > +++ b/src/dnsmasq.h
>>  > @@ -534,23 +534,24 @@ union mysockaddr {
>>  >
>>  >
>>  >  /* The actual values here matter, since we sort on them to get 
>> records in the order
>>  > -   IPv6 addr, IPv4 addr, all zero return, resolvconf servers, 
>> upstream server, no-data return  */
>>  > +   IPv6 addr, IPv4 addr, all zero return, default server, 
>> resolvconf servers, upstream server, no-data return */
>>  >  #define SERV_LITERAL_ADDRESS    1  /* addr is the answer, or 
>> NoDATA is the answer, depending on the next four flags */
>>  >  #define SERV_USE_RESOLV         2  /* forward this domain in the 
>> normal way */
>>  > -#define SERV_ALL_ZEROS          4  /* return all zeros for A and 
>> AAAA */
>>  > -#define SERV_4ADDR              8  /* addr is IPv4 */
>>  > -#define SERV_6ADDR             16  /* addr is IPv6 */
>>  > -#define SERV_HAS_SOURCE        32  /* source address defined */
>>  > -#define SERV_FOR_NODOTS        64  /* server for names with no 
>> domain part only */
>>  > -#define SERV_WARNED_RECURSIVE 128  /* avoid warning spam */
>>  > -#define SERV_FROM_DBUS        256  /* 1 if source is DBus */
>>  > -#define SERV_MARK             512  /* for mark-and-delete and log 
>> code */
>>  > -#define SERV_WILDCARD        1024  /* domain has leading '*' */
>>  > -#define SERV_FROM_RESOLV     2048  /* 1 for servers from resolv, 0 
>> for command line. */
>>  > -#define SERV_FROM_FILE       4096  /* read from --servers-file */
>>  > -#define SERV_LOOP            8192  /* server causes forwarding 
>> loop */
>>  > -#define SERV_DO_DNSSEC      16384  /* Validate DNSSEC when using 
>> this server */
>>  > -#define SERV_GOT_TCP        32768  /* Got some data from the TCP 
>> connection */
>>  > +#define SERV_DEFAULT            4  /* Use the server for default 
>> (need strict-order) */
>>  > +#define SERV_ALL_ZEROS          8  /* return all zeros for A and 
>> AAAA */
>>  > +#define SERV_4ADDR             16  /* addr is IPv4 */
>>  > +#define SERV_6ADDR             32  /* addr is IPv6 */
>>  > +#define SERV_HAS_SOURCE        64  /* source address defined */
>>  > +#define SERV_FOR_NODOTS       128  /* server for names with no 
>> domain part only */
>>  > +#define SERV_WARNED_RECURSIVE 256  /* avoid warning spam */
>>  > +#define SERV_FROM_DBUS        512  /* 1 if source is DBus */
>>  > +#define SERV_MARK            1024  /* for mark-and-delete and log 
>> code */
>>  > +#define SERV_WILDCARD        2048  /* domain has leading '*' */
>>  > +#define SERV_FROM_RESOLV     4096  /* 1 for servers from resolv, 0 
>> for command line. */
>>  > +#define SERV_FROM_FILE       8192  /* read from --servers-file */
>>  > +#define SERV_LOOP           16384  /* server causes forwarding 
>> loop */
>>  > +#define SERV_DO_DNSSEC      32768  /* Validate DNSSEC when using 
>> this server */
>>  > +#define SERV_GOT_TCP        65536  /* Got some data from the TCP 
>> connection */
>>
>> Why the reshuffle?  What about SERV_DEFAULT 65536 and avoiding the 
>> reshuffle?
>>
>>
>>
>> Regards
>> Geert Stappers
>> Fully aware that 2^16 does NOT fit in a 16-bit integer.
>> -- 
>> Silence is hard to parse
>>
>> _______________________________________________
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss at lists.thekelleys.org.uk
>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>>
>> _______________________________________________
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss at lists.thekelleys.org.uk
>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss



More information about the Dnsmasq-discuss mailing list