Hello community,

here is the log from the commit of package socket_wrapper for openSUSE:Factory 
checked in at 2016-03-29 14:50:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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    
2016-02-17 12:24:53.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.socket_wrapper.new/socket_wrapper.changes       
2016-03-29 14:50:40.000000000 +0200
@@ -1,0 +2,9 @@
+Mon Mar 21 18:21:00 UTC 2016 - [email protected]
+
+- Update to version 1.1.6
+  * Added a wrapper for write()
+  * Added support for automatic binding of ephemeral ports
+  * Fixed recvmsg() with UDP
+  * Fixed AF_NETLINK sockets
+
+-------------------------------------------------------------------

Old:
----
  socket_wrapper-1.1.5.tar.gz

New:
----
  socket_wrapper-1.1.6.tar.gz

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

Other differences:
------------------
++++++ socket_wrapper.spec ++++++
--- /var/tmp/diff_new_pack.5xbYYv/_old  2016-03-29 14:50:41.000000000 +0200
+++ /var/tmp/diff_new_pack.5xbYYv/_new  2016-03-29 14:50:41.000000000 +0200
@@ -24,7 +24,7 @@
 ############################# NOTE ##################################
 
 Name:           socket_wrapper
-Version:        1.1.5
+Version:        1.1.6
 Release:        0
 Summary:        A library passing all socket communications trough Unix sockets
 License:        BSD-3-Clause

++++++ socket_wrapper-1.1.5.tar.gz -> socket_wrapper-1.1.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/CMakeLists.txt 
new/socket_wrapper-1.1.6/CMakeLists.txt
--- old/socket_wrapper-1.1.5/CMakeLists.txt     2015-10-15 09:36:23.000000000 
+0200
+++ new/socket_wrapper-1.1.6/CMakeLists.txt     2016-03-15 13:54:36.000000000 
+0100
@@ -8,7 +8,7 @@
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "1")
-set(APPLICATION_VERSION_PATCH "5")
+set(APPLICATION_VERSION_PATCH "6")
 
 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.5")
+set(LIBRARY_VERSION "0.1.6")
 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.5/ChangeLog 
new/socket_wrapper-1.1.6/ChangeLog
--- old/socket_wrapper-1.1.5/ChangeLog  2015-10-15 10:25:33.000000000 +0200
+++ new/socket_wrapper-1.1.6/ChangeLog  2016-03-15 13:54:36.000000000 +0100
@@ -1,6 +1,12 @@
 ChangeLog
 ==========
 
+version 1.1.6 (released 2016-03-15)
+  * Added a wrapper for write()
+  * Added support for automatic binding of ephemeral ports
+  * Fixed recvmsg() with UDP
+  * Fixed AF_NETLINK sockets
+
 version 1.1.5 (released 2015-10-15)
   * Added support for TCP_NODELAY in setsockopt/getsockopt
   * Fixed cmsg space calculation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/src/socket_wrapper.c 
new/socket_wrapper-1.1.6/src/socket_wrapper.c
--- old/socket_wrapper-1.1.5/src/socket_wrapper.c       2015-10-15 
09:36:23.000000000 +0200
+++ new/socket_wrapper-1.1.6/src/socket_wrapper.c       2016-03-02 
09:29:48.000000000 +0100
@@ -398,6 +398,7 @@
 #ifdef HAVE_TIMERFD_CREATE
        int (*libc_timerfd_create)(int clockid, int flags);
 #endif
+       ssize_t (*libc_write)(int fd, const void *buf, size_t count);
        ssize_t (*libc_writev)(int fd, const struct iovec *iov, int iovcnt);
 };
 
@@ -837,6 +838,13 @@
 }
 #endif
 
+static ssize_t libc_write(int fd, const void *buf, size_t count)
+{
+       swrap_load_lib_function(SWRAP_LIBC, write);
+
+       return swrap.fns.libc_write(fd, buf, count);
+}
+
 static ssize_t libc_writev(int fd, const struct iovec *iov, int iovcnt)
 {
        swrap_load_lib_function(SWRAP_LIBSOCKET, writev);
@@ -1847,11 +1855,10 @@
                alloc_len = SWRAP_PACKET_MIN_ALLOC;
        }
 
-       base = (uint8_t *)malloc(alloc_len);
+       base = (uint8_t *)calloc(1, alloc_len);
        if (base == NULL) {
                return NULL;
        }
-       memset(base, 0x0, alloc_len);
 
        buf = base;
 
@@ -2376,6 +2383,9 @@
        case AF_INET6:
 #endif
                break;
+#ifdef AF_NETLINK
+       case AF_NETLINK:
+#endif /* AF_NETLINK */
        case AF_UNIX:
                return libc_socket(family, type, protocol);
        default:
@@ -2427,8 +2437,7 @@
                swrap_remove_stale(fd);
        }
 
-       si = (struct socket_info *)malloc(sizeof(struct socket_info));
-       memset(si, 0, sizeof(struct socket_info));
+       si = (struct socket_info *)calloc(1, sizeof(struct socket_info));
        if (si == NULL) {
                errno = ENOMEM;
                return -1;
@@ -2622,8 +2631,12 @@
                return ret;
        }
 
-       child_si = (struct socket_info *)malloc(sizeof(struct socket_info));
-       memset(child_si, 0, sizeof(struct socket_info));
+       child_si = (struct socket_info *)calloc(1, sizeof(struct socket_info));
+       if (child_si == NULL) {
+               close(fd);
+               errno = ENOMEM;
+               return -1;
+       }
 
        child_fi = (struct socket_info_fd *)calloc(1, sizeof(struct 
socket_info_fd));
        if (child_fi == NULL) {
@@ -3146,6 +3159,14 @@
                return libc_listen(s, backlog);
        }
 
+       if (si->bound == 0) {
+               ret = swrap_auto_bind(s, si, si->family);
+               if (ret == -1) {
+                       errno = EADDRINUSE;
+                       return ret;
+               }
+       }
+
        ret = libc_listen(s, backlog);
 
        return ret;
@@ -3850,7 +3871,8 @@
                msg->msg_iovlen = i;
                if (msg->msg_iovlen == 0) {
                        *tmp_iov = msg->msg_iov[0];
-                       tmp_iov->iov_len = MIN(tmp_iov->iov_len, (size_t)mtu);
+                       tmp_iov->iov_len = MIN((size_t)tmp_iov->iov_len,
+                                              (size_t)mtu);
                        msg->msg_iov = tmp_iov;
                        msg->msg_iovlen = 1;
                }
@@ -4067,7 +4089,8 @@
                msg->msg_iovlen = i;
                if (msg->msg_iovlen == 0) {
                        *tmp_iov = msg->msg_iov[0];
-                       tmp_iov->iov_len = MIN(tmp_iov->iov_len, (size_t)mtu);
+                       tmp_iov->iov_len = MIN((size_t)tmp_iov->iov_len,
+                                              (size_t)mtu);
                        msg->msg_iov = tmp_iov;
                        msg->msg_iovlen = 1;
                }
@@ -4542,6 +4565,58 @@
 }
 
 /****************************************************************************
+ *   WRITE
+ ***************************************************************************/
+
+static ssize_t swrap_write(int s, const void *buf, size_t len)
+{
+       struct msghdr msg;
+       struct iovec tmp;
+       struct sockaddr_un un_addr;
+       ssize_t ret;
+       int rc;
+       struct socket_info *si;
+
+       si = find_socket_info(s);
+       if (si == NULL) {
+               return libc_write(s, buf, len);
+       }
+
+       tmp.iov_base = discard_const_p(char, buf);
+       tmp.iov_len = len;
+
+       ZERO_STRUCT(msg);
+       msg.msg_name = NULL;           /* optional address */
+       msg.msg_namelen = 0;           /* size of address */
+       msg.msg_iov = &tmp;            /* scatter/gather array */
+       msg.msg_iovlen = 1;            /* # elements in msg_iov */
+#if HAVE_STRUCT_MSGHDR_MSG_CONTROL
+       msg.msg_control = NULL;        /* ancillary data, see below */
+       msg.msg_controllen = 0;        /* ancillary data buffer len */
+       msg.msg_flags = 0;             /* flags on received message */
+#endif
+
+       rc = swrap_sendmsg_before(s, si, &msg, &tmp, &un_addr, NULL, NULL, 
NULL);
+       if (rc < 0) {
+               return -1;
+       }
+
+       buf = msg.msg_iov[0].iov_base;
+       len = msg.msg_iov[0].iov_len;
+
+       ret = libc_write(s, buf, len);
+
+       swrap_sendmsg_after(s, si, &msg, NULL, ret);
+
+       return ret;
+}
+
+ssize_t write(int s, const void *buf, size_t len)
+{
+       return swrap_write(s, buf, len);
+}
+
+/****************************************************************************
  *   SEND
  ***************************************************************************/
 
@@ -4601,6 +4676,9 @@
        struct swrap_address from_addr = {
                .sa_socklen = sizeof(struct sockaddr_un),
        };
+       struct swrap_address convert_addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
        struct socket_info *si;
        struct msghdr msg;
        struct iovec tmp;
@@ -4659,6 +4737,13 @@
        }
 #endif
 
+       /*
+        * We convert the unix address to a IP address so we need a buffer
+        * which can store the address in case of SOCK_DGRAM, see below.
+        */
+       msg.msg_name = &convert_addr.sa;
+       msg.msg_namelen = convert_addr.sa_socklen;
+
        rc = swrap_recvmsg_after(s,
                                 si,
                                 &msg,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/tests/CMakeLists.txt 
new/socket_wrapper-1.1.6/tests/CMakeLists.txt
--- old/socket_wrapper-1.1.5/tests/CMakeLists.txt       2015-10-14 
11:38:17.000000000 +0200
+++ new/socket_wrapper-1.1.6/tests/CMakeLists.txt       2016-02-25 
18:00:59.000000000 +0100
@@ -20,6 +20,7 @@
 
 set(SWRAP_TESTS
     test_ioctl
+    test_tcp_listen
     test_echo_tcp_socket
     test_echo_tcp_connect
     test_echo_tcp_bind
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/tests/test_echo_tcp_bind.c 
new/socket_wrapper-1.1.6/tests/test_echo_tcp_bind.c
--- old/socket_wrapper-1.1.5/tests/test_echo_tcp_bind.c 2015-10-14 
11:38:17.000000000 +0200
+++ new/socket_wrapper-1.1.6/tests/test_echo_tcp_bind.c 2015-10-19 
10:43:01.000000000 +0200
@@ -365,7 +365,7 @@
                       &addr.sa.in.sin_addr);
        assert_int_equal(rc, 1);
 
-       rc = connect(s, &addr.sa.in, addr.sa_socklen);
+       rc = connect(s, &addr.sa.s, addr.sa_socklen);
        assert_return_code(rc, errno);
 
        close(s);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/tests/test_tcp_listen.c 
new/socket_wrapper-1.1.6/tests/test_tcp_listen.c
--- old/socket_wrapper-1.1.5/tests/test_tcp_listen.c    1970-01-01 
01:00:00.000000000 +0100
+++ new/socket_wrapper-1.1.6/tests/test_tcp_listen.c    2016-02-25 
18:00:59.000000000 +0100
@@ -0,0 +1,115 @@
+#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 <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#ifdef HAVE_RPC_RPC_H
+#include <rpc/rpc.h>
+#endif
+
+static int setup(void **state)
+{
+       torture_setup_socket_dir(state);
+
+       return 0;
+}
+
+static int teardown(void **state)
+{
+       torture_teardown_socket_dir(state);
+
+       return 0;
+}
+
+static void test_listen_unbound_ipv4(void **state)
+{
+       struct torture_address addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       int rc;
+       int s1;
+       int s2;
+
+       (void) state; /* unused */
+
+       s1 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+       assert_return_code(s1, errno);
+
+       rc = listen(s1, SOMAXCONN);
+       assert_return_code(rc, errno);
+
+       rc = getsockname(s1, &addr.sa.s, &addr.sa_socklen);
+       assert_return_code(rc, errno);
+       assert_int_equal(addr.sa_socklen, sizeof(struct sockaddr_in));
+       assert_in_range(ntohs(addr.sa.in.sin_port), 1024, 65535);
+
+       s2 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+       assert_return_code(s2, errno);
+
+       rc = connect(s2, &addr.sa.s, addr.sa_socklen);
+       assert_return_code(rc, errno);
+
+       close(s1);
+       close(s2);
+}
+
+#ifdef HAVE_IPV6
+static void test_listen_unbound_ipv6(void **state)
+{
+       struct torture_address addr = {
+               .sa_socklen = sizeof(struct sockaddr_storage),
+       };
+       int rc;
+       int s1;
+       int s2;
+
+       (void) state; /* unused */
+
+       s1 = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+       assert_return_code(s1, errno);
+
+       rc = listen(s1, SOMAXCONN);
+       assert_return_code(rc, errno);
+
+       rc = getsockname(s1, &addr.sa.s, &addr.sa_socklen);
+       assert_return_code(rc, errno);
+       assert_int_equal(addr.sa_socklen, sizeof(struct sockaddr_in6));
+       assert_in_range(ntohs(addr.sa.in6.sin6_port), 1024, 65535);
+
+       s2 = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+       assert_return_code(s2, errno);
+
+       rc = connect(s2, &addr.sa.s, addr.sa_socklen);
+       assert_return_code(rc, errno);
+
+       close(s1);
+       close(s2);
+}
+#endif /* HAVE_IPV6 */
+
+int main(void) {
+       int rc;
+
+       const struct CMUnitTest tcp_listen_tests[] = {
+               cmocka_unit_test(test_listen_unbound_ipv4),
+#ifdef HAVE_IPV6
+               cmocka_unit_test(test_listen_unbound_ipv6),
+#endif /* HAVE_IPV6 */
+       };
+
+       rc = cmocka_run_group_tests(tcp_listen_tests, setup, teardown);
+
+       return rc;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/tests/torture.c 
new/socket_wrapper-1.1.6/tests/torture.c
--- old/socket_wrapper-1.1.5/tests/torture.c    2015-09-30 14:31:28.000000000 
+0200
+++ new/socket_wrapper-1.1.6/tests/torture.c    2015-10-27 14:58:14.000000000 
+0100
@@ -55,7 +55,7 @@
 #define TORTURE_ECHO_SRV_IPV6 "fd00::5357:5f0a"
 #define TORTURE_ECHO_SRV_PORT 7
 
-#define TORTURE_SOCKET_DIR "/tmp/test_socket_wrapper_XXXXXX"
+#define TORTURE_SOCKET_DIR "/tmp/w_XXXXXX"
 #define TORTURE_ECHO_SRV_PIDFILE "echo_srv.pid"
 #define TORTURE_PCAP_FILE "socket_trace.pcap"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.1.5/tests/valgrind.supp 
new/socket_wrapper-1.1.6/tests/valgrind.supp
--- old/socket_wrapper-1.1.5/tests/valgrind.supp        1970-01-01 
01:00:00.000000000 +0100
+++ new/socket_wrapper-1.1.6/tests/valgrind.supp        2015-10-28 
11:03:23.000000000 +0100
@@ -0,0 +1,16 @@
+### GLIBC
+{
+   glibc_dlopen_alloc
+   Memcheck:Leak
+   fun:calloc
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.2.5
+}
+
+{
+   glibc_dlclose_alloc
+   Memcheck:Leak
+   fun:calloc
+   fun:_dlerror_run
+   fun:dlclose
+}


Reply via email to