From 95a3ebae6d829105d8173e1ac825c3e1ccdb118d Mon Sep 17 00:00:00 2001 From: sbwml Date: Mon, 16 Oct 2023 22:45:01 +0800 Subject: [PATCH] luci-app-mosdns: fix DNS leak option does not work * busybox sed does not support regular expression. --- luci-app-mosdns/Makefile | 2 +- luci-app-mosdns/root/etc/init.d/mosdns | 6 +++++- luci-app-mosdns/root/usr/share/mosdns/default.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/luci-app-mosdns/Makefile b/luci-app-mosdns/Makefile index 13bb628..2761c2e 100644 --- a/luci-app-mosdns/Makefile +++ b/luci-app-mosdns/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-mosdns -PKG_VERSION:=1.5.12 +PKG_VERSION:=1.5.13 PKG_RELEASE:=1 LUCI_TITLE:=LuCI Support for mosdns diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index 778958f..9449640 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -123,7 +123,11 @@ init_yaml() { sed -i "/ecs_remote/d;" $CONF fi # DNS Leak - [ $dns_leak -eq 1 ] && sed -i "0,/primary: query_is_non_local_ip/s/primary: query_is_non_local_ip/primary: forward_remote_upstream/" $CONF + if [ $dns_leak -eq 1 ]; then + sed -i "s/primary: UNDEFINED/primary: forward_remote_upstream/g" $CONF + else + sed -i "s/primary: UNDEFINED/primary: query_is_non_local_ip/g" $CONF + fi # Cloudflare IP if [ $cloudflare -eq 1 ]; then cloudflare_ip=$(sh $MOSDNS_SCRIPT cloudflare) diff --git a/luci-app-mosdns/root/usr/share/mosdns/default.yaml b/luci-app-mosdns/root/usr/share/mosdns/default.yaml index cd855a3..a684438 100644 --- a/luci-app-mosdns/root/usr/share/mosdns/default.yaml +++ b/luci-app-mosdns/root/usr/share/mosdns/default.yaml @@ -153,7 +153,7 @@ plugins: - tag: fallback type: fallback args: - primary: query_is_non_local_ip + primary: UNDEFINED secondary: forward_remote_upstream threshold: 500 always_standby: true