Fix ASCONF test and ensure it can be always run
cover Fix ASCONF test and ensure it can be always run
First fix the unreliable ASCONF test and then make the SCTP test create a GRE interface with an additional IPv4 address so that the ASCONF tests can be run even on a machine with just one global IPv4 address.
Ondrej Mosnacek (2):
tests/sctp: fix a race condition in the new ASCONF test tests/sctp: set up a GRE tunnel to activate ASCONF tests
tests/sctp/sctp_asconf_params_server.c | 7 +++++++ tests/sctp/test | 8 ++++++++ 2 files changed, 15 insertions(+)
Signature · 1 line
2.26.2
PATCH 1/2 tests/sctp: fix a race condition in the new ASCONF test
The new ASCONF test introduced recently (see Fixes: tag) is unstable and can randomly fail on slow machines. The problem seems to be triggered when the server does the sctp_bindx() calls before the client starts listening for a new message, so add a 1 second sleep before the bindx calls.
It is possible that this delay will not be enough on some very slow machines, but let's start with a small value and see how it goes. The one second seems to be enough for the Travis CI at least.
--- tests/sctp/sctp_asconf_params_server.c | 7 +++++++ 1 file changed, 7 insertions(+)
tests/sctp/sctp_asconf_params_server.c +7 -0
@@ -225,6 +225,13 @@ int main(int argc, char **argv) ((struct sockaddr_in6 *) new_pri_addr_res->ai_addr)->sin6_scope_id); +/* +* We can't do the sctp_bindx() calls too fast, otherwise the test +* that checks if these are denied would fail. Therefore, sleep for +* a bit to allow the client to catch up. +*/ +sleep (1 ); +/* * Now call sctp_bindx(3) to add 'new_pri_addr'. This uses Dynamic * Address Reconfiguration by sending an asconf chunk with
Signature · 1 line
2.26.2
Re: [PATCH 1/2] tests/sctp: fix a race condition in the new ASCONF test
Quoted 11 lines · Ondrej Mosnacek
The new ASCONF test introduced recently (see Fixes: tag) is unstable and
can randomly fail on slow machines. The problem seems to be triggered when the server does thesctp_bindx()calls before the client starts listening for a new message, so add a 1 second sleep before the bindx calls.It is possible that this delay will not be enough on some very slow machines, but let's start with a small value and see how it goes. The one second seems to be enough for the Travis CI at least.
Quoted 6 lines
Fixes 841ccaabb366 ("selinux-testsuite: Update SCTP asconfclient/server")
Signed-off-by Ondrej Mosnacek <[email protected]>--- tests/sctp/sctp_asconf_params_server.c | 7 +++++++ 1 file changed, 7 insertions(+)
Tested the three asconf tests over 1000 interations with no problems. In the meantime I'll review these tests to find a more reliable way to run them.
Quoted 23 lines
tests/sctp/sctp_asconf_params_server.c +2
-0@@ -225,6 +225,13 @@ int main(int argc, char **argv) ((struct sockaddr_in6 *) new_pri_addr_res->ai_addr)->sin6_scope_id); +/* +* We can't do the sctp_bindx() calls too fast, otherwise the test
tests/sctp/sctp_asconf_params_server.c +1
-0+* that checks if these are denied would fail. Therefore, sleep for
tests/sctp/sctp_asconf_params_server.c +4
-0+* a bit to allow the client to catch up. +*/ +sleep (1 ); +/* * Now call sctp_bindx(3) to add 'new_pri_addr'. This uses Dynamic
* Address Reconfiguration by sending an asconf chunk with
PATCH 2/2 tests/sctp: set up a GRE tunnel to activate ASCONF tests
In reply to Ondrej MosnacekCurrently, the ASCONF tests will activate only if the test system has two global IPv4 addresses, otherwise they are just skipped. Most systems, including the VM in CI, don't fulfill this condition.
As it turns out, this second IPv4 address can be set up very easily by creating a GRE trunnel interface over loopback. So make the SCTP test create such interface so that the ASCONF tests can be always run.
--- tests/sctp/test | 8 ++++++++ 1 file changed, 8 insertions(+)
tests/sctp/test +8 -0
@@ -35,6 +35,12 @@ BEGIN { else { $test_count = 75; + # Set up a GRE tunnel over loopback to ensure we have enough addresses + # for the ASCONF tests. + system "ip link add mygre type gretap local 127.0.0.1 remote 127.0.0.1"; + system "ip addr add 10.123.123.123 dev mygre"; + system "ip link set mygre up"; + # asconf parameter tests require two local non-loopback addresses. $ipaddress_list = `ip -o addr show up scope global`; $test_asconf = 0;
@@ -909,4 +915,6 @@ if ($test_nft) { system "nft -f $basedir/nftables-flush"; } +system "ip link del mygre"; + exit;
Signature · 1 line
2.26.2
Re: [PATCH 2/2] tests/sctp: set up a GRE tunnel to activate ASCONF tests
Quoted 9 lines · Ondrej Mosnacek
Currently, the ASCONF tests will activate only if the test system has two global IPv4 addresses, otherwise they are just skipped. Most systems, including the VM in CI, don't fulfill this condition.
As it turns out, this second IPv4 address can be set up very easily by
creating a GRE trunnel interface over loopback. So make the SCTP test create such interface so that the ASCONF tests can be always run.
Quoted 5 lines
Signed-off-by Ondrej Mosnacek <[email protected]>--- tests/sctp/test | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 27 lines
tests/sctp/test +1
-0@@ -35,6 +35,12 @@ BEGIN { else { $test_count = 75; + # Set up a GRE tunnel over loopback to ensure we have enoughaddresses
tests/sctp/test +2
-0+ # for the ASCONF tests. + system "ip link add mygre type gretap local 127.0.0.1 remote127.0.0.1";
tests/sctp/test +3
-0+ system "ip addr add 10.123.123.123 dev mygre"; + system "ip link set mygre up"; + # asconf parameter tests require two local non-loopbackaddresses.
$ipaddress_list = `ip -o addr show up scope global`; $test_asconf = 0;tests/sctp/test +2
-0@@ -909,4 +915,6 @@ if ($test_nft) { system "nft -f $basedir/nftables-flush"; } +system "ip link del mygre"; + exit;
Re: [PATCH 2/2] tests/sctp: set up a GRE tunnel to activate ASCONF tests
Quoted 10 lines · Richard Haines
Quoted 9 lines · Ondrej Mosnacek
Currently, the ASCONF tests will activate only if the test system has two global IPv4 addresses, otherwise they are just skipped. Most systems, including the VM in CI, don't fulfill this condition.
As it turns out, this second IPv4 address can be set up very easily by
creating a GRE trunnel interface over loopback. So make the SCTP test create such interface so that the ASCONF tests can be always run.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Ondrej Mosnacek <[email protected]>--- tests/sctp/test | 8 ++++++++ 1 file changed, 8 insertions(+)Acked-by Richard Haines <[email protected]>
Thanks! I applied both patches now.
Quoted 29 lines
Quoted 28 lines
tests/sctp/test +1
-0@@ -35,6 +35,12 @@ BEGIN { else { $test_count = 75; + # Set up a GRE tunnel over loopback to ensure we have enoughaddresses
tests/sctp/test +2
-0+ # for the ASCONF tests. + system "ip link add mygre type gretap local 127.0.0.1 remote127.0.0.1";
tests/sctp/test +3
-0+ system "ip addr add 10.123.123.123 dev mygre"; + system "ip link set mygre up"; + # asconf parameter tests require two local non-loopbackaddresses.
$ipaddress_list = `ip -o addr show up scope global`; $test_asconf = 0;tests/sctp/test +2
-0@@ -909,4 +915,6 @@ if ($test_nft) { system "nft -f $basedir/nftables-flush"; } +system "ip link del mygre"; + exit;
Signature · 3 lines
Ondrej Mosnacek Software Engineer, Platform Security - SELinux kernel Red Hat, Inc.