What is the purpose of option tcp_ecn in /etc/config/firewall?

I've got this defined in my /etc/config/firewall but it seems to do nothing and sysctl net.ipv4.tcp_ecn outputs 2 (default value in Linux kernel).

config defaults
...
        option tcp_ecn '1'

What's the purpose of that setting?

Manual where it was mentioned as legit firewall option: https://openwrt.org/docs/guide-user/firewall/firewall_configuration
System: OpenWrt 23.05.2

This is probably a holdover from fw3 where the option worked by setting the net.ipv4.tcp_ecn variable to 0 or 1.

* Set tcp_ecn to off
* Set tcp_ecn to on

Why is it still there if it does nothing? And how do I get ECN set on system-wide level then?

ECN - Explicit Congestion Notification. It's a way of telling a sender to slow down tcp transmission instead of dropping packets. It should be on by default. See ECN

SQM is optional and enabled only in one direction by default. What I'm talking about is a kernel system-wide toggle net.ipv4.tcp_ecn which is set to 2 by default for MANY years. Scenario described in OpenWrt documentation (linked above in original post) doesn't work in current stable. Looks like a bug to me.

Well, the wiki is mostly updated by forum members and you might be the first to actually notice that the option is ignored in the latest releases.

Use /etc/sysctl.conf or (even better) create a conf file with your custom settings in /etc/sysctl.d.

2 Likes

Yep, this is what I do (echo 'net.ipv4.tcp_ecn=1' > /etc/sysctl.d/20-tcp-ecn.conf) at least for two major releases because documented option doesn't work. I'm just sorting out my old tweaks by asking if those still needed :smile:

I believe it should be fixed in OpenWrt, not in wiki.

By setting the sysctl, but be aware this only affects TCP traffic that initiated or ends on your router, ECN negotiation is end to end, so this will not affect the ECN-ness of routed traffic....

SQM is optional, and even if installed by default not enabled at all as it needs to be properly configured before it can work as expected. In SQM with fq_codel as qdisc we default to ECN on for ingress traffic and ECN off for egress traffic, cake will silently ignore that setting and always use ECN for any direction.
The rationale for the original setting is that in early days of SQM when access capacity was measured in from below single to low double digit Mbps values, we wanted to not throw away packets in ingress as these has already passed the bottleneck and hence dropping these would waste essentially almost done throughput components. In egress direction the packets will not have passed the bottleneck yet, so by dropping them we could use the same transmit slot for a packet from a flow not already above capacity share. But this rationale might not be as convincing anymore given that access rates increased considerably....

Why either or? If you can fox OpenWrt itself, great, but until then at least mentioning that in the wiki would have helped your curiosity, so it might help others as well, no?

You can also put your changes into /etc/sysctl.conf to have them persist, if you add this file to the set conserved over upgrades you might not need to redo this manually...

I'm well-aware of that.

I didn't ask any questions about SQM but thanks for your comments.

I reported the issue on github: https://github.com/openwrt/openwrt/issues/14320

Then I misinterpreted your comment here:

Sorry, no pontification intended.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.