简体   繁体   中英

Set TCP ECN on a socket (C Linux)

Is it there a way to set TCP ECN on an unprivileged TCP socket in a C linux program?

Does any congestion algorythm that can be set through setsockopt() involve ECN?

Thank you!

Short answer: no and technically yes (but based on the question it won't help and I don't think it is yes to what you wanted to ask).

ECN is turned on by echoing 1 to /proc/sys/net/ipv4/tcp_ecn. See ip_sysctl.txt . By default it should be 2 which enables ECN when the peer requests it, but does not initiate requests for it. To set this would require "privileges" and can't be done via a socket so the 1st answer is no.

Congestion algorithms may be set on a per socket basis and may involve ECN, trivially the default one does. So technically , yes. But even though the congestion algorithms may involve ECN, the code in tcp_input.c and tcp_output.c makes it clear that without the sysctl flag set, it won't use it, so it won't help.

See the very good information in this answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM