From 2f4174b5609b4ec06faa9c058179ae768472e81f Mon Sep 17 00:00:00 2001 From: Vincent Li Date: Fri, 4 Oct 2024 17:31:12 +0000 Subject: [PATCH] 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 --- src/initscripts/system/xdpdns | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/initscripts/system/xdpdns b/src/initscripts/system/xdpdns index f98718171..125c3fb02 100755 --- a/src/initscripts/system/xdpdns +++ b/src/initscripts/system/xdpdns @@ -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 }