diff options
author | Michael Biebl <biebl@debian.org> | 2018-03-06 20:13:05 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2018-03-06 20:13:05 +0100 |
commit | 98393f852f2f66a74f7370aa63c07b26d610343c (patch) | |
tree | 627d6c5463c0e6ac9f4f6243a9c9274acdae197d /src/test/test-socket-util.c | |
parent | 1d42b86df9052528a8f56b2f52d8bc2faf87b2da (diff) | |
download | systemd-98393f852f2f66a74f7370aa63c07b26d610343c.tar.gz |
New upstream version 238
Diffstat (limited to 'src/test/test-socket-util.c')
-rw-r--r-- | src/test/test-socket-util.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index d1ab7486ed..e35a27fa61 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -360,58 +360,6 @@ static void test_in_addr_ifindex_from_string_auto(void) { assert_se(in_addr_ifindex_from_string_auto("fe80::19%thisinterfacecantexist", &family, &ua, &ifindex) == -ENODEV); } -static void *connect_thread(void *arg) { - union sockaddr_union *sa = arg; - _cleanup_close_ int fd = -1; - - fd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); - assert_se(fd >= 0); - - assert_se(connect(fd, &sa->sa, sizeof(sa->in)) == 0); - - return NULL; -} - -static void test_nameinfo_pretty(void) { - _cleanup_free_ char *stdin_name = NULL, *localhost = NULL; - - union sockaddr_union s = { - .in.sin_family = AF_INET, - .in.sin_port = 0, - .in.sin_addr.s_addr = htobe32(INADDR_ANY), - }; - int r; - - union sockaddr_union c = {}; - socklen_t slen = sizeof(c.in), clen = sizeof(c.in); - - _cleanup_close_ int sfd = -1, cfd = -1; - r = getnameinfo_pretty(STDIN_FILENO, &stdin_name); - log_info_errno(r, "No connection remote: %m"); - - assert_se(r < 0); - - sfd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0); - assert_se(sfd >= 0); - - assert_se(bind(sfd, &s.sa, sizeof(s.in)) == 0); - - /* find out the port number */ - assert_se(getsockname(sfd, &s.sa, &slen) == 0); - - assert_se(listen(sfd, 1) == 0); - - assert_se(asynchronous_job(connect_thread, &s) == 0); - - log_debug("Accepting new connection on fd:%d", sfd); - cfd = accept4(sfd, &c.sa, &clen, SOCK_CLOEXEC); - assert_se(cfd >= 0); - - r = getnameinfo_pretty(cfd, &localhost); - log_info("Connection from %s", localhost); - assert_se(r == 0); -} - static void test_sockaddr_equal(void) { union sockaddr_union a = { .in.sin_family = AF_INET, @@ -561,8 +509,6 @@ int main(int argc, char *argv[]) { test_in_addr_ifindex_to_string(); test_in_addr_ifindex_from_string_auto(); - test_nameinfo_pretty(); - test_sockaddr_equal(); test_sockaddr_un_len(); |