sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
PATCH 1/1 sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
If two ipv6 addresses have same family, a buggy kernel(e.g. RHEL6) lacked
the port check for them, and made this test get a failure with EINVAL:
-------------------------------------------------------------------------
safe_net.c:160: BROK: sctp_big_chunk.c:77: setsockopt(4, 132, 100, 0x7ffdbaac83a0, 91644) failed: EINVAL
-------------------------------------------------------------------------
If you want to know detailed info for the bug, please see the following commit:
'40b4f0f (sctp: lack the check for ports in sctp_v6_cmp_addr)'
We just want to hint users about the likely cause of the failure.
--- testcases/network/sctp/sctp_big_chunk.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
testcases/network/sctp/sctp_big_chunk.c +19 -3
@@ -19,6 +19,7 @@* chunk in _sctp_make_chunk()") */ +#include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h>
@@ -58,7 +59,7 @@ static void setup_server(void)static void setup_client (void ) {struct sockaddr_in6 addr_buf[addr_num]; -int i; +int i, res; cfd =SAFE_SOCKET (AF_INET6 ,SOCK_STREAM ,IPPROTO_SCTP ); rmt.sin6_family =AF_INET6 ;
@@ -73,8 +74,23 @@ static void setup_client(void) addr_buf[i].sin6_addr = in6addr_loopback; } -SAFE_SETSOCKOPT (cfd,SOL_SCTP ,SCTP_SOCKOPT_BINDX_ADD , addr_buf, -sizeof (addr_buf)); + res =setsockopt (cfd,SOL_SCTP ,SCTP_SOCKOPT_BINDX_ADD , addr_buf, +sizeof (addr_buf)); +if (res) { +/* Without commit 40b4f0f, sctp_v6_cmp_addr() lacks the port +* check for two ipv6 addresses which have same family. that +* will make setsockopt(SCTP_SOCKOPT_BINDX_ADD) cannot work +* well. +*/ +if (errno ==EINVAL ) { +tst_res (TINFO ,"possibly kernel lacked the port check " +"for two ipv6 addresses which have same family" ); + } + +tst_brk (TBROK |TERRNO ,"setsockopt(%d, SOL_SCTP, " +"SCTP_SOCKOPT_BINDX_ADD, %p, %lu) failed" , + cfd, addr_buf,sizeof (addr_buf)); + } }static void setup (void )
Signature · 1 line
1.8.3.1
PATCH 1/1 sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
Quoted 10 lines · Xiao Yang
If two ipv6 addresses have same family, a buggy kernel(e.g. RHEL6) lacked
the port check for them, and made this test get a failure with EINVAL:
-------------------------------------------------------------------------
safe_net.c:160: BROK: sctp_big_chunk.c:77:setsockopt(4, 132, 100, 0x7ffdbaac83a0, 91644)failed: EINVAL
-------------------------------------------------------------------------If you want to know detailed info for the bug, please see the following commit:
'40b4f0f (sctp: lack the check for ports insctp_v6_cmp_addr)'We just want to hint users about the likely cause of the failure.
I guess, the test will fail with EINVAL with this patch,
https://patchwork.ozlabs.org/patch/897172/
it tries to avoid the check with ports so it won't be possible to pass the same addresses like the test does, it is currently in ML.
The first version of the test would work but it can be slower for some VMs, because it creates unique addresses.
http://lists.linux.it/pipermail/ltp/2018-March/007269.html
Thanks,
Alexey
PATCH 1/1 sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
Quoted 10 lines · Alexey Kodanev
Quoted 9 lines · Xiao Yang
If two ipv6 addresses have same family, a buggy kernel(e.g. RHEL6) lacked
the port check for them, and made this test get a failure with EINVAL:
-------------------------------------------------------------------------
safe_net.c:160: BROK: sctp_big_chunk.c:77:setsockopt(4, 132, 100, 0x7ffdbaac83a0, 91644)failed: EINVAL
-------------------------------------------------------------------------If you want to know detailed info for the bug, please see the following commit:
'40b4f0f (sctp: lack the check for ports insctp_v6_cmp_addr)'
Quoted 8 lines
Quoted 1 line
We just want to hint users about the likely cause of the failure.
I guess, the test will fail with EINVAL with this patch,
https://patchwork.ozlabs.org/patch/897172/
it tries to avoid the check with ports so it won't be possible to pass the same addresses like the test does, it is currently in ML.
Hi Alexey,
Thanks for your explanation.
Before commit 40b4f0f, it also failed with EINVAL because of the same ipv6 addresses. Do you want to apply the first version of the test?
Thanks,
Xiao Yang
Quoted 10 lines
The first version of the test would work but it can be slower for some VMs, because it creates unique addresses.
http://lists.linux.it/pipermail/ltp/2018-March/007269.html
Thanks,
Alexey
PATCH 1/1 sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
Quoted 19 lines · Xiao Yang
Quoted 10 lines · Alexey Kodanev
Quoted 9 lines · Xiao Yang
If two ipv6 addresses have same family, a buggy kernel(e.g. RHEL6) lacked
the port check for them, and made this test get a failure with EINVAL:
-------------------------------------------------------------------------
safe_net.c:160: BROK: sctp_big_chunk.c:77:setsockopt(4, 132, 100, 0x7ffdbaac83a0, 91644)failed: EINVAL
-------------------------------------------------------------------------If you want to know detailed info for the bug, please see the following commit:
'40b4f0f (sctp: lack the check for ports insctp_v6_cmp_addr)'Quoted 8 lines
Quoted 1 line
We just want to hint users about the likely cause of the failure.
I guess, the test will fail with EINVAL with this patch,
https://patchwork.ozlabs.org/patch/897172/
it tries to avoid the check with ports so it won't be possible to pass the same addresses like the test does, it is currently in ML.
Quoted 7 lines
Hi Alexey,
Thanks for your explanation.
Before commit 40b4f0f, it also failed with EINVAL because of the same ipv6 addresses. Do you want to apply the first version of the test?
Hi Xiao,
Not sure, may be we could just use a raw socket on the client instead. And the easiest solution would be to return TCONF in this case. Any other ideas?
Thanks,
Alexey
PATCH 1/1 sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
Quoted 24 lines · Alexey Kodanev
Quoted 23 lines · Xiao Yang
Quoted 10 lines · Alexey Kodanev
Quoted 9 lines · Xiao Yang
If two ipv6 addresses have same family, a buggy kernel(e.g. RHEL6) lacked
the port check for them, and made this test get a failure with EINVAL:
-------------------------------------------------------------------------
safe_net.c:160: BROK: sctp_big_chunk.c:77:setsockopt(4, 132, 100, 0x7ffdbaac83a0, 91644)failed: EINVAL
-------------------------------------------------------------------------If you want to know detailed info for the bug, please see the following commit:
'40b4f0f (sctp: lack the check for ports insctp_v6_cmp_addr)'Quoted 8 lines
Quoted 1 line
We just want to hint users about the likely cause of the failure.
I guess, the test will fail with EINVAL with this patch,
https://patchwork.ozlabs.org/patch/897172/
it tries to avoid the check with ports so it won't be possible to pass the same addresses like the test does, it is currently in ML.
Hi Alexey,
Thanks for your explanation.
Quoted 8 lines
Quoted 3 lines
Before commit 40b4f0f, it also failed with EINVAL because of the same ipv6 addresses. Do you want to apply the first version of the test?
Hi Xiao,
Not sure, may be we could just use a raw socket on the client instead. And the easiest solution would be to return TCONF in this case. Any other ideas?
Hi Alexey,
I tried to use a raw socket on the client, but failed to bind the same ipv6 addresses.
I am not familiar with SOCK_RAW, so could you tell me detailed steps to use it.
Beside, can we add different ipv6 addresses by modifying this existed test?
Thanks,
Xiao Yang
Quoted 5 lines
Thanks,
Alexey