Commit f40742c2 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by Jakub Kicinski

selftest: tcp: Add more bind() calls.

In addtition to the two addresses defined in the fixtures, this patch
add 6 more bind calls():

  * 0.0.0.0
  * 127.0.0.1
  * ::
  * ::1
  * ::ffff:0.0.0.0
  * ::ffff:127.0.0.1

The first two per-fixture bind() calls control how inet_bind2_bucket
is created, and the rest 6 bind() calls cover as many conflicting
patterns as possible.
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240326204251.51301-7-kuniyu@amazon.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5e9e9afd
...@@ -25,21 +25,34 @@ static const struct in6_addr in6addr_v4mapped_loopback = { ...@@ -25,21 +25,34 @@ static const struct in6_addr in6addr_v4mapped_loopback = {
} }
}; };
#define NR_SOCKETS 8
FIXTURE(bind_wildcard) FIXTURE(bind_wildcard)
{ {
socklen_t addrlen[2]; int fd[NR_SOCKETS];
socklen_t addrlen[NR_SOCKETS];
union { union {
struct sockaddr addr; struct sockaddr addr;
struct sockaddr_in addr4; struct sockaddr_in addr4;
struct sockaddr_in6 addr6; struct sockaddr_in6 addr6;
} addr[2]; } addr[NR_SOCKETS];
}; };
FIXTURE_VARIANT(bind_wildcard) FIXTURE_VARIANT(bind_wildcard)
{ {
sa_family_t family[2]; sa_family_t family[2];
const void *addr[2]; const void *addr[2];
int expected_errno;
/* 6 bind() calls below follow two bind() for the defined 2 addresses:
*
* 0.0.0.0
* 127.0.0.1
* ::
* ::1
* ::ffff:0.0.0.0
* ::ffff:127.0.0.1
*/
int expected_errno[NR_SOCKETS];
}; };
/* (IPv4, IPv4) */ /* (IPv4, IPv4) */
...@@ -47,14 +60,20 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v4_local) ...@@ -47,14 +60,20 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v4_local)
{ {
.family = {AF_INET, AF_INET}, .family = {AF_INET, AF_INET},
.addr = {&in4addr_any, &in4addr_loopback}, .addr = {&in4addr_any, &in4addr_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v4_any) FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v4_any)
{ {
.family = {AF_INET, AF_INET}, .family = {AF_INET, AF_INET},
.addr = {&in4addr_loopback, &in4addr_any}, .addr = {&in4addr_loopback, &in4addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
/* (IPv4, IPv6) */ /* (IPv4, IPv6) */
...@@ -62,56 +81,80 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_any) ...@@ -62,56 +81,80 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_any)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_any, &in6addr_any}, .addr = {&in4addr_any, &in6addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_local) FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_local)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_any, &in6addr_loopback}, .addr = {&in4addr_any, &in6addr_loopback},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_v4mapped_any) FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_v4mapped_any)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_any, &in6addr_v4mapped_any}, .addr = {&in4addr_any, &in6addr_v4mapped_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_v4mapped_local) FIXTURE_VARIANT_ADD(bind_wildcard, v4_any_v6_v4mapped_local)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_any, &in6addr_v4mapped_loopback}, .addr = {&in4addr_any, &in6addr_v4mapped_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_any) FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_any)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_loopback, &in6addr_any}, .addr = {&in4addr_loopback, &in6addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_local) FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_local)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_loopback, &in6addr_loopback}, .addr = {&in4addr_loopback, &in6addr_loopback},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_v4mapped_any) FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_v4mapped_any)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_loopback, &in6addr_v4mapped_any}, .addr = {&in4addr_loopback, &in6addr_v4mapped_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_v4mapped_local) FIXTURE_VARIANT_ADD(bind_wildcard, v4_local_v6_v4mapped_local)
{ {
.family = {AF_INET, AF_INET6}, .family = {AF_INET, AF_INET6},
.addr = {&in4addr_loopback, &in6addr_v4mapped_loopback}, .addr = {&in4addr_loopback, &in6addr_v4mapped_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
/* (IPv6, IPv4) */ /* (IPv6, IPv4) */
...@@ -119,56 +162,80 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v4_any) ...@@ -119,56 +162,80 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v4_any)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_any, &in4addr_any}, .addr = {&in6addr_any, &in4addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v4_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v4_local)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_any, &in4addr_loopback}, .addr = {&in6addr_any, &in4addr_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v4_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v4_any)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_loopback, &in4addr_any}, .addr = {&in6addr_loopback, &in4addr_any},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v4_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v4_local)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_loopback, &in4addr_loopback}, .addr = {&in6addr_loopback, &in4addr_loopback},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v4_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v4_any)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_v4mapped_any, &in4addr_any}, .addr = {&in6addr_v4mapped_any, &in4addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v4_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v4_local)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_v4mapped_any, &in4addr_loopback}, .addr = {&in6addr_v4mapped_any, &in4addr_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_local_v4_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_local_v4_any)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_v4mapped_loopback, &in4addr_any}, .addr = {&in6addr_v4mapped_loopback, &in4addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_local_v4_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_local_v4_local)
{ {
.family = {AF_INET6, AF_INET}, .family = {AF_INET6, AF_INET},
.addr = {&in6addr_v4mapped_loopback, &in4addr_loopback}, .addr = {&in6addr_v4mapped_loopback, &in4addr_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
/* (IPv6, IPv6) */ /* (IPv6, IPv6) */
...@@ -176,84 +243,120 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_local) ...@@ -176,84 +243,120 @@ FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_local)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_any, &in6addr_loopback}, .addr = {&in6addr_any, &in6addr_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_v4mapped_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_v4mapped_any)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_any, &in6addr_v4mapped_any}, .addr = {&in6addr_any, &in6addr_v4mapped_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_v4mapped_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_any_v6_v4mapped_local)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_any, &in6addr_v4mapped_loopback}, .addr = {&in6addr_any, &in6addr_v4mapped_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_any)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_loopback, &in6addr_any}, .addr = {&in6addr_loopback, &in6addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_v4mapped_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_v4mapped_any)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_loopback, &in6addr_v4mapped_any}, .addr = {&in6addr_loopback, &in6addr_v4mapped_any},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_v4mapped_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_local_v6_v4mapped_local)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_loopback, &in6addr_v4mapped_loopback}, .addr = {&in6addr_loopback, &in6addr_v4mapped_loopback},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_any)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_any, &in6addr_any}, .addr = {&in6addr_v4mapped_any, &in6addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_local)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_any, &in6addr_loopback}, .addr = {&in6addr_v4mapped_any, &in6addr_loopback},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_v4mapped_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_any_v6_v4mapped_local)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_any, &in6addr_v4mapped_loopback}, .addr = {&in6addr_v4mapped_any, &in6addr_v4mapped_loopback},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_any)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_loopback, &in6addr_any}, .addr = {&in6addr_v4mapped_loopback, &in6addr_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_local) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_local)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_loopback, &in6addr_loopback}, .addr = {&in6addr_v4mapped_loopback, &in6addr_loopback},
.expected_errno = 0, .expected_errno = {0, 0,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, EADDRINUSE},
}; };
FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_v4mapped_any) FIXTURE_VARIANT_ADD(bind_wildcard, v6_v4mapped_loopback_v6_v4mapped_any)
{ {
.family = {AF_INET6, AF_INET6}, .family = {AF_INET6, AF_INET6},
.addr = {&in6addr_v4mapped_loopback, &in6addr_v4mapped_any}, .addr = {&in6addr_v4mapped_loopback, &in6addr_v4mapped_any},
.expected_errno = EADDRINUSE, .expected_errno = {0, EADDRINUSE,
EADDRINUSE, EADDRINUSE,
EADDRINUSE, 0,
EADDRINUSE, EADDRINUSE},
}; };
static void setup_addr(FIXTURE_DATA(bind_wildcard) *self, int i, static void setup_addr(FIXTURE_DATA(bind_wildcard) *self, int i,
...@@ -284,52 +387,56 @@ FIXTURE_SETUP(bind_wildcard) ...@@ -284,52 +387,56 @@ FIXTURE_SETUP(bind_wildcard)
{ {
setup_addr(self, 0, variant->family[0], variant->addr[0]); setup_addr(self, 0, variant->family[0], variant->addr[0]);
setup_addr(self, 1, variant->family[1], variant->addr[1]); setup_addr(self, 1, variant->family[1], variant->addr[1]);
setup_addr(self, 2, AF_INET, &in4addr_any);
setup_addr(self, 3, AF_INET, &in4addr_loopback);
setup_addr(self, 4, AF_INET6, &in6addr_any);
setup_addr(self, 5, AF_INET6, &in6addr_loopback);
setup_addr(self, 6, AF_INET6, &in6addr_v4mapped_any);
setup_addr(self, 7, AF_INET6, &in6addr_v4mapped_loopback);
} }
FIXTURE_TEARDOWN(bind_wildcard) FIXTURE_TEARDOWN(bind_wildcard)
{ {
int i;
for (i = 0; i < NR_SOCKETS; i++)
close(self->fd[i]);
} }
void bind_sockets(struct __test_metadata *_metadata, void bind_socket(struct __test_metadata *_metadata,
FIXTURE_DATA(bind_wildcard) *self, FIXTURE_DATA(bind_wildcard) *self,
int expected_errno, const FIXTURE_VARIANT(bind_wildcard) *variant,
struct sockaddr *addr1, socklen_t addrlen1, int i)
struct sockaddr *addr2, socklen_t addrlen2)
{ {
int fd[2];
int ret; int ret;
fd[0] = socket(addr1->sa_family, SOCK_STREAM, 0); self->fd[i] = socket(self->addr[i].addr.sa_family, SOCK_STREAM, 0);
ASSERT_GT(fd[0], 0); ASSERT_GT(self->fd[i], 0);
ret = bind(fd[0], addr1, addrlen1);
ASSERT_EQ(ret, 0);
ret = getsockname(fd[0], addr1, &addrlen1); self->addr[i].addr4.sin_port = self->addr[0].addr4.sin_port;
ASSERT_EQ(ret, 0);
((struct sockaddr_in *)addr2)->sin_port = ((struct sockaddr_in *)addr1)->sin_port; ret = bind(self->fd[i], &self->addr[i].addr, self->addrlen[i]);
if (variant->expected_errno[i]) {
fd[1] = socket(addr2->sa_family, SOCK_STREAM, 0);
ASSERT_GT(fd[1], 0);
ret = bind(fd[1], addr2, addrlen2);
if (expected_errno) {
ASSERT_EQ(ret, -1); ASSERT_EQ(ret, -1);
ASSERT_EQ(errno, expected_errno); ASSERT_EQ(errno, variant->expected_errno[i]);
} else { } else {
ASSERT_EQ(ret, 0); ASSERT_EQ(ret, 0);
} }
close(fd[1]); if (i == 0) {
close(fd[0]); ret = getsockname(self->fd[0], &self->addr[0].addr, &self->addrlen[0]);
ASSERT_EQ(ret, 0);
}
} }
TEST_F(bind_wildcard, plain) TEST_F(bind_wildcard, plain)
{ {
bind_sockets(_metadata, self, variant->expected_errno, int i;
&self->addr[0].addr, self->addrlen[0],
&self->addr[1].addr, self->addrlen[1]); for (i = 0; i < NR_SOCKETS; i++)
bind_socket(_metadata, self, variant, i);
} }
TEST_HARNESS_MAIN TEST_HARNESS_MAIN
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