Changing upstream DNS sets blocking countdown timer to null

Expected Behaviour:

Operating System: Debian GNU/Linux 13 (trixie)
Hardware: Ugreen DXP2800
pihole-FTL version v6.7.1 (bare metal)

Actual Behaviour:

Changing the upstream DNS seems to "nullify" the blocking countdown timer. If I then repeat the same change it does not run the same

The pitest script uses "curl -X PATCH ....." to set the upstream DNS, e.g:
curl -X PATCH http://$PISVR/api/config/dns/upstreams -H "Content-Type: application/json" -d '{"config":{"dns":{"upstreams":["'$UPDNS_1'", "'$UPDNS_2'"]}}}'

the 3 pitest commands below were run in sequence

Run #1. (Setting upstreams to their current (ControlD) values (effectively no change))

  • works as expected

pitest controld

Status: {"blocking":"disabled","timer":null,"took":1.811981201171875e-05}

pihole.toml says:

upstreams = \[ "76.76.2.2", "76.76.10.2" \] ### CHANGED, default = [ ]

Setting upstream DNS
{"config":{"dns":{"upstreams":["76.76.2.2","76.76.10.2"]}},"took":0.00011157989501953125}

pihole.toml says:

upstreams = \[ "76.76.2.2", "76.76.10.2" \] ### CHANGED, default = [ ]

Disabling blocking for 300 seconds
{"blocking":"disabled","timer":300,"took":2.6941299438476562e-05}

pihole.toml says:

upstreams = \[ "76.76.2.2", "76.76.10.2" \] ### CHANGED, default = [ ]
Status: {"blocking":"disabled","timer":300,"took":3.0994415283203125e-05}
sleep 1
Status: {"blocking":"disabled","timer":298.99999999999977,"took":2.956390380859375e-05}
sleep 1
Status: {"blocking":"disabled","timer":297.89999999999952,"took":2.6941299438476562e-05}
sleep 1
Status: {"blocking":"disabled","timer":296.8999999999993,"took":2.8371810913085938e-05}
sleep 1
Status: {"blocking":"disabled","timer":295.899999999999,"took":3.1232833862304688e-05}

Run #2. (Changing upstreams to something else)

  • the countdown timer is set to null a few seconds after the change to the upstream DNS

# pitest cloudflare

Status: {"blocking":"disabled","timer":290.19999999999777,"took":2.5510787963867188e-05}

pihole.toml says: upstreams = \[ "76.76.2.2", "76.76.10.2" \] ### CHANGED, default = [ ]

Setting upstream DNS
{"config":{"dns":{"upstreams":\["1.1.1.1","1.0.0.1"\]}},"took":0.015906095504760742}

pihole.toml says: upstreams = \[ "1.1.1.1", "1.0.0.1" \] ### CHANGED, default = [ ]

Disabling blocking for 300 seconds
{"blocking":"disabled","timer":300,"took":2.4557113647460938e-05}

pihole.toml says: upstreams = \[ "1.1.1.1", "1.0.0.1" \] ### CHANGED, default = [ ]

Status: {"blocking":"disabled","timer":300,"took":1.7881393432617188e-05}
sleep 1
Status:
sleep 1
Status: {"blocking":"disabled","timer":null,"took":2.3126602172851562e-05}
sleep 1
Status: {"blocking":"disabled","timer":null,"took":3.5524368286132812e-05}
sleep 1
Status: {"blocking":"disabled","timer":null,"took":4.100799560546875e-05}

# 

# 

Test #3. (Setting upstreams to their current (Clouflare) values (effectively no change))

  • Repeating the same update to the upstream DNS does not set the timer to null

# pitest cloudflare

Status: {"blocking":"disabled","timer":null,"took":2.6702880859375e-05}

pihole.toml says: upstreams = \[ "1.1.1.1", "1.0.0.1" \] ### CHANGED, default = [ ]

Setting upstream DNS
{"config":{"dns":{"upstreams":\["1.1.1.1","1.0.0.1"\]}},"took":9.9658966064453125e-05}

pihole.toml says: upstreams = \[ "1.1.1.1", "1.0.0.1" \] ### CHANGED, default = [ ]

Disabling blocking for 300 seconds
{"blocking":"disabled","timer":300,"took":2.384185791015625e-05}

pihole.toml says: upstreams = \[ "1.1.1.1", "1.0.0.1" \] ### CHANGED, default = [ ]

Status: {"blocking":"disabled","timer":300,"took":1.8835067749023438e-05}
sleep 1
Status: {"blocking":"disabled","timer":298.99999999999977,"took":2.9802322387695312e-05}
sleep 1
Status: {"blocking":"disabled","timer":297.99999999999955,"took":2.9087066650390625e-05}
sleep 1
Status: {"blocking":"disabled","timer":296.99999999999932,"took":2.8371810913085938e-05}
sleep 1
Status: {"blocking":"disabled","timer":295.99999999999909,"took":1.7404556274414062e-05}

# 

Debug Token:

https://tricorder.pi-hole.net/vsGPdtcb/

Apologies for the illegible post. (It was my first post). Here is my script, updated to give more easily read output.

pitest.sh.txt (1.1 KB)

looks like the config PATCH is bouncing FTL and wiping the temporary disable timer.

after ur upstreams change, set blocking again thru the blocking endpoint (check /api/docs on ur box for the exact path on v6). something like:

curl -X POST http://$PISVR/api/dns/blocking -H "Content-Type: application/json" -d '{"blocking":true}'

if timer keeps going null even when u never disabled blocking, thats probably a bug on config write. github issue w/ ur pitest output would help.

The blocking timer is only saved in memory, while the status is written to the disk TOML as dns.blocking.active.
If you disable blocking with a timeout and trigger a restart afterwards, the timer will be lost, but the status will be re-read from disk.