Commit 5e9e9afd authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by Jakub Kicinski

selftest: tcp: Add v4-v4 and v6-v6 bind() conflict tests.

We don't have bind() conflict tests for the same protocol pairs.

Let's add them except for the same address pair, which will be
covered by the following patch adding 6 more bind() calls for
each test case.
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240326204251.51301-6-kuniyu@amazon.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6f9bc755
......@@ -42,6 +42,21 @@ FIXTURE_VARIANT(bind_wildcard)
int expected_errno;
};
/* (IPv4, IPv4) */
FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v4_local)
{
.family = {AF_INET, AF_INET},
.addr = {&in4addr_any, &in4addr_loopback},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v4_any)
{
.family = {AF_INET, AF_INET},
.addr = {&in4addr_loopback, &in4addr_any},
.expected_errno = EADDRINUSE,
};
/* (IPv4, IPv6) */
FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_any)
{
......@@ -156,6 +171,91 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_local_v4_local)
.expected_errno = EADDRINUSE,
};
/* (IPv6, IPv6) */
FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_local)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_any, &in6addr_loopback},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_v4mapped_any)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_any, &in6addr_v4mapped_any},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_v4mapped_local)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_any, &in6addr_v4mapped_loopback},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_any)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_loopback, &in6addr_any},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_v4mapped_any)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_loopback, &in6addr_v4mapped_any},
.expected_errno = 0,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_v4mapped_local)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_loopback, &in6addr_v4mapped_loopback},
.expected_errno = 0,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_any)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_any, &in6addr_any},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_local)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_any, &in6addr_loopback},
.expected_errno = 0,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_v4mapped_local)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_any, &in6addr_v4mapped_loopback},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_any)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_loopback, &in6addr_any},
.expected_errno = EADDRINUSE,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_local)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_loopback, &in6addr_loopback},
.expected_errno = 0,
};
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_v4mapped_any)
{
.family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_loopback, &in6addr_v4mapped_any},
.expected_errno = EADDRINUSE,
};
static void setup_addr(FIXTURE_DATA(bind_wildcard) *self, int i,
int family, const void *addr_const)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment