xdp-dns: xdpdns init script to populate denylist

run xdp_dns in xdpdns init script to populate
domain_denylist from domainfile saved from UI.
either xdpdns restart or bpfire reboot, the domain_denylist
is restored with domain blocklist

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
Vincent Li
2024-10-04 17:31:12 +00:00
parent ccf49b1105
commit 2f4174b560

View File

@@ -25,6 +25,8 @@
eval $(/usr/local/bin/readhash /var/ipfire/xdpdns/settings)
domainfile="/var/ipfire/xdpdns/domainfile"
load_dnsblock () {
/usr/sbin/xdp-loader status green0 | grep -w 'xdp_dns_denylist'
if [ $? -ne 0 ]; then
@@ -35,6 +37,11 @@ load_dnsblock () {
fi
# allow WUI nobody with permission to update map
chown -R nobody /sys/fs/bpf/xdp-dns-denylist
# add domain to domain_denylist map
while IFS= read -r line; do
xdp_dns add $line
done < $domainfile
fi
}