socket_wrapper.git
10 years agoBump version to 1.0.1. socket_wrapper-1.0.1
Andreas Schneider [Tue, 4 Feb 2014 11:01:39 +0000 (12:01 +0100)]
Bump version to 1.0.1.

10 years agocmake: Add socket_wrapper-config.cmake.
Andreas Schneider [Tue, 4 Feb 2014 11:01:25 +0000 (12:01 +0100)]
cmake: Add socket_wrapper-config.cmake.

10 years agocmake: Use SOCKET_WRAPPER_LOCATION.
Andreas Schneider [Tue, 4 Feb 2014 11:43:12 +0000 (12:43 +0100)]
cmake: Use SOCKET_WRAPPER_LOCATION.

10 years agocmake: Add --libs output for pkg-config.
Andreas Schneider [Tue, 4 Feb 2014 10:56:33 +0000 (11:56 +0100)]
cmake: Add --libs output for pkg-config.

10 years agocpack: Don't package the obj directory.
Andreas Schneider [Tue, 4 Feb 2014 11:03:53 +0000 (12:03 +0100)]
cpack: Don't package the obj directory.

10 years agosrc: Add a public socket_wrapper_enabled() function. socket_wrapper-1.0.0
Andreas Schneider [Fri, 31 Jan 2014 15:59:36 +0000 (16:59 +0100)]
src: Add a public socket_wrapper_enabled() function.

Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosrc: Fix va arg passing in open().
Andreas Schneider [Wed, 29 Jan 2014 07:41:15 +0000 (08:41 +0100)]
src: Fix va arg passing in open().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Handle stale fds in dup() and dup2().
Andreas Schneider [Tue, 28 Jan 2014 13:10:53 +0000 (14:10 +0100)]
src: Handle stale fds in dup() and dup2().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Add timerfd_create() to handle stale fds.
Andreas Schneider [Tue, 28 Jan 2014 12:48:52 +0000 (13:48 +0100)]
src: Add timerfd_create() to handle stale fds.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Add eventfd() to handle stale fds.
Andreas Schneider [Tue, 28 Jan 2014 12:42:38 +0000 (13:42 +0100)]
src: Add eventfd() to handle stale fds.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Add signalfd() to handle stale fds.
Andreas Schneider [Tue, 28 Jan 2014 12:33:23 +0000 (13:33 +0100)]
src: Add signalfd() to handle stale fds.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Add socketpair() to handle stale fds.
Andreas Schneider [Tue, 28 Jan 2014 12:20:20 +0000 (13:20 +0100)]
src: Add socketpair() to handle stale fds.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Add pipe() to handle stale fds.
Andreas Schneider [Tue, 28 Jan 2014 12:15:34 +0000 (13:15 +0100)]
src: Add pipe() to handle stale fds.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Check for stale fds in swrap_accept().
Andreas Schneider [Tue, 28 Jan 2014 12:10:01 +0000 (13:10 +0100)]
src: Check for stale fds in swrap_accept().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Check for stale fds in swrap_socket().
Andreas Schneider [Tue, 28 Jan 2014 09:33:36 +0000 (10:33 +0100)]
src: Check for stale fds in swrap_socket().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Handle stale fds in swrap_recvmsg_after().
Andreas Schneider [Tue, 28 Jan 2014 10:34:03 +0000 (11:34 +0100)]
src: Handle stale fds in swrap_recvmsg_after().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Handle stale fds in swrap_sendmsg_after().
Andreas Schneider [Tue, 28 Jan 2014 10:30:20 +0000 (11:30 +0100)]
src: Handle stale fds in swrap_sendmsg_after().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Try to recover when reading from a fd returns ENOTSOCK.
Nalin Dahyabhai [Tue, 28 Jan 2014 10:25:40 +0000 (11:25 +0100)]
src: Try to recover when reading from a fd returns ENOTSOCK.

When attempting to read from a descriptor, if an underlying
autobind fails because it's not a socket, stop intercepting uses of that
descriptor.

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Try to recover when writing to fd returns ENOTSOCK.
Nalin Dahyabhai [Tue, 28 Jan 2014 10:24:27 +0000 (11:24 +0100)]
src: Try to recover when writing to fd returns ENOTSOCK.

When attempting to write to a descriptor, if an underlying autobind
fails because it's not a socket, stop intercepting uses of that
descriptor.

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Try to recover when sockets are closed elsewhere.
Nalin Dahyabhai [Tue, 28 Jan 2014 10:22:26 +0000 (11:22 +0100)]
src: Try to recover when sockets are closed elsewhere.

There are methods for closing descriptors (libc-internal code paths,
direct syscalls) which close descriptors in ways that we
can't intercept, so try to recover when we notice that that's happened:
  * If we see a descriptor being handed back from open() that we thought
    was a socket, stop intercepting uses of that descriptor.

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agosrc: Use swrap_recvmsg_(before|after) for swrap_readv().
Andreas Schneider [Tue, 28 Jan 2014 09:06:18 +0000 (10:06 +0100)]
src: Use swrap_recvmsg_(before|after) for swrap_readv().

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoUpdate TODO.
Andreas Schneider [Tue, 28 Jan 2014 09:14:08 +0000 (10:14 +0100)]
Update TODO.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoUpdate ChangeLog.
Andreas Schneider [Tue, 28 Jan 2014 09:14:17 +0000 (10:14 +0100)]
Update ChangeLog.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoUpdate TODO.
Andreas Schneider [Fri, 24 Jan 2014 09:39:57 +0000 (10:39 +0100)]
Update TODO.

10 years agosrc: Fix warnings on Solaris.
Andreas Schneider [Tue, 21 Jan 2014 12:01:39 +0000 (13:01 +0100)]
src: Fix warnings on Solaris.

10 years agosrc: Initialize sockaddr_un.
Andreas Schneider [Tue, 21 Jan 2014 11:24:54 +0000 (12:24 +0100)]
src: Initialize sockaddr_un.

Fixes a valgrind warning.

10 years agosrc: Make sure the memory is zeroed.
Andreas Schneider [Tue, 21 Jan 2014 11:17:42 +0000 (12:17 +0100)]
src: Make sure the memory is zeroed.

10 years agosrc: Case pid_t to an int in SWRAP_LOG.
Andreas Schneider [Tue, 21 Jan 2014 08:57:47 +0000 (09:57 +0100)]
src: Case pid_t to an int in SWRAP_LOG.

10 years agocmake: Only build test_sendmsg_recvmsg_fd if we have msg_control.
Andreas Schneider [Tue, 21 Jan 2014 08:52:06 +0000 (09:52 +0100)]
cmake: Only build test_sendmsg_recvmsg_fd if we have msg_control.

10 years agosrc: Fix setting the temp iovec.
Andreas Schneider [Tue, 21 Jan 2014 08:45:05 +0000 (09:45 +0100)]
src: Fix setting the temp iovec.

10 years agosrc: Fix build on Solaris.
Andreas Schneider [Tue, 21 Jan 2014 08:34:55 +0000 (09:34 +0100)]
src: Fix build on Solaris.

10 years agocmake: Check for HAVE_STRUCT_MSGHDR_MSG_CONTROL.
Andreas Schneider [Tue, 21 Jan 2014 08:27:03 +0000 (09:27 +0100)]
cmake: Check for HAVE_STRUCT_MSGHDR_MSG_CONTROL.

10 years agocmake: Fix HAVE_STRUCT_SOCKADDR_SA_LEN detection.
Andreas Schneider [Tue, 21 Jan 2014 08:26:44 +0000 (09:26 +0100)]
cmake: Fix HAVE_STRUCT_SOCKADDR_SA_LEN detection.

10 years agosrc: Fix build warnings on FreeBSD.
Andreas Schneider [Tue, 21 Jan 2014 08:17:01 +0000 (09:17 +0100)]
src: Fix build warnings on FreeBSD.

10 years agocmake: Add cmake config version script.
Andreas Schneider [Mon, 20 Jan 2014 22:34:54 +0000 (23:34 +0100)]
cmake: Add cmake config version script.

10 years agocmake: Add pkg-config file.
Andreas Schneider [Mon, 20 Jan 2014 22:33:18 +0000 (23:33 +0100)]
cmake: Add pkg-config file.

10 years agoImprove the README.
Andreas Schneider [Mon, 20 Jan 2014 22:31:10 +0000 (23:31 +0100)]
Improve the README.

10 years agotests: Add sendmsg_recvmsg_fd test.
Jakub Hrozek [Mon, 20 Jan 2014 12:45:58 +0000 (13:45 +0100)]
tests: Add sendmsg_recvmsg_fd test.

10 years agotests: Add test_echo_udp_sendmsg_recvmsg.
Andreas Schneider [Mon, 20 Jan 2014 17:36:47 +0000 (18:36 +0100)]
tests: Add test_echo_udp_sendmsg_recvmsg.

10 years agoswrap: Implement recvmsg().
Andreas Schneider [Wed, 15 Jan 2014 15:55:20 +0000 (16:55 +0100)]
swrap: Implement recvmsg().

10 years agoswrap: Fix DGRAM in swrap_recvmsg(before|after).
Andreas Schneider [Tue, 24 Dec 2013 12:06:40 +0000 (13:06 +0100)]
swrap: Fix DGRAM in swrap_recvmsg(before|after).

10 years agoswrap: Use swrap_recvmsg_* in swrap_read().
Stefan Metzmacher [Tue, 24 Dec 2013 10:37:29 +0000 (11:37 +0100)]
swrap: Use swrap_recvmsg_* in swrap_read().

10 years agoswrap: Use swrap_recvmsg_* in swrap_recv().
Stefan Metzmacher [Tue, 24 Dec 2013 10:35:16 +0000 (11:35 +0100)]
swrap: Use swrap_recvmsg_* in swrap_recv().

10 years agoswrap: Use swrap_recvmsg_* in swrap_recvfrom().
Stefan Metzmacher [Tue, 24 Dec 2013 10:31:50 +0000 (11:31 +0100)]
swrap: Use swrap_recvmsg_* in swrap_recvfrom().

10 years agoswrap: Add swrap_recvmsg_after().
Stefan Metzmacher [Tue, 24 Dec 2013 10:28:29 +0000 (11:28 +0100)]
swrap: Add swrap_recvmsg_after().

10 years agoswrap: Add swrap_recvmsg_before().
Stefan Metzmacher [Tue, 24 Dec 2013 10:28:13 +0000 (11:28 +0100)]
swrap: Add swrap_recvmsg_before().

10 years agoecho_srv: Add fd duplication and test it works.
Andreas Schneider [Tue, 24 Dec 2013 10:02:27 +0000 (11:02 +0100)]
echo_srv: Add fd duplication and test it works.

10 years agotest: Fix getsockopt on Solaris.
Andreas Schneider [Mon, 23 Dec 2013 14:23:21 +0000 (15:23 +0100)]
test: Fix getsockopt on Solaris.

10 years agotests: Fix getsockopt() on Solaris.
Andreas Schneider [Mon, 23 Dec 2013 14:03:26 +0000 (15:03 +0100)]
tests: Fix getsockopt() on Solaris.

10 years agotests: writev/readv must have iovec > 0
Jakub Hrozek [Mon, 23 Dec 2013 14:37:06 +0000 (15:37 +0100)]
tests: writev/readv must have iovec > 0

writev/readv with iovec == 0 works on Linux, but that is not portable.

10 years agotests: Remove unused variable warning
Jakub Hrozek [Mon, 23 Dec 2013 13:57:14 +0000 (14:57 +0100)]
tests: Remove unused variable warning

The variables were unused if SIOCGPGRP wasn't defined.

10 years agotorture: Add TORTURE_SKIP_CLEANUP to not delete socket_dir.
Andreas Schneider [Mon, 23 Dec 2013 11:17:46 +0000 (12:17 +0100)]
torture: Add TORTURE_SKIP_CLEANUP to not delete socket_dir.

10 years agotorture: Generate network traces for each test.
Andreas Schneider [Mon, 23 Dec 2013 11:17:02 +0000 (12:17 +0100)]
torture: Generate network traces for each test.

10 years agotests: Add test_echo_tcp_socket_options().
Andreas Schneider [Mon, 23 Dec 2013 10:58:19 +0000 (11:58 +0100)]
tests: Add test_echo_tcp_socket_options().

10 years agotests: Add test_echo_tcp_connect test.
Andreas Schneider [Mon, 23 Dec 2013 09:59:59 +0000 (10:59 +0100)]
tests: Add test_echo_tcp_connect test.

This tests some corner cases we fixed in the past.

10 years agotests: Add missing include for writev/readv.
Andreas Schneider [Sat, 21 Dec 2013 15:18:45 +0000 (16:18 +0100)]
tests: Add missing include for writev/readv.

10 years agotests: Add an ifdef around static IPv6 only functions
Jakub Hrozek [Fri, 20 Dec 2013 15:53:59 +0000 (16:53 +0100)]
tests: Add an ifdef around static IPv6 only functions

This would prevent an uninitialized function warning in case IPv6 was not
available.

10 years agotests: Add test_echo_tcp_write_readv
Jakub Hrozek [Fri, 20 Dec 2013 15:50:42 +0000 (16:50 +0100)]
tests: Add test_echo_tcp_write_readv

10 years agotests: Use torture_server_(address|port).
Andreas Schneider [Fri, 20 Dec 2013 16:09:56 +0000 (17:09 +0100)]
tests: Use torture_server_(address|port).

This makes it possible to run tests without socket_wrapper.

10 years agotorture: Add torture_server_port().
Andreas Schneider [Fri, 20 Dec 2013 15:53:32 +0000 (16:53 +0100)]
torture: Add torture_server_port().

10 years agotorture: Add torture_server_address().
Andreas Schneider [Fri, 20 Dec 2013 15:37:59 +0000 (16:37 +0100)]
torture: Add torture_server_address().

This should make it easier to run the test without socket_wrapper.

10 years agotorture: Let the echo server listen on anyaddr.
Andreas Schneider [Fri, 20 Dec 2013 15:31:00 +0000 (16:31 +0100)]
torture: Let the echo server listen on anyaddr.

10 years agoswrap: Fix loading of system libraries.
Andreas Schneider [Fri, 20 Dec 2013 12:38:19 +0000 (13:38 +0100)]
swrap: Fix loading of system libraries.

10 years agoecho_srv: Add missing includes.
Andreas Schneider [Fri, 20 Dec 2013 09:54:20 +0000 (10:54 +0100)]
echo_srv: Add missing includes.

This should fix the build on FreeBSD.

10 years agotorture: Set different default interface for client and server.
Andreas Schneider [Thu, 19 Dec 2013 14:34:10 +0000 (15:34 +0100)]
torture: Set different default interface for client and server.

10 years agoswrap: Add documentation for SOCK_CLOEXEC in socket().
Andreas Schneider [Thu, 19 Dec 2013 13:29:52 +0000 (14:29 +0100)]
swrap: Add documentation for SOCK_CLOEXEC in socket().

10 years agotests: Add test_echo_tcp_write_read.
Andreas Schneider [Tue, 17 Dec 2013 13:48:38 +0000 (14:48 +0100)]
tests: Add test_echo_tcp_write_read.

10 years agotorture: Add tcp function to setup echo server.
Andreas Schneider [Tue, 17 Dec 2013 13:44:54 +0000 (14:44 +0100)]
torture: Add tcp function to setup echo server.

10 years agotorture: Pass socket type to torture_setup_echo_srv_ip().
Andreas Schneider [Tue, 17 Dec 2013 13:44:08 +0000 (14:44 +0100)]
torture: Pass socket type to torture_setup_echo_srv_ip().

10 years agotorture: Add torture_generate_random_buffer().
Andreas Schneider [Fri, 13 Dec 2013 13:49:13 +0000 (14:49 +0100)]
torture: Add torture_generate_random_buffer().

10 years agotests: Add test_echo_udp_send_recv test.
Andreas Schneider [Fri, 13 Dec 2013 13:22:55 +0000 (14:22 +0100)]
tests: Add test_echo_udp_send_recv test.

10 years agotests: Use inet_pton() instead of inet_aton().
Andreas Schneider [Fri, 13 Dec 2013 13:22:24 +0000 (14:22 +0100)]
tests: Use inet_pton() instead of inet_aton().

10 years agotests: Rename testsuite to test_ioctl.
Andreas Schneider [Thu, 12 Dec 2013 20:26:15 +0000 (21:26 +0100)]
tests: Rename testsuite to test_ioctl.

10 years agotests: Remove unused code.
Andreas Schneider [Thu, 12 Dec 2013 20:25:01 +0000 (21:25 +0100)]
tests: Remove unused code.

10 years agotests: Remove FIONBIO cause it doesn't work on x86.
Andreas Schneider [Thu, 12 Dec 2013 20:24:07 +0000 (21:24 +0100)]
tests: Remove FIONBIO cause it doesn't work on x86.

10 years agoecho_srv: Fix a build warning.
Andreas Schneider [Thu, 12 Dec 2013 08:07:54 +0000 (09:07 +0100)]
echo_srv: Fix a build warning.

10 years agoswrap: Don't build with swrap_str_lib() if NDEBUG is defined.
Andreas Schneider [Thu, 12 Dec 2013 08:05:55 +0000 (09:05 +0100)]
swrap: Don't build with swrap_str_lib() if NDEBUG is defined.

This fixes a compile warning on optimized builds.

10 years agocmake: Fix linking echo_srv on Solaris.
Andreas Schneider [Thu, 12 Dec 2013 07:50:43 +0000 (08:50 +0100)]
cmake: Fix linking echo_srv on Solaris.

10 years agocmake: Increase required cmake version number.
Andreas Schneider [Wed, 11 Dec 2013 18:50:59 +0000 (19:50 +0100)]
cmake: Increase required cmake version number.

We need CheckPrototypeDefinition.

10 years agoFix formatting of variables of type pid_t
Jakub Hrozek [Wed, 11 Dec 2013 14:03:32 +0000 (15:03 +0100)]
Fix formatting of variables of type pid_t

10 years agotests: use discard_const to get rid of a warning on Solaris
Jakub Hrozek [Wed, 11 Dec 2013 13:17:02 +0000 (14:17 +0100)]
tests: use discard_const to get rid of a warning on Solaris

10 years agologging: log creating the sockets
Jakub Hrozek [Tue, 10 Dec 2013 15:13:20 +0000 (16:13 +0100)]
logging: log creating the sockets

10 years agologging: Add logging when loading system functions
Jakub Hrozek [Tue, 10 Dec 2013 14:44:27 +0000 (15:44 +0100)]
logging: Add logging when loading system functions

Also fix some whitespace errors

10 years agocmake: Detect attribute format
Jakub Hrozek [Tue, 10 Dec 2013 14:29:13 +0000 (15:29 +0100)]
cmake: Detect attribute format

10 years agotests: Also check recvfrom() with NULL pointer.
Andreas Schneider [Wed, 11 Dec 2013 12:03:35 +0000 (13:03 +0100)]
tests: Also check recvfrom() with NULL pointer.

10 years agotests: Check the returned ip from recvfrom.
Andreas Schneider [Wed, 11 Dec 2013 11:56:21 +0000 (12:56 +0100)]
tests: Check the returned ip from recvfrom.

10 years agotests: Fix passing uninitialized values.
Andreas Schneider [Wed, 11 Dec 2013 11:03:47 +0000 (12:03 +0100)]
tests: Fix passing uninitialized values.

10 years agotests: Add test_sendto_recvfrom_ipv6().
Andreas Schneider [Tue, 10 Dec 2013 10:46:03 +0000 (11:46 +0100)]
tests: Add test_sendto_recvfrom_ipv6().

10 years agotorture: Add torture_setup_echo_srv_udp_ipv6().
Andreas Schneider [Tue, 10 Dec 2013 10:38:08 +0000 (11:38 +0100)]
torture: Add torture_setup_echo_srv_udp_ipv6().

10 years agotorture_teardown_echo_srv
Andreas Schneider [Tue, 10 Dec 2013 10:37:44 +0000 (11:37 +0100)]
torture_teardown_echo_srv

10 years agotests: Use torture helpers in test_echo_udp_sendto_recvfrom.
Andreas Schneider [Tue, 10 Dec 2013 10:19:34 +0000 (11:19 +0100)]
tests: Use torture helpers in test_echo_udp_sendto_recvfrom.

10 years agotests: Add teardown functions to torture lib.
Andreas Schneider [Tue, 10 Dec 2013 10:14:04 +0000 (11:14 +0100)]
tests: Add teardown functions to torture lib.

10 years agotests: Add a torture library with helpers.
Andreas Schneider [Tue, 10 Dec 2013 10:03:12 +0000 (11:03 +0100)]
tests: Add a torture library with helpers.

10 years agotests: Fix the help output of the echo server
Jakub Hrozek [Tue, 10 Dec 2013 09:57:24 +0000 (10:57 +0100)]
tests: Fix the help output of the echo server

10 years agotests: Add test_echo_udp_sendto_recvfrom.
Andreas Schneider [Fri, 6 Dec 2013 11:03:24 +0000 (12:03 +0100)]
tests: Add test_echo_udp_sendto_recvfrom.

10 years agocmake: Remove swrap env variables.
Andreas Schneider [Fri, 6 Dec 2013 11:02:46 +0000 (12:02 +0100)]
cmake: Remove swrap env variables.

They should be set up in the test!

10 years agotests: Add a simple echo server
Jakub Hrozek [Thu, 5 Dec 2013 19:36:05 +0000 (20:36 +0100)]
tests: Add a simple echo server

10 years agoswrap: Remove obsolete init functions.
Andreas Schneider [Tue, 10 Dec 2013 07:21:12 +0000 (08:21 +0100)]
swrap: Remove obsolete init functions.

This fixes preloading libsocket_wrapper.so with gdb.

10 years agoswrap: Add libc_writev().
Andreas Schneider [Tue, 10 Dec 2013 07:16:53 +0000 (08:16 +0100)]
swrap: Add libc_writev().

10 years agoswrap: Add libc_socket().
Andreas Schneider [Tue, 10 Dec 2013 07:15:08 +0000 (08:15 +0100)]
swrap: Add libc_socket().