Conversation
Owner
|
@eyaeya 不要刷pr否则屏蔽,具体解决哪个issues请关联实际用户反馈 |
This was referenced Jul 8, 2026
Closed
Contributor
Author
|
这个拆分 PR 已被新的合并版 PR 取代:#5229 原因:#5223、#5226 都修改 fw4 DNS 劫持/redirect 相邻逻辑,并且按任意顺序合并都会在 已在合并版 PR 中验证:
|
Contributor
Author
好的,我将停止提交PR。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency chain
推荐合并顺序:#5223 和本 PR 都改
luci-app-openclash/root/etc/init.d/openclash的 fw4 DNS 区域,建议先合并 #5223,再合并本 PR 并按需解决文本冲突。语义组合方式是:同时保留 #5223 的nat_outputguard 和本 PR 的openclash_dns_redirectchain / jump 幂等。问题现象
fw4 +
enable_redirect_dns=2场景下,restore/start 重入会重复追加openclash_dns_redirect链内规则和dstnat -> openclash_dns_redirectjump。时间长了会造成 nft 规则堆叠,日志和排障也会被重复规则干扰。根因
#5209 已解决 direct DNS hijack 规则的 IPv4/IPv6 识别,但
enable_redirect_dns=2的 jump 规则没有OpenClash DNS Hijackcomment,也没有独立 guard;openclash_dns_redirect链每次 add rule 前也没有 flush,因此 restore 重入会累积规则。证据
enable_redirect_dns=2分支每次都会向openclash_dns_redirectadd 规则,并无条件向dstnatinsert jump。enable_redirect_dns=2分支同样无条件 insert IPv6 jump。reload "restore"路径会调用do_run_mode和check_core_status,不一定先完整 revert firewall,因此调用点需要自身幂等。tests/fw4_dns_hijack_guard_test.sh覆盖了 IPv4/IPv6 jump 识别,并用结构断言确认真实 jump 插入在对应fw4_has_dns_redirect_jumpguard 下。修复方案
fw4_has_dns_redirect_jump,按 IPv4/IPv6 识别dstnat -> openclash_dns_redirectjump。enable_redirect_dns=2重建前 flushopenclash_dns_redirect链,避免链内 redirect 规则堆叠。为什么没有扩大修复范围
没有修改 fw3/iptables 分支,没有改 direct DNS hijack 规则,也没有处理
nat_outputDNS 幂等;后者由 #5223 单独处理。本 PR 只覆盖enable_redirect_dns=2的 redirect chain 和 dstnat jump。与已有开启态 PR 的关系
nat_outputDNS 劫持 guard,和本 PR同区相邻但行为不同;两者可能有文本冲突,语义上应组合。验证命令和结果
均已通过:
最后一条无命中。
剩余风险
未做 live router 验证。该补丁会在
enable_redirect_dns=2时刷新openclash_dns_redirect链内容;如果用户在运行中切换 DNS redirect 端口或 LAN access 规则,下一次 restore 会以当前 UCI 状态重建该链。