Skip to contentSkip to conversation

tests/inet_socket: enable MPTCP if it's disabled via sysctl

PATCH Applied Ondrej Mosnacek 1 participant 2 messages Jan 31, 2025 – Feb 6, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/inet_socket: enable MPTCP if it's disabled via sysctl

In CentOS Stream 10 (and possibly other environments) the net.mptcp.enabled sysctl will be set to 0 by default. The testuite currently doesn't detect this and hangs when trying to run the MPTCP tests. Adjust the test to temporarily enable MPTCP during the test so that it can succeed in these conditions.

---
 tests/inet_socket/test | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tests/inet_socket/test +16 -0
index 08c7b1d..ae06ae7 100755
@@ -91,6 +91,16 @@ sub server_end {
     system("rm -f $basedir/flag");
 }
 
+if ( $proto eq "mptcp" ) {
+
+    # Temporarily enable MPTCP if it's disabled by default
+    $mptcp_enabled = `sysctl -n net.mptcp.enabled`;
+    chomp($mptcp_enabled);
+    if ( $mptcp_enabled ne "1" ) {
+        system("sysctl -w net.mptcp.enabled=1");
+    }
+}
+
 # Load NetLabel configuration for full CIPSO/IPv4 labeling over loopback.
 system "/bin/sh $basedir/cipso-fl-load";
 
@@ -445,4 +455,10 @@ if ($test_calipso) {
     system "/bin/sh $basedir/calipso-flush";
 }
 
+if ( $proto eq "mptcp" and $mptcp_enabled ne "1" ) {
+
+    # Reset net.mptcp.enabled if it was 0 before test
+    system("sysctl -w net.mptcp.enabled=0");
+}
+
 exit;
Signature · 1 line
2.48.1
author Applied
#1 lore raw
Quoted 45 lines · Ondrej Mosnacek

In CentOS Stream 10 (and possibly other environments) the net.mptcp.enabled sysctl will be set to 0 by default. The testuite currently doesn't detect this and hangs when trying to run the MPTCP tests. Adjust the test to temporarily enable MPTCP during the test so that it can succeed in these conditions.

---
 tests/inet_socket/test | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tests/inet_socket/test +16 -1
index 08c7b1d..ae06ae7 100755
@@ -91,6 +91,16 @@ sub server_end {
     system("rm -f $basedir/flag");
 }
 
+if ( $proto eq "mptcp" ) {
+
+    # Temporarily enable MPTCP if it's disabled by default
+    $mptcp_enabled = `sysctl -n net.mptcp.enabled`;
+    chomp($mptcp_enabled);
+    if ( $mptcp_enabled ne "1" ) {
+        system("sysctl -w net.mptcp.enabled=1");
+    }
+}
+
 # Load NetLabel configuration for full CIPSO/IPv4 labeling over loopback.
 system "/bin/sh $basedir/cipso-fl-load";
 
@@ -445,4 +455,10 @@ if ($test_calipso) {
     system "/bin/sh $basedir/calipso-flush";
 }
 
+if ( $proto eq "mptcp" and $mptcp_enabled ne "1" ) {
+
+    # Reset net.mptcp.enabled if it was 0 before test
+    system("sysctl -w net.mptcp.enabled=0");
+}
+
 exit;
--
Quoted 2 lines

2.48.1

Applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/6aba9eb5ba78bcabe8abb5e3809f3680dc0403a1

Signature · 3 lines
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.