On 24/03/2022 09:28, Ercolino de Spiacico wrote:
I've just added it to 2.87test8
Please test and report back.
Ok after a first implementation on my test environment this is my feedback:
A- Great feature! the scripting + gzip + zcat is a godsend. Yes it
pushed the CPU up a bit, yes the the script takes longer to execute
(although this is once/day in the early morning so not important), but
most importantly the RAM demand decreased drastically.
B- Since conf-file and conf-script make dnsmasq fail if they are defined
but the target file doesn't exist I have found a simple workaround to
just touch the all the target files at the top of my adblock script and
that does the job nicely.
Now the potential further points of improvements I could identify are:
1- Within the conf-script target file I map the list of domains as
discussed e.g.:
address=/ + $domain + /
For some reason a condition like this:
[ -f list.of.domain ] && { create the formatted configuration }
would always fail at dnsmasq level if the list.of.domains doesn't exist
despite the file existence condition defined. I'm not sure this is meant
to be and/or if there's a smart workaround that can be used.
I don't understand this, could you give more details.
2- I have tried to push this into the million of records and I can
confirm it still perform very well. There one down side though, the time
needed to restart dnsmasq increased visibly. Somehow it takes too long.
I guess the conf-script is run at every restart or relevant SIGHUP
It will run during restart,, but not at SIGHUP.
given. Suppose I'm aware the scripting part is not modified is it worthy
allowing an extra parameter to the conf-script to retain this specific
part of the config? e.g.
script-conf=0,populate-config.sh # do not recreate as part of dnsmasq
restart
script-conf=1,populate-config.sh # (or "1," not defined) always recreate
as part of restart
Not really practical. The config only exists in the the memory of the
old dnsmasq process which is discarded as part of the restart.
This somehow also introduced a new minor feature request like allowing
to detach the conf-script directive (creation of) from any SIGHUP and
allow them to fully run in async. So that we could reload the dnsmasq
config without necessarily run the script or all the way around
regenerate the script manually simply asking dnsmasq to reload the
(pre-generated) scripted config.
I'm not so much concerned about the adblock script as this ideally will
run once/day; but I'm rather concerned about external factors triggering
a dnsmasq restart multiple times/day. This potentially can be very
disruptive. If this point 2) of mine is a possibility I see that as a
perfect solution as there's full control on what to trigger and when
without noticeable dnsmasq downtime.
Note that having loaded the config, dnsmasq has to sort all the domains,
which will be part of the time taken. Doing that once makes the lookups
much faster.
How long are you without DNS service?
One possible solution is to add an option to dnsmasq which causes it to
send SIGTERM is a process-id _after_ reading config and _before_ opening
network sockets. That would delay stopping the old dnsmasq process until
the new one is almost ready to go. Would require some clever scripting
in the init system or systemd to make it work.
Simon.
Thanks
_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss