Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsproxy: migrate old options #25003

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net/dnsproxy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=dnsproxy
PKG_VERSION:=0.73.2
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/AdguardTeam/dnsproxy/tar.gz/v$(PKG_VERSION)?
Expand Down
3 changes: 1 addition & 2 deletions net/dnsproxy/files/dnsproxy.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ config dnsproxy 'global'
list listen_addr '::1'
list listen_port '5353'
option log_file ''
option all_servers '0'
option fastest_addr '0'
option http3 '0'
option insecure '0'
option ipv6_disabled '0'
Expand All @@ -17,6 +15,7 @@ config dnsproxy 'global'
option rate_limit ''
option refuse_any '0'
option udp_buf_size ''
option upstream_mode ''
option verbose '0'

config dnsproxy 'bogus_nxdomain'
Expand Down
13 changes: 12 additions & 1 deletion net/dnsproxy/files/dnsproxy.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

[ -s "/etc/config/dnsproxy" ] || exit 0

#Migrate options 'listen_addr' 'listen_port' to list type
# Migrate options 'listen_addr' 'listen_port' to list type
sed -i -e "s,option listen_addr,list listen_addr,g" \
-e "s,option listen_port,list listen_port,g" "/etc/config/dnsproxy"

# Migrate 'all_servers' and 'fastest_addr' to 'upstream_mode'
if [ "$(uci -q get "dnsproxy.global.all_servers")" = "1" ]; then
uci -q set "dnsproxy.global.upstream_mode"="parallel"
elif [ "$(uci -q get "dnsproxy.global.fastest_addr")" = "1" ]; then
uci -q set "dnsproxy.global.upstream_mode"="fastest_addr"
fi
uci -q delete "dnsproxy.global.all_servers"
uci -q delete "dnsproxy.global.fastest_addr"
uci -q commit "dnsproxy"

exit 0
5 changes: 2 additions & 3 deletions net/dnsproxy/files/dnsproxy.init
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ append_param_bool() {
}

load_config_arg() {
append_param_bool "$1" "all_servers"
append_param_bool "$1" "fastest_addr"
append_param_bool "$1" "http3"
append_param_bool "$1" "insecure"
append_param_bool "$1" "ipv6_disabled"
Expand Down Expand Up @@ -82,10 +80,11 @@ load_config_list() {

load_config_param() {
append_param_arg "global" "log_file" "--output"
append_param_arg "global" "timeout" "--timeout"
append_param_arg "global" "max_go_routines" "--max-go-routines"
append_param_arg "global" "rate_limit" "--ratelimit"
append_param_arg "global" "timeout" "--timeout"
append_param_arg "global" "udp_buf_size" "--udp-buf-size"
append_param_arg "global" "upstream_mode" "--upstream-mode"

append_param_arg "hosts" "enabled" "--hosts-file-enabled" "0"

Expand Down
Loading