summaryrefslogtreecommitdiff
path: root/net/https-dns-proxy
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.ca>2023-10-24 02:14:08 +0000
committerStan Grishin <stangri@melmac.ca>2023-10-24 02:14:54 +0000
commit5dd08fe23f0ad376bcc3f12c7a50d7ac8c73e2bb (patch)
tree25410a5909563a9d661d62d405d77a777644b1c7 /net/https-dns-proxy
parent87e5c5e7abb099295bf8afe876be2e35311cfc70 (diff)
https-dns-proxy: bugfix: prevent crashes on IPv6 systems
* update service triggers so that procd_add_raw_trigger is only executed on boot and not on other service actions * remove outdated iface hotplug script Signed-off-by: Stan Grishin <stangri@melmac.ca>
Diffstat (limited to 'net/https-dns-proxy')
-rw-r--r--net/https-dns-proxy/Makefile2
-rw-r--r--net/https-dns-proxy/files/etc/hotplug.d/iface/90-https-dns-proxy14
-rwxr-xr-xnet/https-dns-proxy/files/etc/init.d/https-dns-proxy26
3 files changed, 25 insertions, 17 deletions
diff --git a/net/https-dns-proxy/Makefile b/net/https-dns-proxy/Makefile
index 5c6912e2e..e6008ac9f 100644
--- a/net/https-dns-proxy/Makefile
+++ b/net/https-dns-proxy/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=https-dns-proxy
PKG_VERSION:=2023-05-25
-PKG_RELEASE:=7
+PKG_RELEASE:=8
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
diff --git a/net/https-dns-proxy/files/etc/hotplug.d/iface/90-https-dns-proxy b/net/https-dns-proxy/files/etc/hotplug.d/iface/90-https-dns-proxy
deleted file mode 100644
index 5acf7b7d0..000000000
--- a/net/https-dns-proxy/files/etc/hotplug.d/iface/90-https-dns-proxy
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-# Copied from https://openwrt.org/docs/guide-user/advanced/hotplug_extras
-# shellcheck disable=SC1091
-. /lib/functions/network.sh
-network_flush_cache
-network_find_wan NET_IF
-network_find_wan6 NET_IF6
-[ "$INTERFACE" != "$NET_IF" ] && [ "$INTERFACE" != "$NET_IF6" ] && exit 0
-[ "$ACTION" != "ifup" ] && [ "$ACTION" != "ifupdate" ] && exit 0
-[ "$ACTION" = "ifupdate" ] && [ -z "$IFUPDATE_ADDRESSES" ] && \
-[ -z "$IFUPDATE_DATA" ] && exit 0
-
-sleep 10
-/etc/init.d/https-dns-proxy start 'on_hotplug'
diff --git a/net/https-dns-proxy/files/etc/init.d/https-dns-proxy b/net/https-dns-proxy/files/etc/init.d/https-dns-proxy
index 58fd647c1..5679f6349 100755
--- a/net/https-dns-proxy/files/etc/init.d/https-dns-proxy
+++ b/net/https-dns-proxy/files/etc/init.d/https-dns-proxy
@@ -28,6 +28,8 @@ readonly DEFAULT_BOOTSTRAP="${BOOTSTRAP_CF},${BOOTSTRAP_GOOGLE}"
readonly canaryDomainsMozilla='use-application-dns.net'
readonly canaryDomainsiCloud='mask.icloud.com mask-h2.icloud.com'
+on_boot_trigger=
+
str_contains() { [ -n "$1" ] &&[ -n "$2" ] && [ "${1//$2}" != "$1" ]; }
is_mac_address() { expr "$1" : '[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]$' >/dev/null; }
is_ipv4() { expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; }
@@ -133,7 +135,8 @@ resolver_health_check() { resolveip -t 3 one.one.one.one >/dev/null 2>&1; }
boot() {
ubus -t 30 wait_for network.interface 2>/dev/null
- rc_procd start_service 'on_boot'
+ on_boot_trigger=1
+ rc_procd start_service 'on_boot' && rc_procd service_started 'on_boot'
resolver_health_check || rc_procd stop_service 'on_boot'
}
@@ -295,9 +298,28 @@ stop_service() {
}
service_triggers() {
- procd_add_raw_trigger "interface.*.up" 3000 "/etc/init.d/${packageName}" restart 'on_interface_up'
+ local wan wan6 i
+ local procd_trigger_wan6
+ if [ "$on_boot_trigger" = '1' ]; then
+ procd_add_raw_trigger "interface.*.up" 3000 "/etc/init.d/${packageName}" restart 'on_interface_up'
+ else
+ config_load "$packageName"
+ config_get_bool procd_trigger_wan6 'config' 'procd_trigger_wan6' '0'
+ . /lib/functions/network.sh
+ network_flush_cache
+ network_find_wan wan
+ wan="${wan:-wan}"
+ if [ "$procd_trigger_wan6" -ne 0 ]; then
+ network_find_wan6 wan6
+ wan6="${wan6:-wan6}"
+ fi
+ for i in $wan $wan6; do
+ procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" restart 'on_interface_trigger'
+ done
+ fi
procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload 'on_config_change'
}
+
service_started() { procd_set_config_changed firewall; }
service_stopped() { procd_set_config_changed firewall; }
restart() { procd_send_signal "$packageName"; rc_procd start_service "$*"; }