fix: restore mixed proxy DNS/LAN routing and eliminate service restart log flood

Fixes regression from 1.3.25 where section mixed proxy inbounds lost internet access due to missing DNS hijacking and missing private IP bypass, and suppresses noisy log warnings during service restart/update.
This commit is contained in:
Dushnilin
2026-09-12 21:51:05 +03:00
parent 040b1291c6
commit 169e7f497d
5 changed files with 97 additions and 26 deletions
+2 -4
View File
@@ -19,14 +19,13 @@ initd_ucode() {
}
sync_service_triggers() {
_procd_call sync_service_triggers_payload
[ -n "$NAME" ] || return 0
_procd_service_type=set _procd_call sync_service_triggers_payload >/dev/null 2>&1 || true
}
sync_service_triggers_payload() {
json_init
json_add_string name "$NAME"
service_triggers
_procd_ubus_call set >/dev/null 2>&1 || true
}
start_service() {
@@ -34,7 +33,6 @@ start_service() {
initd_ucode start-service "$1" "$$"
TACHYON_LAST_START_STATUS="$?"
trap - INT TERM
[ "$TACHYON_LAST_START_STATUS" = "0" ] && sync_service_triggers
return "$TACHYON_LAST_START_STATUS"
}
@@ -273,7 +273,7 @@ function write_olcrtc_yaml_config(section, connection) {
function start_runtime() {
let sections = enabled_sections();
if (length(sections) == 0) {
log_message("No enabled OlcRTC sections found, stopping service");
if (service_init_exists())
command_success_from_args([cfg.service_init, "stop"]);
return true;
}
@@ -323,8 +323,10 @@ function start_runtime() {
}
function stop_runtime() {
if (service_init_exists()) {
command_success_from_args([cfg.service_init, "stop"]);
log_message("OlcRTC provider stopped");
}
return true;
}
+18 -14
View File
@@ -370,15 +370,16 @@ function restart_qwdtt_service() {
function start_runtime() {
let sections = enabled_sections();
if (length(sections) == 0) {
log_message("No enabled WDTT sections found, disabling provider");
if (qwdtt_installed()) {
system("uci set " + MODE + ".wdtt_state.enabled='0'");
system("uci commit " + MODE);
system("uci set " + MODE + ".wdtt_state.enabled='0' 2>/dev/null || true");
system("uci commit " + MODE + " 2>/dev/null || true");
if (fs.stat(cfg.qwdtt_service_init) != null)
command_success_from_args([cfg.qwdtt_service_init, "stop"]);
}
else {
system("uci set wdtt.settings.enabled='0'");
system("uci commit wdtt");
else if (fs.stat(cfg.config_path) != null || fs.stat(cfg.service_init) != null) {
system("uci set wdtt.settings.enabled='0' 2>/dev/null || true");
system("uci commit wdtt 2>/dev/null || true");
if (fs.stat(cfg.service_init) != null)
command_success_from_args([cfg.service_init, "stop"]);
}
return true;
@@ -431,16 +432,19 @@ function start_runtime() {
function stop_runtime() {
if (qwdtt_installed()) {
system("uci set " + MODE + ".wdtt_state.enabled='0'");
system("uci commit " + MODE);
system("uci set " + MODE + ".wdtt_state.enabled='0' 2>/dev/null || true");
system("uci commit " + MODE + " 2>/dev/null || true");
if (fs.stat(cfg.qwdtt_service_init) != null)
command_success_from_args([cfg.qwdtt_service_init, "stop"]);
}
else {
system("uci set wdtt.settings.enabled='0'");
system("uci commit wdtt");
command_success_from_args([cfg.service_init, "stop"]);
}
log_message("WDTT provider stopped");
}
else if (fs.stat(cfg.config_path) != null || fs.stat(cfg.service_init) != null) {
system("uci set wdtt.settings.enabled='0' 2>/dev/null || true");
system("uci commit wdtt 2>/dev/null || true");
if (fs.stat(cfg.service_init) != null)
command_success_from_args([cfg.service_init, "stop"]);
log_message("WDTT provider stopped");
}
return true;
}
+66 -2
View File
@@ -677,6 +677,27 @@ function add_mixed_proxy_for_section(config, section, service_address) {
inbound.users = [{ username, password }];
}
push(config.inbounds, inbound);
if (type(config.route) == "object" && type(config.route.rules) == "array" &&
length(config.route.rules) > 0 && config.route.rules[0].action == "sniff" &&
type(config.route.rules[0].inbound) == "array")
push(config.route.rules[0].inbound, inbound.tag);
push(config.route.rules, {
action: "hijack-dns",
inbound: inbound.tag,
port: 53
});
push(config.route.rules, {
action: "hijack-dns",
inbound: inbound.tag,
protocol: "dns"
});
push(config.route.rules, {
action: "route",
inbound: inbound.tag,
ip_is_private: true,
outbound: runtime_constants.DIRECT_OUTBOUND_TAG
});
let section_outbound = runtime_constants.outbound_tag(section[".name"]);
generator_routes.push_section_route_rule(config, {
action: "route",
@@ -706,9 +727,10 @@ function add_direct_bypass_proxy(config, settings, service_address) {
if (listen_port < 1 || listen_port > 65535)
runtime_generate_unsupported("direct bypass port is invalid");
let inbound_tag = runtime_constants.DIRECT_BYPASS_INBOUND_TAG;
push(config.inbounds, {
type: "mixed",
tag: runtime_constants.DIRECT_BYPASS_INBOUND_TAG,
tag: inbound_tag,
listen,
listen_port
});
@@ -717,9 +739,30 @@ function add_direct_bypass_proxy(config, settings, service_address) {
tag: runtime_constants.DIRECT_BYPASS_OUTBOUND_TAG,
routing_mark: runtime_constants.OUTBOUND_MARK
});
if (type(config.route) == "object" && type(config.route.rules) == "array" &&
length(config.route.rules) > 0 && config.route.rules[0].action == "sniff" &&
type(config.route.rules[0].inbound) == "array")
push(config.route.rules[0].inbound, inbound_tag);
push(config.route.rules, {
action: "hijack-dns",
inbound: inbound_tag,
port: 53
});
push(config.route.rules, {
action: "hijack-dns",
inbound: inbound_tag,
protocol: "dns"
});
push(config.route.rules, {
action: "route",
inbound: runtime_constants.DIRECT_BYPASS_INBOUND_TAG,
inbound: inbound_tag,
ip_is_private: true,
outbound: runtime_constants.DIRECT_OUTBOUND_TAG
});
push(config.route.rules, {
action: "route",
inbound: inbound_tag,
outbound: runtime_constants.DIRECT_BYPASS_OUTBOUND_TAG
});
}
@@ -731,6 +774,27 @@ function add_service_mixed_proxy_inbound(config, tag_name, listen_port, outbound
listen: runtime_constants.SERVICE_MIXED_INBOUND_ADDRESS,
listen_port
});
if (type(config.route) == "object" && type(config.route.rules) == "array" &&
length(config.route.rules) > 0 && config.route.rules[0].action == "sniff" &&
type(config.route.rules[0].inbound) == "array")
push(config.route.rules[0].inbound, tag_name);
push(config.route.rules, {
action: "hijack-dns",
inbound: tag_name,
port: 53
});
push(config.route.rules, {
action: "hijack-dns",
inbound: tag_name,
protocol: "dns"
});
push(config.route.rules, {
action: "route",
inbound: tag_name,
ip_is_private: true,
outbound: runtime_constants.DIRECT_OUTBOUND_TAG
});
generator_routes.push_section_route_rule(config, {
action: "route",
inbound: tag_name,
+3
View File
@@ -1301,6 +1301,9 @@ assert(outbound(matchers, "bypass-out").type == "direct", "bypass fallback outbo
assert(outbound(matchers, "proxy-1-out").detour == "detour-out", "connection URL outbound detour");
let mixed = inbound(matchers, "proxy-mixed-in");
assert(mixed && mixed.listen_port == 19090 && mixed.users[0].username == "user", "mixed inbound auth");
assert(route_rule(matchers, r => r.inbound == "proxy-mixed-in" && r.action == "hijack-dns" && r.port == 53) != null, "mixed inbound hijack-dns port 53");
assert(route_rule(matchers, r => r.inbound == "proxy-mixed-in" && r.action == "hijack-dns" && r.protocol == "dns") != null, "mixed inbound hijack-dns protocol dns");
assert(route_rule(matchers, r => r.inbound == "proxy-mixed-in" && r.ip_is_private == true && r.outbound == "direct-out") != null, "mixed inbound private IP bypass");
assert(route_rule(matchers, r => r.inbound == "proxy-mixed-in" && r.outbound == "proxy-out") != null, "mixed inbound route");
assert(dns_rule(matchers, r => contains(r.domain_suffix, "example.org")).server == "dns-server", "bypass domain real DNS rule");
assert(dns_rule(matchers, r => contains(r.domain_suffix, "proxy.example.org")).server == "fakeip-server", "proxy domain FakeIP DNS rule");