Hello community,

here is the log from the commit of package socket_wrapper for openSUSE:Factory 
checked in at 2015-09-09 20:21:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/socket_wrapper (Old)
 and      /work/SRC/openSUSE:Factory/.socket_wrapper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "socket_wrapper"

Changes:
--------
--- /work/SRC/openSUSE:Factory/socket_wrapper/socket_wrapper.changes    
2015-05-15 07:43:29.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.socket_wrapper.new/socket_wrapper.changes       
2015-09-09 20:21:32.000000000 +0200
@@ -1,0 +2,9 @@
+Wed Sep  2 11:53:38 UTC 2015 - [email protected]
+
+- Update to version 1.1.4
+  * Fixed handling of msg_name in recvmsg()
+  * Fixed sendmsg()/recvmsg() TCP support
+  * Fixed several compile warnings
+  * Added environment variable to change MTU
+
+-------------------------------------------------------------------

Old:
----
  socket_wrapper-1.1.3.tar.gz

New:
----
  socket_wrapper-1.1.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ socket_wrapper.spec ++++++
--- /var/tmp/diff_new_pack.ODzKqH/_old  2015-09-09 20:21:32.000000000 +0200
+++ /var/tmp/diff_new_pack.ODzKqH/_new  2015-09-09 20:21:32.000000000 +0200
@@ -15,6 +15,7 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 ############################# NOTE ##################################
 #
 # This is a special library. You are not able to link this library.
@@ -23,7 +24,7 @@
 ############################# NOTE ##################################
 
 Name:           socket_wrapper
-Version:        1.1.3
+Version:        1.1.4
 Release:        0
 Summary:        A library passing all socket communications trough Unix sockets
 License:        BSD-3-Clause
@@ -36,8 +37,8 @@
 BuildRequires:  pkg-config
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
-Requires:       pkg-config
 Requires:       cmake
+Requires:       pkg-config
 
 %description
 socket_wrapper aims to help client/server software development teams willing to

++++++ socket_wrapper-1.1.3.tar.gz -> socket_wrapper-1.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/CMakeLists.txt 
new/socket_wrapper-1.1.4/CMakeLists.txt
--- old/socket_wrapper-1.1.3/CMakeLists.txt     2015-02-23 16:51:18.000000000 
+0100
+++ new/socket_wrapper-1.1.4/CMakeLists.txt     2015-08-24 17:53:17.000000000 
+0200
@@ -8,7 +8,7 @@
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "1")
-set(APPLICATION_VERSION_PATCH "3")
+set(APPLICATION_VERSION_PATCH "4")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,7 +19,7 @@
 #     Increment AGE. Set REVISION to 0
 #   If the source code was changed, but there were no interface changes:
 #     Increment REVISION.
-set(LIBRARY_VERSION "0.1.3")
+set(LIBRARY_VERSION "0.1.4")
 set(LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is 
checked
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/CTestConfig.cmake 
new/socket_wrapper-1.1.4/CTestConfig.cmake
--- old/socket_wrapper-1.1.3/CTestConfig.cmake  2013-12-04 18:20:43.000000000 
+0100
+++ new/socket_wrapper-1.1.4/CTestConfig.cmake  2015-08-05 15:25:53.000000000 
+0200
@@ -3,7 +3,7 @@
 set(CTEST_PROJECT_NAME "socketwrapper")
 set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
 
-set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_METHOD "https")
 set(CTEST_DROP_SITE "mock.cryptomilk.org")
 set(CTEST_DROP_LOCATION "/submit.php?project=socketwrapper")
 set(CTEST_DROP_SITE_CDASH TRUE)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/ChangeLog 
new/socket_wrapper-1.1.4/ChangeLog
--- old/socket_wrapper-1.1.3/ChangeLog  2015-02-23 16:51:06.000000000 +0100
+++ new/socket_wrapper-1.1.4/ChangeLog  2015-08-24 17:54:04.000000000 +0200
@@ -1,6 +1,12 @@
 ChangeLog
 ==========
 
+version 1.1.4 (released 2015-08-25)
+  * Fixed handling of msg_name in recvmsg()
+  * Fixed sendmsg()/recvmsg() TCP support
+  * Fixed several compile warnings
+  * Added environment variable to change MTU
+
 version 1.1.3 (released 2015-02-23)
   * Added support for address sanitizer.
   * Fixed leaking of memory and fds of stale sockets.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/TODO 
new/socket_wrapper-1.1.4/TODO
--- old/socket_wrapper-1.1.3/TODO       2014-08-27 15:06:21.000000000 +0200
+++ new/socket_wrapper-1.1.4/TODO       2015-08-05 15:25:53.000000000 +0200
@@ -9,13 +9,19 @@
 Library:
 ---------
 
-* Add support for fd passing in sendmsg/recvmsg.
-  Scenario:
-  We accept a connection from a client and need to pass the fd to another
-  child we forked. socket_wrapper then needs to send the 'struct socket_info'
-  to the child first and set it up there.
-  Or do it like swrap_accept() and call getpeername() and getsockname().
-* Add support for threading.
+Goals:
+* Thread safety
+* The proposed way ==> - fd-passing for tcp sockets (for free)
+  Approach:
+  - tdb "in small". So a "db file".
+    - for each socket an entry in the db file
+      (file, mmap, robust mutex. e.g. one file per local ip addr)
+    - socket_info : structure in db. protected by pthread robust mutexes
+    - socket_info_fd : --> pointer into mmap area of db
+    - free-list
+  - fd-passing: pass index in array
+    - the last element we pass is not a fd but the index number in the
+      mmaped file
 * Use realpath() in socket_wrapper_dir().
 
 Testing:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/doc/socket_wrapper.1 
new/socket_wrapper-1.1.4/doc/socket_wrapper.1
--- old/socket_wrapper-1.1.3/doc/socket_wrapper.1       2014-08-27 
15:06:21.000000000 +0200
+++ new/socket_wrapper-1.1.4/doc/socket_wrapper.1       2015-08-11 
17:30:20.000000000 +0200
@@ -2,12 +2,12 @@
 .\"     Title: socket_wrapper
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 07/09/2014
+.\"      Date: 2015-08-11
 .\"    Manual: \ \&
 .\"    Source: \ \&
 .\"  Language: English
 .\"
-.TH "SOCKET_WRAPPER" "1" "07/09/2014" "\ \&" "\ \&"
+.TH "SOCKET_WRAPPER" "1" "2015\-08\-11" "\ \&" "\ \&"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -85,6 +85,13 @@
 When debugging, it is often interesting to investigate the network traffic 
between the client and server within your application\&. If you define 
SOCKET_WRAPPER_PCAP_FILE=/path/to/file\&.pcap, socket_wrapper will dump all 
your network traffic to the specified file\&. After the test has been finished 
you\(cqre able to open the file for example with Wireshark\&.
 .RE
 .PP
+\fBSOCKET_WRAPPER_MTU\fR
+.RS 4
+With this variable you can change the MTU size\&. However we do not recomment 
to do that as the default size of 1500 byte is best for formatting PCAP files\&.
+.RE
+.sp
+The minimum value you can set is 512 and the maximum 32768\&.
+.PP
 \fBSOCKET_WRAPPER_DEBUGLEVEL\fR
 .RS 4
 If you need to see what is going on in socket_wrapper itself or try to find a 
bug, you can enable logging support in socket_wrapper if you built it with 
debug symbols\&.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/doc/socket_wrapper.1.txt 
new/socket_wrapper-1.1.4/doc/socket_wrapper.1.txt
--- old/socket_wrapper-1.1.3/doc/socket_wrapper.1.txt   2014-09-04 
11:16:51.000000000 +0200
+++ new/socket_wrapper-1.1.4/doc/socket_wrapper.1.txt   2015-08-18 
11:27:16.000000000 +0200
@@ -1,5 +1,6 @@
 socket_wrapper(1)
 =================
+:revdate: 2015-08-11
 
 NAME
 ----
@@ -51,6 +52,13 @@
 network traffic to the specified file. After the test has been finished you're
 able to open the file for example with Wireshark.
 
+*SOCKET_WRAPPER_MTU*::
+
+With this variable you can change the MTU size. However we do not recomment to
+do that as the default size of 1500 byte is best for formatting PCAP files.
+
+The minimum value you can set is 512 and the maximum 32768.
+
 *SOCKET_WRAPPER_DEBUGLEVEL*::
 
 If you need to see what is going on in socket_wrapper itself or try to find a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/src/socket_wrapper.c 
new/socket_wrapper-1.1.4/src/socket_wrapper.c
--- old/socket_wrapper-1.1.3/src/socket_wrapper.c       2015-02-23 
15:24:45.000000000 +0100
+++ new/socket_wrapper-1.1.4/src/socket_wrapper.c       2015-08-17 
12:21:00.000000000 +0200
@@ -203,11 +203,12 @@
 #define SOCKET_TYPE_CHAR_UDP_V6                'Y'
 
 /*
- * Cut down to 1500 byte packets for stream sockets,
- * which makes it easier to format PCAP capture files
- * (as the caller will simply continue from here)
+ * Set the packet MTU to 1500 bytes for stream sockets to make it it easier to
+ * format PCAP capture files (as the caller will simply continue from here).
  */
-#define SOCKET_MAX_PACKET 1500
+#define SOCKET_WRAPPER_MTU_DEFAULT 1500
+#define SOCKET_WRAPPER_MTU_MIN     512
+#define SOCKET_WRAPPER_MTU_MAX     32768
 
 #define SOCKET_MAX_SOCKETS 1024
 
@@ -912,6 +913,38 @@
        return s;
 }
 
+static unsigned int socket_wrapper_mtu(void)
+{
+       static unsigned int max_mtu = 0;
+       unsigned int tmp;
+       const char *s;
+       char *endp;
+
+       if (max_mtu != 0) {
+               return max_mtu;
+       }
+
+       max_mtu = SOCKET_WRAPPER_MTU_DEFAULT;
+
+       s = getenv("SOCKET_WRAPPER_MTU");
+       if (s == NULL) {
+               goto done;
+       }
+
+       tmp = strtol(s, &endp, 10);
+       if (s == endp) {
+               goto done;
+       }
+
+       if (tmp < SOCKET_WRAPPER_MTU_MIN || tmp > SOCKET_WRAPPER_MTU_MAX) {
+               goto done;
+       }
+       max_mtu = tmp;
+
+done:
+       return max_mtu;
+}
+
 bool socket_wrapper_enabled(void)
 {
        const char *s = socket_wrapper_dir();
@@ -3743,7 +3776,9 @@
        }
 
        switch (si->type) {
-       case SOCK_STREAM:
+       case SOCK_STREAM: {
+               unsigned long mtu;
+
                if (!si->connected) {
                        errno = ENOTCONN;
                        return -1;
@@ -3753,22 +3788,23 @@
                        break;
                }
 
+               mtu = socket_wrapper_mtu();
                for (i = 0; i < (size_t)msg->msg_iovlen; i++) {
                        size_t nlen;
                        nlen = len + msg->msg_iov[i].iov_len;
-                       if (nlen > SOCKET_MAX_PACKET) {
+                       if (nlen > mtu) {
                                break;
                        }
                }
                msg->msg_iovlen = i;
                if (msg->msg_iovlen == 0) {
                        *tmp_iov = msg->msg_iov[0];
-                       tmp_iov->iov_len = MIN(tmp_iov->iov_len, 
SOCKET_MAX_PACKET);
+                       tmp_iov->iov_len = MIN(tmp_iov->iov_len, (size_t)mtu);
                        msg->msg_iov = tmp_iov;
                        msg->msg_iovlen = 1;
                }
                break;
-
+       }
        case SOCK_DGRAM:
                if (si->connected) {
                        if (msg->msg_name) {
@@ -3958,7 +3994,8 @@
        (void)fd; /* unused */
 
        switch (si->type) {
-       case SOCK_STREAM:
+       case SOCK_STREAM: {
+               unsigned int mtu;
                if (!si->connected) {
                        errno = ENOTCONN;
                        return -1;
@@ -3968,22 +4005,23 @@
                        break;
                }
 
+               mtu = socket_wrapper_mtu();
                for (i = 0; i < (size_t)msg->msg_iovlen; i++) {
                        size_t nlen;
                        nlen = len + msg->msg_iov[i].iov_len;
-                       if (nlen > SOCKET_MAX_PACKET) {
+                       if (nlen > mtu) {
                                break;
                        }
                }
                msg->msg_iovlen = i;
                if (msg->msg_iovlen == 0) {
                        *tmp_iov = msg->msg_iov[0];
-                       tmp_iov->iov_len = MIN(tmp_iov->iov_len, 
SOCKET_MAX_PACKET);
+                       tmp_iov->iov_len = MIN(tmp_iov->iov_len, (size_t)mtu);
                        msg->msg_iov = tmp_iov;
                        msg->msg_iovlen = 1;
                }
                break;
-
+       }
        case SOCK_DGRAM:
                if (msg->msg_name == NULL) {
                        errno = EINVAL;
@@ -4051,6 +4089,19 @@
                avail += msg->msg_iov[i].iov_len;
        }
 
+       /* Convert the socket address before we leave */
+       if (si->type == SOCK_DGRAM && un_addr != NULL) {
+               rc = sockaddr_convert_from_un(si,
+                                             un_addr,
+                                             un_addrlen,
+                                             si->family,
+                                             msg->msg_name,
+                                             &msg->msg_namelen);
+               if (rc == -1) {
+                       goto done;
+               }
+       }
+
        if (avail == 0) {
                rc = 0;
                goto done;
@@ -4096,16 +4147,6 @@
                }
 
                if (un_addr != NULL) {
-                       rc = sockaddr_convert_from_un(si,
-                                                     un_addr,
-                                                     un_addrlen,
-                                                     si->family,
-                                                     msg->msg_name,
-                                                     &msg->msg_namelen);
-                       if (rc == -1) {
-                               goto done;
-                       }
-
                        swrap_pcap_dump_packet(si,
                                          msg->msg_name,
                                          SWRAP_RECVFROM,
@@ -4549,9 +4590,6 @@
 
        ret = libc_recvmsg(s, &msg, flags);
 
-       msg.msg_name = omsg->msg_name;
-       msg.msg_namelen = omsg->msg_namelen;
-
 #ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
        msg_ctrllen_filled += msg.msg_controllen;
        msg_ctrllen_left -= msg.msg_controllen;
@@ -4593,6 +4631,25 @@
 #endif
        omsg->msg_iovlen = msg.msg_iovlen;
 
+       /*
+        * From the manpage:
+        *
+        * The  msg_name  field  points  to a caller-allocated buffer that is
+        * used to return the source address if the socket is unconnected.  The
+        * caller should set msg_namelen to the size of this buffer before this
+        * call; upon return from a successful call, msg_name will contain the
+        * length of the returned address.  If the application  does  not  need
+        * to know the source address, msg_name can be specified as NULL.
+        */
+       if (si->type == SOCK_STREAM) {
+               omsg->msg_namelen = 0;
+       } else if (omsg->msg_name != NULL &&
+                  omsg->msg_namelen != 0 &&
+                  omsg->msg_namelen >= msg.msg_namelen) {
+               memcpy(omsg->msg_name, msg.msg_name, msg.msg_namelen);
+               omsg->msg_namelen = msg.msg_namelen;
+       }
+
        return ret;
 }
 
@@ -4627,8 +4684,11 @@
        tmp.iov_len = 0;
 
        ZERO_STRUCT(msg);
-       msg.msg_name = omsg->msg_name;             /* optional address */
-       msg.msg_namelen = omsg->msg_namelen;       /* size of address */
+
+       if (si->connected == 0) {
+               msg.msg_name = omsg->msg_name;             /* optional address 
*/
+               msg.msg_namelen = omsg->msg_namelen;       /* size of address */
+       }
        msg.msg_iov = omsg->msg_iov;               /* scatter/gather array */
        msg.msg_iovlen = omsg->msg_iovlen;         /* # elements in msg_iov */
 #ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
@@ -5071,4 +5131,11 @@
                }
                s = sockets;
        }
+
+       if (swrap.libc_handle != NULL) {
+               dlclose(swrap.libc_handle);
+       }
+       if (swrap.libsocket_handle) {
+               dlclose(swrap.libsocket_handle);
+       }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/CMakeLists.txt 
new/socket_wrapper-1.1.4/tests/CMakeLists.txt
--- old/socket_wrapper-1.1.3/tests/CMakeLists.txt       2014-10-02 
07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/CMakeLists.txt       2015-08-11 
17:30:20.000000000 +0200
@@ -24,6 +24,7 @@
     test_echo_tcp_connect
     test_echo_tcp_bind
     test_echo_tcp_socket_options
+    test_echo_tcp_sendmsg_recvmsg
     test_echo_tcp_write_read
     test_echo_tcp_writev_readv
     test_echo_tcp_get_peer_sock_name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/test_echo_tcp_bind.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_bind.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_bind.c 2014-10-02 
07:23:45.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_bind.c 2015-08-11 
17:30:20.000000000 +0200
@@ -19,19 +19,25 @@
 #include <rpc/rpc.h>
 #endif
 
-static void setup_echo_srv_tcp_ipv4(void **state)
+static int setup_echo_srv_tcp_ipv4(void **state)
 {
        torture_setup_echo_srv_tcp_ipv4(state);
+
+       return 0;
 }
 
-static void setup_echo_srv_tcp_ipv6(void **state)
+static int setup_echo_srv_tcp_ipv6(void **state)
 {
        torture_setup_echo_srv_tcp_ipv6(state);
+
+       return 0;
 }
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_bind_ipv4(void **state)
@@ -492,39 +498,39 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_bind_ipv4,
+       const struct CMUnitTest tcp_bind_tests[] = {
+               cmocka_unit_test_setup_teardown(test_bind_ipv4,
                                         setup_echo_srv_tcp_ipv4,
                                         teardown),
 #if 0 /* TODO */
-               unit_test_setup_teardown(test_bind_ipv4_addr_in_use,
+               cmocka_unit_test_setup_teardown(test_bind_ipv4_addr_in_use,
                                         setup_echo_srv_tcp_ipv4,
                                         teardown),
 #endif
 #ifdef HAVE_BINDRESVPORT
-               unit_test_setup_teardown(test_bindresvport_ipv4,
+               cmocka_unit_test_setup_teardown(test_bindresvport_ipv4,
                                         setup_echo_srv_tcp_ipv4,
                                         teardown),
-               unit_test_setup_teardown(test_bindresvport_ipv4_null,
+               cmocka_unit_test_setup_teardown(test_bindresvport_ipv4_null,
                                         setup_echo_srv_tcp_ipv4,
                                         teardown),
 #endif /* HAVE_BINDRESVPORT */
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_bind_on_ipv6_sock,
+               cmocka_unit_test_setup_teardown(test_bind_on_ipv6_sock,
                                         setup_echo_srv_tcp_ipv6,
                                         teardown),
 #ifdef HAVE_BINDRESVPORT
-               unit_test_setup_teardown(test_bindresvport_on_ipv6_sock,
+               cmocka_unit_test_setup_teardown(test_bindresvport_on_ipv6_sock,
                                         setup_echo_srv_tcp_ipv6,
                                         teardown),
-               unit_test_setup_teardown(test_bindresvport_on_ipv6_sock_null,
+               
cmocka_unit_test_setup_teardown(test_bindresvport_on_ipv6_sock_null,
                                         setup_echo_srv_tcp_ipv6,
                                         teardown),
 #endif /* HAVE_BINDRESVPORT */
 #endif /* HAVE_IPV6 */
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(tcp_bind_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/test_echo_tcp_connect.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_connect.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_connect.c      2014-10-02 
07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_connect.c      2015-08-17 
12:21:00.000000000 +0200
@@ -15,14 +15,18 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_tcp_ipv4(void **state)
+static int setup_echo_srv_tcp_ipv4(void **state)
 {
        torture_setup_echo_srv_tcp_ipv4(state);
+
+       return 0;
 }
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_connect_broadcast_ipv4(void **state)
@@ -72,7 +76,7 @@
        assert_int_equal(rc, 1);
 
        /* Connect should downgrade to IPv4 and allow the connect */
-       rc = connect(s, &addr.sa.in, addr.sa_socklen);
+       rc = connect(s, &addr.sa.s, addr.sa_socklen);
        assert_int_equal(rc, 0);
 
        close(s);
@@ -82,14 +86,16 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_connect_broadcast_ipv4, 
setup_echo_srv_tcp_ipv4, teardown),
+       const struct CMUnitTest tcp_connect_tests[] = {
+               cmocka_unit_test(test_connect_broadcast_ipv4),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_connect_downgrade_ipv6, 
setup_echo_srv_tcp_ipv4, teardown),
+               cmocka_unit_test(test_connect_downgrade_ipv6),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(tcp_connect_tests,
+                                   setup_echo_srv_tcp_ipv4,
+                                   teardown);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_tcp_get_peer_sock_name.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_get_peer_sock_name.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_get_peer_sock_name.c   
2014-10-02 07:23:45.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_get_peer_sock_name.c   
2015-08-17 12:21:00.000000000 +0200
@@ -15,15 +15,19 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_tcp_ipv4(void **state)
+static int setup_echo_srv_tcp_ipv4(void **state)
 {
        torture_setup_echo_srv_tcp_ipv4(state);
        setenv("SOCKET_WRAPPER_DEFAULT_IFACE", "20", 1);
+
+       return 0;
 }
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void _assert_sockaddr_equal(struct torture_address *addr, const char *a,
@@ -409,7 +413,7 @@
        assert_int_equal(rc, 1);
 
        /* Connect */
-       rc = connect(s, &addr.sa.in, addr.sa_socklen);
+       rc = connect(s, &addr.sa.s, addr.sa_socklen);
        assert_return_code(rc, errno);
 
        /* Check with len=0 */
@@ -446,25 +450,27 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_connect_getsockname_getpeername,
-                                        setup_echo_srv_tcp_ipv4,
-                                        teardown),
-               
unit_test_setup_teardown(test_connect_getsockname_getpeername_port,
-                                        setup_echo_srv_tcp_ipv4,
-                                        teardown),
-               
unit_test_setup_teardown(test_connect_getsockname_getpeername_any,
-                                        setup_echo_srv_tcp_ipv4,
-                                        teardown),
-               
unit_test_setup_teardown(test_connect_getsockname_getpeername_any_port,
-                                        setup_echo_srv_tcp_ipv4,
-                                        teardown),
-               
unit_test_setup_teardown(test_connect_getsockname_getpeername_len,
-                                        setup_echo_srv_tcp_ipv4,
-                                        teardown),
-       };
-
-       rc = run_tests(tests);
+       const struct CMUnitTest sock_name_tests[] = {
+               
cmocka_unit_test_setup_teardown(test_connect_getsockname_getpeername,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+               
cmocka_unit_test_setup_teardown(test_connect_getsockname_getpeername_port,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+               
cmocka_unit_test_setup_teardown(test_connect_getsockname_getpeername_any,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+               
cmocka_unit_test_setup_teardown(test_connect_getsockname_getpeername_any_port,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+               
cmocka_unit_test_setup_teardown(test_connect_getsockname_getpeername_len,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+       };
+
+       rc = cmocka_run_group_tests(sock_name_tests,
+                                   NULL,
+                                   NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_tcp_sendmsg_recvmsg.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_sendmsg_recvmsg.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_sendmsg_recvmsg.c      
1970-01-01 01:00:00.000000000 +0100
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_sendmsg_recvmsg.c      
2015-08-17 12:21:00.000000000 +0200
@@ -0,0 +1,273 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "config.h"
+#include "torture.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int setup_echo_srv_tcp_ipv4(void **state)
+{
+       torture_setup_echo_srv_tcp_ipv4(state);
+
+       return 0;
+}
+
+#ifdef HAVE_IPV6
+static int setup_echo_srv_tcp_ipv6(void **state)
+{
+       torture_setup_echo_srv_tcp_ipv6(state);
+
+       return 0;
+}
+#endif
+
+static int teardown(void **state)
+{
+       torture_teardown_echo_srv(state);
+
+       return 0;
+}
+
+static void test_sendmsg_recvmsg_ipv4(void **state)
+{
+       struct torture_address addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       char send_buf[64] = {0};
+       char recv_buf[64] = {0};
+       ssize_t ret;
+       int rc;
+       int i;
+       int s;
+
+       (void) state; /* unused */
+
+       s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+       assert_int_not_equal(s, -1);
+
+       addr.sa.in.sin_family = AF_INET;
+       addr.sa.in.sin_port = htons(torture_server_port());
+
+       rc = inet_pton(AF_INET,
+                      torture_server_address(AF_INET),
+                      &addr.sa.in.sin_addr);
+       assert_int_equal(rc, 1);
+
+       rc = connect(s, &addr.sa.s, addr.sa_socklen);
+
+       for (i = 0; i < 10; i++) {
+               struct torture_address reply_addr = {
+                       .sa_socklen = sizeof(struct sockaddr_storage),
+               };
+               struct msghdr s_msg = {
+                       .msg_namelen = 0,
+               };
+               struct msghdr r_msg = {
+                       .msg_namelen = 0,
+               };
+               struct iovec s_iov;
+               struct iovec r_iov;
+
+               snprintf(send_buf, sizeof(send_buf), "packet.%d", i);
+
+               /* This should be ignored */
+               rc = inet_pton(AF_INET,
+                              "127.0.0.1",
+                              &addr.sa.in.sin_addr);
+               assert_int_equal(rc, 1);
+
+               s_msg.msg_name = &addr.sa.s;
+               s_msg.msg_namelen = addr.sa_socklen;
+
+               s_iov.iov_base = send_buf;
+               s_iov.iov_len = sizeof(send_buf);
+
+               s_msg.msg_iov = &s_iov;
+               s_msg.msg_iovlen = 1;
+
+               ret = sendmsg(s, &s_msg, 0);
+               assert_int_not_equal(ret, -1);
+
+               r_msg.msg_name = &reply_addr.sa.s;
+               r_msg.msg_namelen = reply_addr.sa_socklen;
+
+               r_iov.iov_base = recv_buf;
+               r_iov.iov_len = sizeof(recv_buf);
+
+               r_msg.msg_iov = &r_iov;
+               r_msg.msg_iovlen = 1;
+
+               ret = recvmsg(s, &r_msg, 0);
+               assert_int_not_equal(ret, -1);
+
+               assert_int_equal(r_msg.msg_namelen, 0);
+
+               assert_memory_equal(send_buf, recv_buf, sizeof(send_buf));
+       }
+
+       close(s);
+}
+
+#ifdef HAVE_IPV6
+static void test_sendmsg_recvmsg_ipv6(void **state)
+{
+       struct torture_address addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       char send_buf[64] = {0};
+       char recv_buf[64] = {0};
+       ssize_t ret;
+       int rc;
+       int i;
+       int s;
+
+       (void) state; /* unused */
+
+       s = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+       assert_int_not_equal(s, -1);
+
+       addr.sa.in.sin_family = AF_INET6;
+       addr.sa.in.sin_port = htons(torture_server_port());
+
+       rc = inet_pton(AF_INET6,
+                      torture_server_address(AF_INET6),
+                      &addr.sa.in6.sin6_addr);
+       assert_int_equal(rc, 1);
+
+       rc = connect(s, &addr.sa.s, addr.sa_socklen);
+
+       for (i = 0; i < 10; i++) {
+               struct torture_address reply_addr = {
+                       .sa_socklen = sizeof(struct sockaddr_in),
+               };
+               struct msghdr s_msg = {
+                       .msg_namelen = 0,
+               };
+               struct msghdr r_msg = {
+                       .msg_namelen = 0,
+               };
+               struct iovec s_iov;
+               struct iovec r_iov;
+
+               snprintf(send_buf, sizeof(send_buf), "packet.%d", i);
+
+               s_iov.iov_base = send_buf;
+               s_iov.iov_len = sizeof(send_buf);
+
+               s_msg.msg_iov = &s_iov;
+               s_msg.msg_iovlen = 1;
+
+               ret = sendmsg(s, &s_msg, 0);
+               assert_int_not_equal(ret, -1);
+
+               r_msg.msg_name = &reply_addr.sa.s;
+               r_msg.msg_namelen = reply_addr.sa_socklen;
+
+               r_iov.iov_base = recv_buf;
+               r_iov.iov_len = sizeof(recv_buf);
+
+               r_msg.msg_iov = &r_iov;
+               r_msg.msg_iovlen = 1;
+
+               ret = recvmsg(s, &r_msg, 0);
+               assert_int_not_equal(ret, -1);
+
+               assert_int_equal(r_msg.msg_namelen, 0);
+
+               assert_memory_equal(send_buf, recv_buf, sizeof(send_buf));
+       }
+
+       close(s);
+}
+#endif
+
+static void test_sendmsg_recvmsg_ipv4_null(void **state)
+{
+       struct torture_address send_addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       struct msghdr s_msg = {
+               .msg_namelen = 0,
+       };
+       struct msghdr r_msg = {
+               .msg_namelen = 0,
+       };
+       struct iovec iov;
+       char payload[] = "PACKET";
+       ssize_t ret;
+       int rc;
+       int s;
+
+       (void)state; /* unused */
+
+       s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+       assert_int_not_equal(s, -1);
+
+       send_addr.sa.in.sin_family = AF_INET;
+       send_addr.sa.in.sin_port = htons(torture_server_port());
+
+       rc = inet_pton(AF_INET,
+                      torture_server_address(AF_INET),
+                      &send_addr.sa.in.sin_addr);
+       assert_int_equal(rc, 1);
+
+       rc = connect(s, &send_addr.sa.s, send_addr.sa_socklen);
+
+       /* msg_name = NULL */
+
+       iov.iov_base = (void *)payload;
+       iov.iov_len = sizeof(payload);
+
+       s_msg.msg_iov = &iov;
+       s_msg.msg_iovlen = 1;
+
+       ret = sendmsg(s, &s_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       /* msg_name = NULL */
+
+       memset(payload, 0, sizeof(payload));
+
+       r_msg.msg_iov = &iov;
+       r_msg.msg_iovlen = 1;
+
+       ret = recvmsg(s, &r_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       assert_int_equal(r_msg.msg_namelen, 0);
+       assert_null(r_msg.msg_name);
+
+       close(s);
+}
+
+int main(void) {
+       int rc;
+
+       const struct CMUnitTest sendmsg_tests[] = {
+               cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv4,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+               cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv4_null,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+#ifdef HAVE_IPV6
+               cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv6,
+                                               setup_echo_srv_tcp_ipv6,
+                                               teardown),
+#endif
+       };
+
+       rc = cmocka_run_group_tests(sendmsg_tests, NULL, NULL);
+
+       return rc;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/test_echo_tcp_socket.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_socket.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_socket.c       2014-10-02 
07:23:45.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_socket.c       2015-08-17 
12:21:00.000000000 +0200
@@ -28,7 +28,7 @@
        s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        assert_int_not_equal(s, -1);
 
-       rc = getsockname(s, &addr.sa.in, &addr.sa_socklen);
+       rc = getsockname(s, &addr.sa.s, &addr.sa_socklen);
        assert_return_code(rc, errno);
        assert_int_equal(addr.sa.in.sin_family, AF_INET);
 }
@@ -56,14 +56,14 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test(test_socket_getsockname),
+       const struct CMUnitTest getsockname_tests[] = {
+               cmocka_unit_test(test_socket_getsockname),
 #ifdef HAVE_IPV6
-               unit_test(test_socket_getsockname6),
+               cmocka_unit_test(test_socket_getsockname6),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(getsockname_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_tcp_socket_options.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_socket_options.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_socket_options.c       
2014-10-02 07:23:45.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_socket_options.c       
2015-08-11 17:30:20.000000000 +0200
@@ -20,26 +20,34 @@
 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
 #endif
 
-static void setup_echo_srv_tcp_ipv4(void **state)
+static int setup_echo_srv_tcp_ipv4(void **state)
 {
        torture_setup_echo_srv_tcp_ipv4(state);
+
+       return 0;
 }
 
 #ifdef HAVE_IPV6
-static void setup_echo_srv_tcp_ipv6(void **state)
+static int setup_echo_srv_tcp_ipv6(void **state)
 {
        torture_setup_echo_srv_tcp_ipv6(state);
+
+       return 0;
 }
 
-static void setup_ipv6(void **state)
+static int setup_ipv6(void **state)
 {
        torture_setup_socket_dir(state);
+
+       return 0;
 }
 #endif
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_sockopt_sndbuf(void **state)
@@ -288,20 +296,24 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_sockopt_sndbuf, 
setup_echo_srv_tcp_ipv4, teardown),
-               unit_test_setup_teardown(test_sockopt_so,
-                                        setup_echo_srv_tcp_ipv4,
-                                        teardown),
+       const struct CMUnitTest sockopt_tests[] = {
+               cmocka_unit_test_setup_teardown(test_sockopt_sndbuf,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
+               cmocka_unit_test_setup_teardown(test_sockopt_so,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_sockopt_so6,
-                                        setup_echo_srv_tcp_ipv6,
-                                        teardown),
-               unit_test_setup_teardown(test_bind_ipv6_only, setup_ipv6, 
teardown),
+               cmocka_unit_test_setup_teardown(test_sockopt_so6,
+                                               setup_echo_srv_tcp_ipv6,
+                                               teardown),
+               cmocka_unit_test_setup_teardown(test_bind_ipv6_only,
+                                               setup_ipv6,
+                                               teardown),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(sockopt_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_tcp_write_read.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_write_read.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_write_read.c   2014-10-02 
07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_write_read.c   2015-08-11 
17:30:20.000000000 +0200
@@ -15,21 +15,27 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_tcp_ipv4(void **state)
+static int setup_echo_srv_tcp_ipv4(void **state)
 {
        torture_setup_echo_srv_tcp_ipv4(state);
+
+       return 0;
 }
 
 #ifdef HAVE_IPV6
-static void setup_echo_srv_tcp_ipv6(void **state)
+static int setup_echo_srv_tcp_ipv6(void **state)
 {
        torture_setup_echo_srv_tcp_ipv6(state);
+
+       return 0;
 }
 #endif
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_write_read_ipv4(void **state)
@@ -133,14 +139,18 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_write_read_ipv4, 
setup_echo_srv_tcp_ipv4, teardown),
+       const struct CMUnitTest tcp_write_tests[] = {
+               cmocka_unit_test_setup_teardown(test_write_read_ipv4,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_write_read_ipv6, 
setup_echo_srv_tcp_ipv6, teardown),
+               cmocka_unit_test_setup_teardown(test_write_read_ipv6,
+                                               setup_echo_srv_tcp_ipv6,
+                                               teardown),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(tcp_write_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_tcp_writev_readv.c 
new/socket_wrapper-1.1.4/tests/test_echo_tcp_writev_readv.c
--- old/socket_wrapper-1.1.3/tests/test_echo_tcp_writev_readv.c 2014-10-02 
07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_tcp_writev_readv.c 2015-08-11 
17:30:20.000000000 +0200
@@ -16,21 +16,27 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_tcp_ipv4(void **state)
+static int setup_echo_srv_tcp_ipv4(void **state)
 {
        torture_setup_echo_srv_tcp_ipv4(state);
+
+       return 0;
 }
 
 #ifdef HAVE_IPV6
-static void setup_echo_srv_tcp_ipv6(void **state)
+static int setup_echo_srv_tcp_ipv6(void **state)
 {
        torture_setup_echo_srv_tcp_ipv6(state);
+
+       return 0;
 }
 #endif
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_writev_readv_ipv4(void **state)
@@ -166,14 +172,18 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_writev_readv_ipv4, 
setup_echo_srv_tcp_ipv4, teardown),
+       const struct CMUnitTest tcp_writev_tests[] = {
+               cmocka_unit_test_setup_teardown(test_writev_readv_ipv4,
+                                               setup_echo_srv_tcp_ipv4,
+                                               teardown),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_writev_readv_ipv6, 
setup_echo_srv_tcp_ipv6, teardown),
+               cmocka_unit_test_setup_teardown(test_writev_readv_ipv6,
+                                               setup_echo_srv_tcp_ipv6,
+                                               teardown),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(tcp_writev_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/test_echo_udp_send_recv.c 
new/socket_wrapper-1.1.4/tests/test_echo_udp_send_recv.c
--- old/socket_wrapper-1.1.3/tests/test_echo_udp_send_recv.c    2014-10-02 
07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_udp_send_recv.c    2015-08-11 
17:30:20.000000000 +0200
@@ -15,21 +15,27 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_udp_ipv4(void **state)
+static int setup_echo_srv_udp_ipv4(void **state)
 {
        torture_setup_echo_srv_udp_ipv4(state);
+
+       return 0;
 }
 
 #ifdef HAVE_IPV6
-static void setup_echo_srv_udp_ipv6(void **state)
+static int setup_echo_srv_udp_ipv6(void **state)
 {
        torture_setup_echo_srv_udp_ipv6(state);
+
+       return 0;
 }
 #endif
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_send_recv_ipv4(void **state)
@@ -137,14 +143,18 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_send_recv_ipv4, 
setup_echo_srv_udp_ipv4, teardown),
+       const struct CMUnitTest send_tests[] = {
+               cmocka_unit_test_setup_teardown(test_send_recv_ipv4,
+                                               setup_echo_srv_udp_ipv4,
+                                               teardown),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_send_recv_ipv6, 
setup_echo_srv_udp_ipv6, teardown),
+               cmocka_unit_test_setup_teardown(test_send_recv_ipv6,
+                                               setup_echo_srv_udp_ipv6,
+                                               teardown),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(send_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_udp_sendmsg_recvmsg.c 
new/socket_wrapper-1.1.4/tests/test_echo_udp_sendmsg_recvmsg.c
--- old/socket_wrapper-1.1.3/tests/test_echo_udp_sendmsg_recvmsg.c      
2014-10-02 07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_udp_sendmsg_recvmsg.c      
2015-08-17 12:21:00.000000000 +0200
@@ -15,24 +15,30 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_udp_ipv4(void **state)
+static int setup_echo_srv_udp_ipv4(void **state)
 {
        torture_setup_echo_srv_udp_ipv4(state);
+
+       return 0;
 }
 
 #ifdef HAVE_IPV6
-static void setup_echo_srv_udp_ipv6(void **state)
+static int setup_echo_srv_udp_ipv6(void **state)
 {
        torture_setup_echo_srv_udp_ipv6(state);
+
+       return 0;
 }
 #endif
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
-static void test_sendto_recvfrom_ipv4(void **state)
+static void test_sendmsg_recvmsg_ipv4(void **state)
 {
        struct torture_address addr = {
                .sa_socklen = sizeof(struct sockaddr_in),
@@ -98,6 +104,8 @@
                ret = recvmsg(s, &r_msg, 0);
                assert_int_not_equal(ret, -1);
 
+               assert_int_equal(r_msg.msg_namelen, sizeof(struct sockaddr_in));
+
                a = inet_ntop(AF_INET, &srv_in.sa.in.sin_addr, ip, sizeof(ip));
                assert_non_null(a);
                assert_string_equal(a, torture_server_address(AF_INET));
@@ -109,7 +117,7 @@
 }
 
 #ifdef HAVE_IPV6
-static void test_sendto_recvfrom_ipv6(void **state)
+static void test_sendmsg_recvmsg_ipv6(void **state)
 {
        struct torture_address addr = {
                .sa_socklen = sizeof(struct sockaddr_in6),
@@ -174,6 +182,8 @@
                ret = recvmsg(s, &r_msg, 0);
                assert_int_not_equal(ret, -1);
 
+               assert_int_equal(r_msg.msg_namelen, sizeof(struct 
sockaddr_in6));
+
                a = inet_ntop(AF_INET6, &srv_in6.sa.in6.sin6_addr, ip, 
sizeof(ip));
                assert_non_null(a);
                assert_string_equal(a, torture_server_address(AF_INET6));
@@ -185,17 +195,213 @@
 }
 #endif
 
+static void test_sendmsg_recvmsg_ipv4_connected(void **state)
+{
+       struct torture_address send_addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       struct torture_address r_addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       struct msghdr s_msg = {
+               .msg_namelen = 0,
+       };
+       struct msghdr r_msg = {
+               .msg_namelen = 0,
+       };
+       struct iovec iov;
+       char ip[INET_ADDRSTRLEN] = {0};
+       char payload[] = "PACKET";
+       const char *a;
+       ssize_t ret;
+       int rc;
+       int s;
+
+       (void)state; /* unused */
+
+       s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+       assert_int_not_equal(s, -1);
+
+       send_addr.sa.in.sin_family = AF_INET;
+       send_addr.sa.in.sin_port = htons(torture_server_port());
+
+       rc = inet_pton(AF_INET,
+                      torture_server_address(AF_INET),
+                      &send_addr.sa.in.sin_addr);
+       assert_int_equal(rc, 1);
+
+       rc = connect(s, &send_addr.sa.s, send_addr.sa_socklen);
+
+       iov.iov_base = (void *)payload;
+       iov.iov_len = sizeof(payload);
+
+       /* msg_name is NULL */
+
+       s_msg.msg_iov = &iov;
+       s_msg.msg_iovlen = 1;
+
+       ret = sendmsg(s, &s_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       r_msg.msg_name = &r_addr.sa.ss;
+       r_msg.msg_namelen = r_addr.sa_socklen;
+
+       memset(payload, 0, sizeof(payload));
+
+       r_msg.msg_iov = &iov;
+       r_msg.msg_iovlen = 1;
+
+       ret = recvmsg(s, &r_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       assert_int_equal(r_msg.msg_namelen, sizeof(struct sockaddr_in));
+
+       a = inet_ntop(AF_INET, &r_addr.sa.in.sin_addr, ip, sizeof(ip));
+       assert_non_null(a);
+       assert_string_equal(a, torture_server_address(AF_INET));
+
+       close(s);
+}
+
+static void test_sendmsg_recvmsg_ipv4_connected_null(void **state)
+{
+       struct torture_address send_addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       struct msghdr s_msg = {
+               .msg_namelen = 0,
+       };
+       struct msghdr r_msg = {
+               .msg_namelen = 0,
+       };
+       struct iovec iov;
+       char payload[] = "PACKET";
+       ssize_t ret;
+       int rc;
+       int s;
+
+       (void)state; /* unused */
+
+       s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+       assert_int_not_equal(s, -1);
+
+       send_addr.sa.in.sin_family = AF_INET;
+       send_addr.sa.in.sin_port = htons(torture_server_port());
+
+       rc = inet_pton(AF_INET,
+                      torture_server_address(AF_INET),
+                      &send_addr.sa.in.sin_addr);
+       assert_int_equal(rc, 1);
+
+       rc = connect(s, &send_addr.sa.s, send_addr.sa_socklen);
+
+       /* msg_name = NULL */
+
+       iov.iov_base = (void *)payload;
+       iov.iov_len = sizeof(payload);
+
+       s_msg.msg_iov = &iov;
+       s_msg.msg_iovlen = 1;
+
+       ret = sendmsg(s, &s_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       /* msg_name = NULL */
+
+       memset(payload, 0, sizeof(payload));
+
+       r_msg.msg_iov = &iov;
+       r_msg.msg_iovlen = 1;
+
+       ret = recvmsg(s, &r_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       assert_int_equal(r_msg.msg_namelen, 0);
+       assert_null(r_msg.msg_name);
+
+       close(s);
+}
+
+static void test_sendmsg_recvmsg_ipv4_connected_namelen(void **state)
+{
+       struct torture_address send_addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       struct msghdr s_msg = {
+               .msg_namelen = 0,
+       };
+       struct msghdr r_msg = {
+               .msg_namelen = sizeof(struct sockaddr_storage),
+       };
+       struct iovec iov;
+       char payload[] = "PACKET";
+       ssize_t ret;
+       int rc;
+       int s;
+
+       (void)state; /* unused */
+
+       s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+       assert_int_not_equal(s, -1);
+
+       send_addr.sa.in.sin_family = AF_INET;
+       send_addr.sa.in.sin_port = htons(torture_server_port());
+
+       rc = inet_pton(AF_INET,
+                      torture_server_address(AF_INET),
+                      &send_addr.sa.in.sin_addr);
+       assert_int_equal(rc, 1);
+
+       rc = connect(s, &send_addr.sa.s, send_addr.sa_socklen);
+
+       /* msg_name = NULL */
+
+       iov.iov_base = (void *)payload;
+       iov.iov_len = sizeof(payload);
+
+       s_msg.msg_iov = &iov;
+       s_msg.msg_iovlen = 1;
+
+       ret = sendmsg(s, &s_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       /* msg_name = NULL */
+
+       memset(payload, 0, sizeof(payload));
+
+       r_msg.msg_iov = &iov;
+       r_msg.msg_iovlen = 1;
+
+       ret = recvmsg(s, &r_msg, 0);
+       assert_int_not_equal(ret, -1);
+
+       close(s);
+}
+
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_sendto_recvfrom_ipv4, 
setup_echo_srv_udp_ipv4, teardown),
+       const struct CMUnitTest sendmsg_tests[] = {
+               cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv4,
+                                               setup_echo_srv_udp_ipv4,
+                                               teardown),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_sendto_recvfrom_ipv6, 
setup_echo_srv_udp_ipv6, teardown),
+               cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv6,
+                                               setup_echo_srv_udp_ipv6,
+                                               teardown),
 #endif
+               
cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv4_connected,
+                                               setup_echo_srv_udp_ipv4,
+                                               teardown),
+               
cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv4_connected_null,
+                                               setup_echo_srv_udp_ipv4,
+                                               teardown),
+               
cmocka_unit_test_setup_teardown(test_sendmsg_recvmsg_ipv4_connected_namelen,
+                                               setup_echo_srv_udp_ipv4,
+                                               teardown),
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(sendmsg_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.1.3/tests/test_echo_udp_sendto_recvfrom.c 
new/socket_wrapper-1.1.4/tests/test_echo_udp_sendto_recvfrom.c
--- old/socket_wrapper-1.1.3/tests/test_echo_udp_sendto_recvfrom.c      
2014-10-02 07:11:30.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_echo_udp_sendto_recvfrom.c      
2015-08-11 17:30:20.000000000 +0200
@@ -15,21 +15,27 @@
 #include <stdio.h>
 #include <unistd.h>
 
-static void setup_echo_srv_udp_ipv4(void **state)
+static int setup_echo_srv_udp_ipv4(void **state)
 {
        torture_setup_echo_srv_udp_ipv4(state);
+
+       return 0;
 }
 
 #ifdef HAVE_IPV6
-static void setup_echo_srv_udp_ipv6(void **state)
+static int setup_echo_srv_udp_ipv6(void **state)
 {
        torture_setup_echo_srv_udp_ipv6(state);
+
+       return 0;
 }
 #endif
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        torture_teardown_echo_srv(state);
+
+       return 0;
 }
 
 static void test_sendto_recvfrom_ipv4(void **state)
@@ -189,14 +195,18 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_sendto_recvfrom_ipv4, 
setup_echo_srv_udp_ipv4, teardown),
+       const struct CMUnitTest sendto_tests[] = {
+               cmocka_unit_test_setup_teardown(test_sendto_recvfrom_ipv4,
+                                               setup_echo_srv_udp_ipv4,
+                                               teardown),
 #ifdef HAVE_IPV6
-               unit_test_setup_teardown(test_sendto_recvfrom_ipv6, 
setup_echo_srv_udp_ipv6, teardown),
+               cmocka_unit_test_setup_teardown(test_sendto_recvfrom_ipv6,
+                                               setup_echo_srv_udp_ipv6,
+                                               teardown),
 #endif
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(sendto_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/test_ioctl.c 
new/socket_wrapper-1.1.4/tests/test_ioctl.c
--- old/socket_wrapper-1.1.3/tests/test_ioctl.c 2014-08-27 15:06:21.000000000 
+0200
+++ new/socket_wrapper-1.1.4/tests/test_ioctl.c 2015-08-11 17:30:20.000000000 
+0200
@@ -14,7 +14,7 @@
 #include <limits.h>
 #include <unistd.h>
 
-static void setup(void **state)
+static int setup(void **state)
 {
        char test_tmpdir[256];
        const char *p;
@@ -29,16 +29,18 @@
        *state = strdup(p);
        setenv("SOCKET_WRAPPER_DIR", p, 1);
        setenv("SOCKET_WRAPPER_DEFAULT_IFACE", "11", 1);
+
+       return 0;
 }
 
-static void teardown(void **state)
+static int teardown(void **state)
 {
        char remove_cmd[PATH_MAX] = {0};
        char *s = (char *)*state;
        int rc;
 
        if (s == NULL) {
-               return;
+               return -1;
        }
 
        snprintf(remove_cmd, sizeof(remove_cmd), "rm -rf %s", s);
@@ -48,6 +50,8 @@
        if (rc < 0) {
                fprintf(stderr, "%s failed: %s", remove_cmd, strerror(errno));
        }
+
+       return rc;
 }
 
 static void test_swrap_socket(void **state)
@@ -95,12 +99,12 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test_setup_teardown(test_swrap_socket, setup, teardown),
-               unit_test_setup_teardown(test_swrap_ioctl_sock, setup, 
teardown),
+       const struct CMUnitTest ioctl_tests[] = {
+               cmocka_unit_test_setup_teardown(test_swrap_socket, setup, 
teardown),
+               cmocka_unit_test_setup_teardown(test_swrap_ioctl_sock, setup, 
teardown),
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(ioctl_tests, NULL, NULL);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.3/tests/test_sendmsg_recvmsg_fd.c 
new/socket_wrapper-1.1.4/tests/test_sendmsg_recvmsg_fd.c
--- old/socket_wrapper-1.1.3/tests/test_sendmsg_recvmsg_fd.c    2014-07-29 
14:15:34.000000000 +0200
+++ new/socket_wrapper-1.1.4/tests/test_sendmsg_recvmsg_fd.c    2015-08-11 
17:30:20.000000000 +0200
@@ -106,11 +106,11 @@
 int main(void) {
        int rc;
 
-       const UnitTest tests[] = {
-               unit_test(test_sendmsg_recvmsg_fd),
+       const struct CMUnitTest tests[] = {
+               cmocka_unit_test(test_sendmsg_recvmsg_fd),
        };
 
-       rc = run_tests(tests);
+       rc = cmocka_run_group_tests(tests, NULL, NULL);
 
        return rc;
 }


Reply via email to