Default dnsmasq configuration (/src/config/dnsmasq_config.c)

@DL6ER

since 01-pihole.conf (v5 dnsmasq configuration file) no longer exists, I tied to figure out the defaults, used by pihole-FLT v6.

I managed to get the content of /etc/pihole/dnsmasq.conf.temp and noticed the file has the entry:

hostsdir=/etc/pihole/hosts

the idea is clear to me, add / remove entries on the fly, without restarting FTL, however...
there is only one file in this folder, /etc/pihole/hosts/custom.list, it contains only comments. This is due to the empty array "hosts = " in "/etc/pihole/pihole.toml"

I don't use this option, since I have been using hostsdir= for years now, in a different folder.

Is it possible to make this setting (hostsdir=/etc/pihole/hosts) configurable in /etc/pihole/pihole.toml, so I (and possible other users) can continue to use my v5 configuration. The setting can default to a value, as long as it is configurable, empty would mean "don't add this entry" (or commented out).

edit
I would also like to be able to disable the "optimizer" (= use-stale-cache) setting. setting the value to 0 would serve everything, so the option to NOT use it needs to be configurable
/edit

Tx

Having an empty dir is harmless at most. You can define any number of hostsdir options for dnsmasq so there is no conflict with your configuration. I don't see a need for an extra option to remove this.

Currently , zero means something else in Pi-hole and dnsmasq. In the world of dnsmasq, it means "serve forever" but Pi-hole does not allow this because it will inevitably lead to issues. In PI-hole's world, a value of zero actually means "disabled". But I do see that this is confusing so we allow negative values for dns.cache.optimizer where anything negative will disable the feature:

The pull request has been merged