Fix zapret runtime queue conflict

This commit is contained in:
ushan0v
2026-04-12 07:10:37 +03:00
parent 3cde2375fd
commit 0dfb75cf71
3 changed files with 38 additions and 4 deletions
+2 -2
View File
@@ -845,9 +845,9 @@ install_packages() {
post_install() {
rm -f /var/luci-indexcache* /tmp/luci-indexcache*
[ -x /etc/init.d/rpcd ] && /etc/init.d/rpcd reload >/dev/null 2>&1 || true
if [ -n "$ZAPRET_PACKAGE_FILE" ] && [ -x /usr/bin/podkop-plus ]; then
if [ -x /usr/bin/podkop-plus ] && [ -x /etc/init.d/zapret ]; then
/usr/bin/podkop-plus neutralize_zapret_defaults >/dev/null 2>&1 ||
warn "Failed to neutralize the default standalone zapret profile after installation."
warn "Failed to neutralize the standalone zapret profile after installation or upgrade."
fi
if [ "$PODKOP_WAS_ENABLED" -eq 1 ] && [ -x /etc/init.d/podkop-plus ]; then
+2 -2
View File
@@ -4771,10 +4771,10 @@ global_check() {
if [ -x /etc/init.d/zapret ] && /etc/init.d/zapret status >/dev/null 2>&1; then
print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print_global "✅ Standalone zapret service is active and kept untouched. Podkop Plus uses its own Zapret contour."
print_global "⚠️ Standalone zapret service is active and can conflict with Podkop Plus NFQUEUE ownership."
elif [ -x /etc/init.d/zapret ] && /etc/init.d/zapret enabled >/dev/null 2>&1; then
print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print_global "ℹ️ Standalone zapret autostart is enabled. Podkop Plus uses its own Zapret contour."
print_global "ℹ️ Standalone zapret autostart is enabled and will be neutralized before Podkop Plus starts action=zapret."
fi
print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+34
View File
@@ -883,6 +883,11 @@ check_zapret_requirements() {
return 0
fi
if ! ensure_zapret_standalone_conflict_resolved; then
log "Failed to neutralize the standalone zapret profile that conflicts with Podkop Plus NFQUEUE ownership. Aborted." "fatal"
exit 1
fi
if ! prepare_zapret_runtime; then
log "Failed to prepare the Podkop Plus zapret runtime in $ZAPRET_RUNTIME_BASE_DIR. Aborted." "fatal"
exit 1
@@ -920,6 +925,23 @@ zapret_standalone_uci_config_present() {
uci -q get zapret.config >/dev/null 2>&1
}
zapret_standalone_defaults_active() {
local run_on_boot nfqws_enable
if is_zapret_standalone_service_running || is_zapret_standalone_service_enabled; then
return 0
fi
if ! zapret_standalone_uci_config_present; then
return 1
fi
run_on_boot="$(uci -q get zapret.config.run_on_boot)"
nfqws_enable="$(uci -q get zapret.config.NFQWS_ENABLE)"
[ "${run_on_boot:-0}" != "0" ] || [ "${nfqws_enable:-0}" != "0" ]
}
sync_zapret_standalone_config() {
if [ -x "$ZAPRET_SOURCE_BASE_DIR/sync_config.sh" ]; then
"$ZAPRET_SOURCE_BASE_DIR/sync_config.sh" >/dev/null 2>&1
@@ -996,6 +1018,13 @@ neutralize_zapret_standalone_defaults() {
return 0
}
ensure_zapret_standalone_conflict_resolved() {
zapret_standalone_defaults_active || return 0
log "Neutralizing the standalone zapret profile before starting Podkop Plus managed NFQUEUE rules"
neutralize_zapret_standalone_defaults
}
get_zapret_nfqws_process_count() {
local count=0 pidfile pid
@@ -1119,12 +1148,17 @@ get_zapret_status_json() {
outbounds_configured="${ZAPRET_RUNTIME_OUTBOUNDS_CONFIGURED:-0}"
routes_configured="${ZAPRET_RUNTIME_ROUTES_CONFIGURED:-0}"
if zapret_standalone_defaults_active && [ "$configured" -eq 1 ]; then
conflict=1
fi
if [ "${running_process_count:-0}" -gt "${expected_process_count:-0}" ]; then
conflict=1
fi
if [ "$configured" -eq 1 ] &&
[ "$installed" -eq 1 ] &&
[ "$conflict" -eq 0 ] &&
[ "$outbounds_configured" -eq 1 ] &&
[ "$routes_configured" -eq 1 ] &&
[ "${expected_process_count:-0}" -gt 0 ] &&