diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-11-15 18:14:28 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2019-04-21 06:25:26 +0300 |
commit | c2a74d661dafcc9bbd0c1e7ab13489f9b55ef881 (patch) | |
tree | e6ced7ebfbb79a21fc3052744927b8029545bfc5 /test | |
parent | c03c8d2129df04a0574fc5567c0f079a1b912891 (diff) |
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: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/zdtm/static/socket-raw.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/zdtm/static/socket-raw.c b/test/zdtm/static/socket-raw.c index 355addb1c..9a359485d 100644 --- a/test/zdtm/static/socket-raw.c +++ b/test/zdtm/static/socket-raw.c @@ -154,6 +154,30 @@ static unsigned short csum(unsigned short *ptr, int nbytes) 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[]) { const char string_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -340,6 +364,8 @@ int main(int argc, char *argv[]) exit(1); } + raw_socks_storm(); + test_daemon(); test_waitsig(); |