[Dnsmasq-discuss] Behavior change of upstream servers set via DBus

Jerry Xiao dnsmasq at mail.jerryxiao.cc
Wed Nov 17 07:50:15 UTC 2021


It's unnecessary and inefficient to rebuild a config file that long
every time you connect to a new wifi network, and btw this is also bad
for your ssd.

On Tue, 2021-11-16 at 10:50 +0100, Matus UHLAR - fantomas via Dnsmasq-
discuss wrote:
> On 11.11.21 15:12, Jerry Xiao wrote:
> > I know this might be a little too long, you can completely discard
> > this
> > but DO NOT read part of it and then make such grammarly incorrect
> > and
> > baffling replies.
> > 
> > Maybe I did not clearly state what I was doing, I'll be verbose
> > this
> > time.
> > 
> > I'd like to:
> > Connect to a random wifi or ethernet (you can't hard code its dns
> > server, this won't work) with dns poisoning.
> > Define a known domain list that is not poisoned.
> > Connect directly to the dhcp dns for those domains to minimize
> > impact
> > on the local CDN.
> 
> which means: point list of known domains to DHCP-configured DNS
> server
> 
> 
> > For those domains that are not in this list, redirect it to another
> > dns
> > server.
> 
> which means: use different default DNS server.
> 
> > EDNS is not that good at preserving local CDNs but it's still
> > better than getting bogus results.
> 
> I still fail to see how is this diferent from:
> 
> 1. configuring list of known domains and point them to local server
> server=/google.com/192.168.1.1
> 
> (192.168.1.1 is the server name provided by dhcp, so you need to
> build this
> everytime dhcp changes)
> 
> 
> 2. pointing everything else to default DNS server do 1.1.1.1
> server=1.1.1.1
> 
> 
> > I was using dnsmasq 2.85 to do all of this, until it is upgraded
> > and no
> > longer works. I'm not quite sure if it is an unintentional feature
> > on
> > the old version 2.85, in option.c there is a piece of clearly
> > intentional code to deal with the sharp inside something like
> > "server=/#/1.1.1.1"
> > 
> > if (strcmp(arg, "#") == 0)
> >  domain = "";
> > 
> > this also sets the SERV_HAS_DOMAIN server flag below.
> > I remember seeing the feature being discussed in the mailing list,
> > though the thread is not that easy to find.
> > 
> > I spent some more time digging into the code base, only to find out
> > that there is no "easy" way to implement this in the new version
> > because of the new sorting algorithm used for choosing servers, the
> > vastly changed server flags (SERV_HAS_DOMAIN, along with some other
> > flags, are removed) and the fact that server flags and query flags
> > are
> > already full, idk if the upstream is willing to merge my changes if
> > the
> > size of the flags are enarged.
> > 
> > Worst case I just replace dnsmasq with systemd-networkd, but before
> > that I'd like to know if there's still other ways to implement
> > this.
> > 
> > Any help is appreciated.
> > 
> > Thanks
> > Jerry
> > 
> > On Tue, 2021-11-09 at 17:23 +0100, Matus UHLAR - fantomas via
> > Dnsmasq-
> > discuss wrote:
> > > On 09.11.21 22:10, Jerry Xiao wrote:
> > > > I have 30k+ lines of rules like "server=/somehost.tld/#" in my
> > > > config.
> > > 
> > > holy sh...!
> > > 
> > > > What I need is to use the dhcp assigned dns server for those
> > > > 30k+
> > > > domains and forward the others to 1.1.1.1.
> > > 
> > > define 1.1.1.1 as default, so everything will be forwarded to
> > > 1.1.1.1
> > > 
> > > forward all those 30k+ domains to DHCP assigned server.
> > > 
> > > server=/somehost.tld/192.168.1.1
> > > server=/google.com/192.168.1.1
> > > 
> > > so all those domains will be forwarded there.
> > > 
> > > > This is not possible with your config.
> > > 
> > > it is not possible with _your_ config.




More information about the Dnsmasq-discuss mailing list