Message ID | 1522924077-15028-1-git-send-email-yangx.jy@cn.fujitsu.com |
---|---|
State | Changes Requested |
Headers | show |
Series | sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL | expand |
On 05.04.2018 13:27, Xiao Yang wrote: > 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. 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
On 2018/04/11 22:30, Alexey Kodanev wrote: > On 05.04.2018 13:27, Xiao Yang wrote: >> 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. > 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 > 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 > > >
On 12.04.2018 09:39, Xiao Yang wrote: > On 2018/04/11 22:30, Alexey Kodanev wrote: >> On 05.04.2018 13:27, Xiao Yang wrote: >>> 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. >> 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? > 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
On 2018/04/12 19:15, Alexey Kodanev wrote: > On 12.04.2018 09:39, Xiao Yang wrote: >> On 2018/04/11 22:30, Alexey Kodanev wrote: >>> On 05.04.2018 13:27, Xiao Yang wrote: >>>> 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. >>> 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? >> > 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 > Thanks, > Alexey > > >
diff --git a/testcases/network/sctp/sctp_big_chunk.c b/testcases/network/sctp/sctp_big_chunk.c index 55a2969..7b314f4 100644 --- a/testcases/network/sctp/sctp_big_chunk.c +++ b/testcases/network/sctp/sctp_big_chunk.c @@ -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)
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. Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> --- testcases/network/sctp/sctp_big_chunk.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)