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:
@@ -273,8 +273,8 @@ 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");
|
||||
command_success_from_args([cfg.service_init, "stop"]);
|
||||
if (service_init_exists())
|
||||
command_success_from_args([cfg.service_init, "stop"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -323,8 +323,10 @@ function start_runtime() {
|
||||
}
|
||||
|
||||
function stop_runtime() {
|
||||
command_success_from_args([cfg.service_init, "stop"]);
|
||||
log_message("OlcRTC provider stopped");
|
||||
if (service_init_exists()) {
|
||||
command_success_from_args([cfg.service_init, "stop"]);
|
||||
log_message("OlcRTC provider stopped");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -370,16 +370,17 @@ 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);
|
||||
command_success_from_args([cfg.qwdtt_service_init, "stop"]);
|
||||
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"]);
|
||||
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);
|
||||
command_success_from_args([cfg.qwdtt_service_init, "stop"]);
|
||||
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"]);
|
||||
log_message("WDTT provider stopped");
|
||||
}
|
||||
else {
|
||||
system("uci set wdtt.settings.enabled='0'");
|
||||
system("uci commit wdtt");
|
||||
command_success_from_args([cfg.service_init, "stop"]);
|
||||
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");
|
||||
}
|
||||
log_message("WDTT provider stopped");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user