luci: disable auto set dnsmasq when update from redirect mode none

This commit is contained in:
Nick Peng
2022-09-01 00:22:13 +08:00
parent 7c4ce074a5
commit e13a8c0ec5

View File

@@ -316,7 +316,7 @@ load_service()
config_get force_https_soa "$section" "force_https_soa" "0" config_get force_https_soa "$section" "force_https_soa" "0"
[ "$force_https_soa" = "1" ] && qtype_soa_list="$qtype_soa_list 65" [ "$force_https_soa" = "1" ] && qtype_soa_list="$qtype_soa_list 65"
config_get auto_set_dnsmasq "$section" "auto_set_dnsmasq" "0" config_get auto_set_dnsmasq "$section" "auto_set_dnsmasq" "1"
config_get rr_ttl "$section" "rr_ttl" "" config_get rr_ttl "$section" "rr_ttl" ""
[ -z "$rr_ttl" ] || conf_append "rr-ttl" "$rr_ttl" [ -z "$rr_ttl" ] || conf_append "rr-ttl" "$rr_ttl"
@@ -350,14 +350,24 @@ load_service()
# upgrade old configuration # upgrade old configuration
if [ "$redirect" = "redirect" ] || [ "$redirect" = "dnsmasq-upstream" ] || [ "$redirect" = "none" ]; then if [ "$redirect" = "redirect" ] || [ "$redirect" = "dnsmasq-upstream" ] || [ "$redirect" = "none" ]; then
clear_iptable "$port" [ "$redirect" = "redirect" ] && {
clear_iptable "$old_port" clear_iptable "$port"
stop_forward_dnsmasq "$port" clear_iptable "$old_port"
stop_forward_dnsmasq "$old_port" uci -q delete smartdns.@smartdns[0].port
[ "$redirect" = "none" ] || {
uci -q delete smartdns.@smartdns[0].port="53"
port="53" port="53"
} }
[ "$redirect" = "dnsmasq-upstream" ] && {
stop_forward_dnsmasq "$port"
stop_forward_dnsmasq "$old_port"
auto_set_dnsmasq="1"
uci -q set smartdns.@smartdns[0].auto_set_dnsmasq="1"
}
[ "$redirect" = "none" ] && {
auto_set_dnsmasq="0"
uci -q set smartdns.@smartdns[0].auto_set_dnsmasq="0"
}
uci -q delete smartdns.@smartdns[0].redirect uci -q delete smartdns.@smartdns[0].redirect
uci -q delete smartdns.@smartdns[0].old_redirect uci -q delete smartdns.@smartdns[0].old_redirect
uci -q delete smartdns.@smartdns[0].old_enabled uci -q delete smartdns.@smartdns[0].old_enabled