Skip to content

Commit

Permalink
dnsproxy: migrate old options
Browse files Browse the repository at this point in the history
Migrate "all_servers" and "fastest_addr" to new option "upstream_mode".

Fixes: d0823a8 ("dnsproxy: Update to 0.73.2")
Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Sep 21, 2024
1 parent 0c43aa3 commit 67b79fb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
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

4 comments on commit 67b79fb

@cyformatician
Copy link

@cyformatician cyformatician commented on 67b79fb Sep 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this latest commit though the latest dnsproxy update 0.73.2 breaks dnsproxy under openwrt. I had to revert to .73.1 binary to get it running again.

The update introduces breaking changes - AdguardTeam/dnsproxy#182 | commit - AdguardTeam/dnsproxy@011f37a

@danny30au
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyformatician @1715173329 I can confirm this aswell.

@1715173329
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "breaks", could you provide more information like your configuration and dnsproxy log? btw instead of replying under a commit, please create a new issue.

@cyformatician
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - #25010

Please sign in to comment.