public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
@ 2018-04-05 10:27 Xiao Yang
  2018-04-11 14:30 ` Alexey Kodanev
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2018-04-05 10:27 UTC (permalink / raw)
  To: ltp

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(-)

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)
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
  2018-04-05 10:27 [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL Xiao Yang
@ 2018-04-11 14:30 ` Alexey Kodanev
  2018-04-12  6:39   ` Xiao Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kodanev @ 2018-04-11 14:30 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
  2018-04-11 14:30 ` Alexey Kodanev
@ 2018-04-12  6:39   ` Xiao Yang
  2018-04-12 11:15     ` Alexey Kodanev
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2018-04-12  6:39 UTC (permalink / raw)
  To: ltp

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
>
>
>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
  2018-04-12  6:39   ` Xiao Yang
@ 2018-04-12 11:15     ` Alexey Kodanev
  2018-04-21  6:06       ` Xiao Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kodanev @ 2018-04-12 11:15 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL
  2018-04-12 11:15     ` Alexey Kodanev
@ 2018-04-21  6:06       ` Xiao Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Xiao Yang @ 2018-04-21  6:06 UTC (permalink / raw)
  To: ltp

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
>
>
>




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-21  6:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05 10:27 [LTP] [PATCH] sctp/sctp_big_chunk.c: Add a hint on failure with EINVAL Xiao Yang
2018-04-11 14:30 ` Alexey Kodanev
2018-04-12  6:39   ` Xiao Yang
2018-04-12 11:15     ` Alexey Kodanev
2018-04-21  6:06       ` Xiao Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox