diff mbox series

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

Message ID 20250131152122.1452103-1-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Ondrej Mosnáček
Headers show
Series [testsuite] tests/inet_socket: enable MPTCP if it's disabled via sysctl | expand

Commit Message

Ondrej Mosnacek Jan. 31, 2025, 3:21 p.m. UTC
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.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 tests/inet_socket/test | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Ondrej Mosnacek Feb. 6, 2025, 8:23 a.m. UTC | #1
On Fri, Jan 31, 2025 at 4:21 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> 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.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  tests/inet_socket/test | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/tests/inet_socket/test b/tests/inet_socket/test
> index 08c7b1d..ae06ae7 100755
> --- a/tests/inet_socket/test
> +++ b/tests/inet_socket/test
> @@ -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;
> --
> 2.48.1
>

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

Patch

diff --git a/tests/inet_socket/test b/tests/inet_socket/test
index 08c7b1d..ae06ae7 100755
--- a/tests/inet_socket/test
+++ b/tests/inet_socket/test
@@ -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;