net/ipv4/sysctl: show tcp_{allowed,available}_congestion_control in non-initial netns
Subsystems (2)
PATCH 1/1 net/ipv4/sysctl: show tcp_{allowed,available}_congestion_control in non-initial netns
It is currenty possible to switch the TCP congestion control algorithm in non-initial network namespaces:
unshare -U --map-root --net --fork --pid --mount-proc echo "reno" > /proc/sys/net/ipv4/tcp_congestion_control
works just fine. But currently non-initial network namespaces have no way of kowing which congestion algorithms are available or allowed other than through trial and error by writing the names of the algorithms into the aforementioned file.
Since we already allow changing the congestion algorithm in non-initial network namespaces by exposing the tcp_congestion_control file there is no reason to not also expose the tcp_{allowed,available}_congestion_control files to non-initial network namespaces. After this change a container with a separate network namespace will show:
root@f1:~# ls -al /proc/sys/net/ipv4/tcp_* | grep congestion -rw-r--r-- 1 root root 0 Feb 19 11:54 /proc/sys/net/ipv4/tcp_allowed_congestion_control -r--r--r-- 1 root root 0 Feb 19 11:54 /proc/sys/net/ipv4/tcp_available_congestion_control -rw-r--r-- 1 root root 0 Feb 19 11:54 /proc/sys/net/ipv4/tcp_congestion_control
--- net/ipv4/sysctl_net_ipv4.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
net/ipv4/sysctl_net_ipv4.c +12 -12
@@ -554,18 +554,6 @@ static struct ctl_table ipv4_table[] = { .proc_handler = proc_dointvec, },#endif /* CONFIG_NETLABEL */ - { - .procname = "tcp_available_congestion_control", - .maxlen = TCP_CA_BUF_MAX, - .mode = 0444, - .proc_handler = proc_tcp_available_congestion_control, - }, - { - .procname = "tcp_allowed_congestion_control", - .maxlen = TCP_CA_BUF_MAX, - .mode = 0644, - .proc_handler = proc_allowed_congestion_control, - }, { .procname = "tcp_available_ulp", .maxlen = TCP_ULP_BUF_MAX,
@@ -885,6 +873,18 @@ static struct ctl_table ipv4_net_table[] = { .maxlen = TCP_CA_NAME_MAX, .proc_handler = proc_tcp_congestion_control, }, + { + .procname = "tcp_available_congestion_control", + .maxlen = TCP_CA_BUF_MAX, + .mode = 0444, + .proc_handler = proc_tcp_available_congestion_control, + }, + { + .procname = "tcp_allowed_congestion_control", + .maxlen = TCP_CA_BUF_MAX, + .mode = 0644, + .proc_handler = proc_allowed_congestion_control, + }, { .procname = "tcp_keepalive_time", .data = &init_net.ipv4.sysctl_tcp_keepalive_time,
base-commit: bb6d3fb354c5ee8d6bde2d576eb7220ea09862b9
Signature · 1 line
2.25.0
From: Christian Brauner <[email protected]>
Date: Wed, 19 Feb 2020 13:02:53 +0100
Quoted 22 lines
It is currenty possible to switch the TCP congestion control algorithm in non-initial network namespaces:
unshare -U --map-root --net --fork --pid --mount-proc echo "reno" >
/proc/sys/net/ipv4/tcp_congestion_controlworks just fine. But currently non-initial network namespaces have no way of kowing which congestion algorithms are available or allowed other than through trial and error by writing the names of the algorithms into the aforementioned file.
Since we already allow changing the congestion algorithm in non-initial network namespaces by exposing thetcp_congestion_controlfile there is no reason to not also expose the tcp_{allowed,available}_congestion_control files to non-initial network namespaces. After this change a container with a separate network namespace will show:root@f1:~# ls -al /proc/sys/net/ipv4/tcp_* | grep congestion(quoted diff) +0
-3-rw-r--r-- 1 root root 0 Feb 19 11:54 /proc/sys/net/ipv4/tcp_allowed_congestion_control -r--r--r-- 1 root root 0 Feb 19 11:54 /proc/sys/net/ipv4/tcp_available_congestion_control -rw-r--r-- 1 root root 0 Feb 19 11:54 /proc/sys/net/ipv4/tcp_congestion_control
Quoted 3 lines
Reported-by Haw Loeung <[email protected]>Signed-off-by Christian Brauner <[email protected]>
Applied, thank you.