Skip to content

Commit 9cb8e04

Browse files
Christian Braunerdavem330
authored andcommitted
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 Link: lxc/lxc#3267 Reported-by: Haw Loeung <[email protected]> Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d51a01 commit 9cb8e04

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

net/ipv4/sysctl_net_ipv4.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -554,18 +554,6 @@ static struct ctl_table ipv4_table[] = {
554554
.proc_handler = proc_dointvec,
555555
},
556556
#endif /* CONFIG_NETLABEL */
557-
{
558-
.procname = "tcp_available_congestion_control",
559-
.maxlen = TCP_CA_BUF_MAX,
560-
.mode = 0444,
561-
.proc_handler = proc_tcp_available_congestion_control,
562-
},
563-
{
564-
.procname = "tcp_allowed_congestion_control",
565-
.maxlen = TCP_CA_BUF_MAX,
566-
.mode = 0644,
567-
.proc_handler = proc_allowed_congestion_control,
568-
},
569557
{
570558
.procname = "tcp_available_ulp",
571559
.maxlen = TCP_ULP_BUF_MAX,
@@ -885,6 +873,18 @@ static struct ctl_table ipv4_net_table[] = {
885873
.maxlen = TCP_CA_NAME_MAX,
886874
.proc_handler = proc_tcp_congestion_control,
887875
},
876+
{
877+
.procname = "tcp_available_congestion_control",
878+
.maxlen = TCP_CA_BUF_MAX,
879+
.mode = 0444,
880+
.proc_handler = proc_tcp_available_congestion_control,
881+
},
882+
{
883+
.procname = "tcp_allowed_congestion_control",
884+
.maxlen = TCP_CA_BUF_MAX,
885+
.mode = 0644,
886+
.proc_handler = proc_allowed_congestion_control,
887+
},
888888
{
889889
.procname = "tcp_keepalive_time",
890890
.data = &init_net.ipv4.sysctl_tcp_keepalive_time,

0 commit comments

Comments
 (0)