Skip to contentSkip to conversation

tests/sctp: add client peeloff tests

PATCH In review Ondrej Mosnacek 2 participants 3 messages Apr 13, 2022 – Apr 20, 2022 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 tests/sctp: add client peeloff tests

Currently the testsuite only verifies that SCTP peeloff works on the server side. However, it can just as well be used on the client side as well, which isn't being tested (and actually is buggy at the time of writing).

To correct this, add a simple SCTP peeloff client and a couple tests that verify that the client-side peeloff works well with SELinux.

The new tests are enabled on kernels 5.18+, where the fixes were introduced. While the fixes are now queued also for some stable streams, it's much simpler to just check the version against 5.18 and skip the test for all older kernels.

---

v4: added a kernel version check
v3: fixed uninitialized "sinlen" variable in sctp_peeloff_client.c
v2: rebased and resolved a conflict

 tests/sctp/.gitignore            |   1 +
 tests/sctp/Makefile              |   3 +-
 tests/sctp/sctp_peeloff_client.c | 254 +++++++++++++++++++++++++++++++
 tests/sctp/test                  | 170 ++++++++++++++++++++-
 4 files changed, 419 insertions(+), 9 deletions(-)
 create mode 100644 tests/sctp/sctp_peeloff_client.c
tests/sctp/.gitignore +1 -0
index c022b11..58e8c53 100644
@@ -4,5 +4,6 @@ sctp_bind
 sctp_bindx
 sctp_client
 sctp_connectx
+sctp_peeloff_client
 sctp_peeloff_server
 sctp_server
tests/sctp/Makefile +2 -1
index dd151fb..5e03650 100644
@@ -1,5 +1,6 @@
 TARGETS = sctp_client sctp_server sctp_bind sctp_bindx sctp_connectx \
-	sctp_asconf_params_client sctp_asconf_params_server sctp_peeloff_server
+	sctp_asconf_params_client sctp_asconf_params_server \
+	sctp_peeloff_client sctp_peeloff_server
 
 DEPS = sctp_common.c sctp_common.h
 CFLAGS ?= -Wall
tests/sctp/sctp_peeloff_client.c new file +254 -0

254 lines not on this page · raw message

tests/sctp/test +162 -8

257 lines not on this page · raw message

Signature · 1 line
2.35.1
Tested-by on v4 1/1
#1 lore raw
Quoted 22 lines · Ondrej Mosnacek

Currently the testsuite only verifies that SCTP peeloff works on the server side. However, it can just as well be used on the client side as
well, which isn't being tested (and actually is buggy at the time of writing).

To correct this, add a simple SCTP peeloff client and a couple tests that verify that the client-side peeloff works well with SELinux.

The new tests are enabled on kernels 5.18+, where the fixes were introduced. While the fixes are now queued also for some stable streams,
it's much simpler to just check the version against 5.18 and skip the test for all older kernels.

---

v4: added a kernel version check
v3: fixed uninitialized "sinlen" variable in sctp_peeloff_client.c
v2: rebased and resolved a conflict

Quoted 8 lines

 tests/sctp/.gitignore            |   1 + tests/sctp/Makefile              |   3 +- tests/sctp/sctp_peeloff_client.c | 254
+++++++++++++++++++++++++++++++
 tests/sctp/test                  | 170 ++++++++++++++++++++-

 4 files changed, 419 insertions(+), 9 deletions(-)

 create mode 100644 tests/sctp/sctp_peeloff_client.c

Tested on kernel 5.18-rc2

#2 lore raw
Quoted 32 lines · Richard Haines
Quoted 22 lines · Ondrej Mosnacek

Currently the testsuite only verifies that SCTP peeloff works on the server side. However, it can just as well be used on the client side as
well, which isn't being tested (and actually is buggy at the time of writing).

To correct this, add a simple SCTP peeloff client and a couple tests that verify that the client-side peeloff works well with SELinux.

The new tests are enabled on kernels 5.18+, where the fixes were introduced. While the fixes are now queued also for some stable streams,
it's much simpler to just check the version against 5.18 and skip the test for all older kernels.

---

v4: added a kernel version check
v3: fixed uninitialized "sinlen" variable in sctp_peeloff_client.c
v2: rebased and resolved a conflict

Quoted 8 lines
 tests/sctp/.gitignore            |   1 +
 tests/sctp/Makefile              |   3 +-
 tests/sctp/sctp_peeloff_client.c | 254
+++++++++++++++++++++++++++++++
 tests/sctp/test                  | 170 ++++++++++++++++++++-
 4 files changed, 419 insertions(+), 9 deletions(-)
 create mode 100644 tests/sctp/sctp_peeloff_client.c
Quoted 3 lines

Tested on kernel 5.18-rc2

Thanks! The patch is now applied.

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