aboutsummaryrefslogtreecommitdiff
path: root/net/pbr/files/etc/uci-defaults/91-pbr-nft
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.ca>2024-04-11 16:21:28 +0000
committerStan Grishin <stangri@melmac.ca>2024-04-12 20:40:58 +0000
commitbb5de23743b46864ba6992ed130b2d2452df72db (patch)
tree49ac4680aaa3c3abb6f44c2dc389be548b4d5098 /net/pbr/files/etc/uci-defaults/91-pbr-nft
parent4d9ec853bef7530cb97f23aa5b14c455e8f90d26 (diff)
pbr: update to 1.1.4-r15
* delete obsolete files/etc/init.d/pbr.init * add files/etc/uci-defaults/91-pbr-iptables to help update from older OpenWrt * add files/etc/uci-defaults/91-pbr-nft to help update from older OpenWrt * update files/etc/uci-defaults/91-pbr-netifd to only add tables to supported ifaces * re-organize variants in the Makefile so that they hopefull work this time * update prerm for all variants for better user experience * update the -netifd prerm to remove leftofver entries from network and rt_tables file In the init script: * add decorations for netifd-interfaces related operations (blue ticks) * add rtTablesFile variables instead of hard-coding the rt_tables file * add function to check if the table is netifd-derived * add error messages/hints for failed interface setup and failed WAN discovery * make cleanup_rt_tables the netifd-compatible * streamline interface_process function with a clearer case statement * rename the interface_process `pre-init` option to `pre_init` to conform to the other functions options naming style Signed-off-by: Stan Grishin <stangri@melmac.ca>
Diffstat (limited to 'net/pbr/files/etc/uci-defaults/91-pbr-nft')
-rw-r--r--net/pbr/files/etc/uci-defaults/91-pbr-nft30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/pbr/files/etc/uci-defaults/91-pbr-nft b/net/pbr/files/etc/uci-defaults/91-pbr-nft
new file mode 100644
index 000000000..0406e2a43
--- /dev/null
+++ b/net/pbr/files/etc/uci-defaults/91-pbr-nft
@@ -0,0 +1,30 @@
+#!/bin/sh
+# shellcheck disable=SC2015,SC3037,SC3043
+
+readonly pbrFunctionsFile='/etc/init.d/pbr'
+if [ -s "$pbrFunctionsFile" ]; then
+# shellcheck source=../../etc/init.d/pbr
+ . "$pbrFunctionsFile"
+else
+ printf "%b: pbr init.d file (%s) not found! \n" '\033[0;31mERROR\033[0m' "$pbrFunctionsFile"
+fi
+
+# Transition resolver_set depending on dnsmasq support
+if [ "$(uci_get pbr config resolver_set)" != 'dnsmasq.nftset' ]; then
+ if check_dnsmasq_nftset; then
+ output "Setting resolver_set to 'dnsmasq.nftset'... "
+ uci_set pbr config resolver_set 'dnsmasq.nftset' && output_okn || output_failn
+ elif check_agh_ipset; then
+ output "Setting resolver_set to 'adguardhome.ipset'... "
+ uci_set pbr config resolver_set 'adguardhome.ipset' && output_okn || output_failn
+ elif check_dnsmasq_ipset; then
+ output "Setting resolver_set to 'dnsmasq.ipset'... "
+ uci_set pbr config resolver_set 'dnsmasq.ipset' && output_okn || output_failn
+ else
+ output "Setting resolver_set to 'none'... "
+ uci_set pbr config resolver_set 'none' && output_okn || output_failn
+ fi
+ uci_commit pbr
+fi
+
+exit 0