Commit c2a74d66 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

test: inet, raw -- Storm the test with all protos

Raw sockets may carry any protocol they want so
lets try them out.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent c03c8d21
...@@ -154,6 +154,30 @@ static unsigned short csum(unsigned short *ptr, int nbytes) ...@@ -154,6 +154,30 @@ static unsigned short csum(unsigned short *ptr, int nbytes)
return answer; return answer;
} }
/*
* Just create IPv6/IPv6 sockets with any protos
* to make sure criu won't BUG on unknown proto.
*/
static void raw_socks_storm(void)
{
int sk4[IPPROTO_MAX];
int sk6[IPPROTO_MAX];
size_t i;
for (i = 1; i < ARRAY_SIZE(sk4); i++) {
sk4[i] = socket(PF_INET, SOCK_RAW | SOCK_NONBLOCK, i);
if (sk4[i] >= 0)
test_msg("Created IPv4 proto %zd: %d\n", i, sk4[i]);
}
for (i = 1; i < ARRAY_SIZE(sk6); i++) {
sk6[i] = socket(PF_INET6, SOCK_RAW | SOCK_NONBLOCK, i);
if (sk6[i] >= 0)
test_msg("Created IPv6 proto %zd: %d\n", i, sk6[i]);
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const char string_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char string_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
...@@ -340,6 +364,8 @@ int main(int argc, char *argv[]) ...@@ -340,6 +364,8 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
raw_socks_storm();
test_daemon(); test_daemon();
test_waitsig(); test_waitsig();
......
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