Skip to content

luci-app-firewall: drop unused TCP CCA option - #418

Open
leochien0102 wants to merge 1 commit into
coolsnowwolf:openwrt-25.12from
leochien0102:luci-app-firewall-drop-tcpcca
Open

leochien0102 wants to merge 1 commit into
coolsnowwolf:openwrt-25.12from
leochien0102:luci-app-firewall-drop-tcpcca

Conversation

@leochien0102

@leochien0102 leochien0102 commented Sep 14, 2026

Copy link
Copy Markdown

问题

a3ac471c96(luci-app-firewall: add bbr option for fw3/fw4)在「防火墙 → 区域设置 → 常规设置」中加入了「TCP 拥塞控制算法」下拉框(bbr / cubic / reno)。它会把 firewall.@defaults[0].tcpcca 写进 uci,但没有任何代码读取这个选项,选择后不会改变系统实际使用的算法。

排查范围与结果:

  • LuCI(openwrt-25.12):全仓库搜索 tcpcca,只有两处用到:
    • luci-app-turboacc:读取的是自己的 turboacc.config.tcpcca,不是 firewall 下的这个选项;
    • 26d2f86ae2 新增的运行状态行:只读取 /proc/sys/net/ipv4/tcp_congestion_control 用于显示。
  • LEDE(master)firewallfirewall4 包、init 脚本、hotplug、uci-defaults 里都没有读取这个选项的代码;a3ac471c96 之后也没有任何提交涉及 tcpcca。fw3 和 fw4 都一样。

现象

  1. 选了不生效:下拉框改成 bbr 并保存应用后,net.ipv4.tcp_congestion_control 不变。26d2f86ae2 加入运行状态行之后,这个矛盾直接显示在同一个页面上:下拉框显示 BBR,上方状态行显示当前算法是 CUBIC。
  2. 没动也会写配置:该选项设置了 rmempty = falsedefault = 'cubic',而配置里原本没有这个值(cfgvalue 为空),表单值是 'cubic',两者不等,AbstractValue.parse() 就会写入。所以只要在这个页面点一次「保存」,即使没碰过下拉框,/etc/config/firewall 里也会多出一行 option tcpcca 'cubic'
  3. 默认值与实际不符kmod-tcp-bbr 会安装 /etc/sysctl.d/12-tcp-bbr.conf,开机时把算法设为 bbr;此时下拉框仍默认显示 cubic。
  4. 选项列表写死:列表固定为 bbr / cubic / reno,不检查内核实际支持哪些算法。没装 kmod-tcp-bbr 时也能选 bbr。

为什么删除,而不是补上后端

  • turboacc 已经负责这件事luci-app-turboacc 的选项列表来自 tcp_available_congestion_control,通过 PACKAGE_TURBOACC_INCLUDE_BBR_CCA 依赖 kmod-tcp-bbr,并在 start_service 中执行 sysctl -w net.ipv4.tcp_congestion_control="$tcpcca"
  • 补后端会出现两处设置互相覆盖:turboacc 会把自己的 fullconeflow_offloading 同步写进 firewall.@defaults[0],但 tcpcca 例外,它直接改 sysctl,不经过 firewall。如果防火墙这边也去改 sysctl,同一个值就有两个来源,谁最后执行谁生效,结果不可预期。
  • 补后端要跨仓库:需要改 LEDE 的 firewall/firewall4 包,还要先决定由谁负责这个设置,改动远比这个 UI 选项本身大。

删除后页面恢复一致:26d2f86ae2 的运行状态行继续如实显示当前算法;需要修改时使用 turboacc 或 /etc/sysctl.conf

改动

  • zones.js:删除 addTCPCCAOption 及两处调用(fullcone 分支内和 else 分支)。
  • po/zh_Hans/firewall.po:删除随之失效的 TCP CCATCP congestion control algorithm. 两条翻译。
  • 运行状态行、/usr/libexec/luci-firewall-status 和 ACL 保持不变;FullCone 相关选项不受影响。
  • 已经写入 option tcpcca 的旧配置不需要迁移:本来就没有代码读取它,留着不影响任何行为。

验证

  • origin/openwrt-25.12725ddc051f)上改动,zones.js 通过语法检查。
  • 我们自用的固件从 2026-08-28 起以 feed 补丁形式删除了这个选项(对应 26d2f86ae2 之前的代码),已经实际刷机运行。本 PR 是在 26d2f86ae2 之后的代码上重新整理的版本。
  • This PR is not from my main or master branch , but a separate branch ✅
  • Each commit has a valid ✒️ Signed-off-by: <my@email.address> row (via git commit --signoff)
  • Each commit and PR title has a valid 📝 <package name>: title first line subject for packages
  • Incremented 🆙 any PKG_VERSION in the Makefile —— 不适用:luci-app-firewall 的 Makefile 没有 PKG_VERSION,版本由 luci.mk 根据 git 自动生成

a3ac471 ("luci-app-firewall: add bbr option for fw3/fw4") added a
"TCP CCA" list to the zone page that stores
firewall.@defaults[0].tcpcca, but nothing reads that option: neither
fw3 nor fw4, nor any init script, hotplug handler or uci-defaults in
LEDE or this feed. Picking bbr leaves net.ipv4.tcp_congestion_control
untouched, and since 26d2f86 the page shows the real value right
above the list, so the two visibly disagree.

The option also misleads in smaller ways. With rmempty = false and a
default of cubic, saving the page writes "option tcpcca 'cubic'" even
when the list was never touched. The default ignores kmod-tcp-bbr,
whose sysctl.d file switches the kernel to bbr at boot, and the fixed
bbr/cubic/reno choices ignore what the kernel actually offers.

luci-app-turboacc already owns this setting: it lists the available
algorithms, pulls in kmod-tcp-bbr, and applies turboacc.config.tcpcca
with sysctl in start_service. Unlike fullcone and flow_offloading it
does not mirror the value into the firewall config, so wiring up the
firewall option as well would give one sysctl two competing owners.

Remove the list and its now unused zh_Hans strings. The runtime status
line stays and remains the accurate read-only view. Existing tcpcca
entries in /etc/config/firewall have no reader and are left alone.

Signed-off-by: leochien0102 <leochien0102@gmail.com>
leochien0102 added a commit to leochien0102/openwrt-actions that referenced this pull request Sep 14, 2026
coolsnowwolf/luci 26d2f86ae2 added a runtime NAT / TCP CCA status line to
the zone page and inserted its setup code directly in front of the
addTCPCCAOption closure. The first hunk lost its context, patch failed, and
the build stopped at apply_patches.

That commit only displays the live sysctl value; the dropdown still has no
reader, so the removal stands. The diff body is regenerated against the
current feed and keeps the status line. The description gains a paragraph
on 26d2f86ae2 and points at coolsnowwolf/luci#418, the same change proposed
upstream -- once it merges this patch is reported as already applied and
can be deleted.
leochien0102 added a commit to leochien0102/openwrt-actions that referenced this pull request Sep 14, 2026
coolsnowwolf/luci 26d2f86ae2 added a runtime NAT / TCP CCA status line to
the zone page and inserted its setup code directly in front of the
addTCPCCAOption closure. The first hunk lost its context, patch failed, and
the build stopped at apply_patches.

That commit only displays the live sysctl value; the dropdown still has no
reader, so the removal stands. The diff body is regenerated against the
current feed and keeps the status line. The description gains a paragraph
on 26d2f86ae2 and points at coolsnowwolf/luci#418, the same change proposed
upstream -- once it merges this patch is reported as already applied and
can be deleted.
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.

1 participant