Skip to content

luci-app-timecontrol: fix IPv6 bypass, midnight weekday shift, flow o… - #415

Merged
coolsnowwolf merged 1 commit into
coolsnowwolf:openwrt-25.12from
82kg:openwrt-25.12
Sep 6, 2026
Merged

coolsnowwolf merged 1 commit into
coolsnowwolf:openwrt-25.12from
82kg:openwrt-25.12

Conversation

@82kg

@82kg 82kg commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Description

修复 luci-app-timecontrol 存在的多个缺陷:

1. IPv6 流量完全未控制(iptables/fw3 后端)

  • 原来只有 iptables 规则,ip6tables 完全为空,双栈网络下被控设备可通过 IPv6 绕过时间控制
  • 现在每条规则同时下发到 iptables 和 ip6tables

2. 跨午夜拆分时星期集合错位

  • 原来 nft 路径拆分 22:00→08:00 时两段共用同一组星期,导致错封当天凌晨、漏放次日凌晨
  • 现在午夜后的段使用星期+1(周五 22:00→周六 08:00 语义正确),iptables 和 nft 两个后端行为统一

3. nft/fw4 下 flow offloading 导致规则失效

  • 开启软件快速转发后已建立连接走 fast path 绕过 forward hook,DROP 规则匹配不到
  • 加载规则后立即 flush fw4 的 flowtable,强制回到慢路径

4. LuCI 保存与应用后服务不自动重启

  • uci-defaults 中 ucitrack 注册缺少文件存在性检查,配置文件不存在时报错导致后续逻辑跳过
  • 加上 [ -f "/etc/config/ucitrack" ] 保护(与 openclash/passwall/mosdns 一致)
  • CBI 模型增加 apply_on_parse=true + on_after_apply 回调,保存后自动 reload

5. 其他

  • 注册 status 命令,/etc/init.d/timecontrol status 可正常调用
  • PKG_RELEASE 升至 3

Tested on

之前在fw3环境下ipv6流量无法拦截。现在测试已ok。fw4应该本来就好的

…ffloading and auto-reload

- Add ip6tables mirror rules: every iptables rule is now duplicated into
  ip6tables so that IPv6 forwarded traffic is controlled on fw3 systems.
- Fix midnight-spanning weekday shift: when a time range crosses midnight
  (e.g. 22:00-08:00), the after-midnight segment now correctly uses
  weekdays+1 (Fri 22:00 -> Sat 08:00 instead of blocking Fri 00:00-08:00).
- Flush nft flowtable on start: on fw4 systems with flow offloading,
  existing offloaded connections are forced back to the slow path where
  the DROP rules can reach them.
- Register EXTRA_COMMANDS status: the status() function is now callable
  via /etc/init.d/timecontrol status.
- Guard ucitrack registration: check /etc/config/ucitrack exists before
  adding entries, matching the pattern used by openclash/passwall/mosdns.
- Add CBI on_after_apply callback: with apply_on_parse=true, LuCI Save &
  Apply now triggers an automatic service reload (same approach as
  openvpn/passwall/lucky).
- Bump PKG_RELEASE to 3.

Signed-off-by: sunj <sun82kg@qq.com>
@coolsnowwolf
coolsnowwolf merged commit c04abe1 into coolsnowwolf:openwrt-25.12 Sep 6, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants