Hello community,

here is the log from the commit of package socket_wrapper for openSUSE:Factory 
checked in at 2020-03-25 23:43:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/socket_wrapper (Old)
 and      /work/SRC/openSUSE:Factory/.socket_wrapper.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "socket_wrapper"

Wed Mar 25 23:43:28 2020 rev:14 rq:787796 version:1.2.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/socket_wrapper/socket_wrapper.changes    
2019-11-06 13:48:10.787640878 +0100
+++ /work/SRC/openSUSE:Factory/.socket_wrapper.new.3160/socket_wrapper.changes  
2020-03-25 23:43:38.240000293 +0100
@@ -1,0 +2,6 @@
+Tue Mar 24 13:12:47 UTC 2020 - Andreas Schneider <[email protected]>
+
+- Update to version 1.2.4
+  * https://gitlab.com/cwrap/socket_wrapper/-/blob/master/CHANGELOG
+
+-------------------------------------------------------------------

Old:
----
  socket_wrapper-1.2.3.tar.gz
  socket_wrapper-1.2.3.tar.gz.asc

New:
----
  socket_wrapper-1.2.4.tar.gz
  socket_wrapper-1.2.4.tar.gz.asc

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

Other differences:
------------------
++++++ socket_wrapper.spec ++++++
--- /var/tmp/diff_new_pack.7druOM/_old  2020-03-25 23:43:39.012000545 +0100
+++ /var/tmp/diff_new_pack.7druOM/_new  2020-03-25 23:43:39.012000545 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package socket_wrapper
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,12 +24,12 @@
 ############################# NOTE ##################################
 
 Name:           socket_wrapper
-Version:        1.2.3
+Version:        1.2.4
 Release:        0
 Summary:        A library passing all socket communications trough Unix sockets
 License:        BSD-3-Clause
 Group:          Development/Libraries/C and C++
-Url:            https://cwrap.org/
+URL:            https://cwrap.org/
 #
 Source0:        https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz
 Source1:        https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz.asc
@@ -77,7 +77,7 @@
 
 %files
 %defattr(-,root,root)
-%doc AUTHORS README.md ChangeLog
+%doc AUTHORS README.md CHANGELOG
 %license LICENSE
 %{_libdir}/libsocket_wrapper.so.*
 %{_mandir}/man1/socket_wrapper.1*

++++++ socket_wrapper-1.2.3.tar.gz -> socket_wrapper-1.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/.clang_complete 
new/socket_wrapper-1.2.4/.clang_complete
--- old/socket_wrapper-1.2.3/.clang_complete    2014-01-20 18:58:53.000000000 
+0100
+++ new/socket_wrapper-1.2.4/.clang_complete    1970-01-01 01:00:00.000000000 
+0100
@@ -1,2 +0,0 @@
--Iobj
--DHAVE_IPV6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/.gitlab-ci.yml 
new/socket_wrapper-1.2.4/.gitlab-ci.yml
--- old/socket_wrapper-1.2.3/.gitlab-ci.yml     2019-02-20 17:24:34.000000000 
+0100
+++ new/socket_wrapper-1.2.4/.gitlab-ci.yml     2020-03-24 13:29:41.000000000 
+0100
@@ -4,7 +4,7 @@
   CENTOS7_BUILD: buildenv-centos7
   TUMBLEWEED_BUILD: buildenv-tumbleweed
   MINGW_BUILD: buildenv-mingw
-  DEBIAN_CROSS_BUILD: buildenv-debian-cross
+  UBUNTU_BUILD: buildenv-ubuntu
 
 centos7/x86_64:
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
@@ -123,36 +123,13 @@
   only:
   - branches@cwrap/socket_wrapper
   - branches@cryptomilk/socket_wrapper
+  - branches@metze/socket_wrapper
   artifacts:
     expire_in: 1 week
     when: on_failure
     paths:
       - obj/
 
-.Debian.cross.template: &Debian_cross_template
-  stage: test
-  image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_CROSS_BUILD
-  script:
-  - build=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
-  - host="${CI_JOB_NAME#*.cross.}"
-  - mkdir -p obj && cd obj && cmake
-    -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-Debian-mips.cmake
-    -DCMAKE_BUILD_TYPE=RelWithDebInfo
-    -DUNIT_TESTING=ON .. && make -j$(nproc) &&
-    ctest --output-on-failure
-  tags:
-  - shared
-  except:
-  - tags
-  artifacts:
-    expire_in: 1 week
-    when: on_failure
-    paths:
-      - obj/
-
-Debian.cross.mips-linux-gnu:
-  <<: *Debian_cross_template
-
 tumbleweed/x86_64/gcc:
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
   script:
@@ -241,6 +218,24 @@
     make -j$(nproc) && ctest --output-on-failure
   tags:
   - shared
+  except:
+  - tags
+  artifacts:
+    expire_in: 1 week
+    when: on_failure
+    paths:
+      - obj/
+
+ubuntu/x86_64:
+  image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$UBUNTU_BUILD
+  script:
+  - mkdir -p obj && cd obj && cmake
+    -DCMAKE_BUILD_TYPE=RelWithDebInfo
+    -DPICKY_DEVELOPER=ON
+    -DUNIT_TESTING=ON .. &&
+    make -j$(nproc) && ctest --output-on-failure
+  tags:
+  - shared
   except:
   - tags
   artifacts:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/CHANGELOG 
new/socket_wrapper-1.2.4/CHANGELOG
--- old/socket_wrapper-1.2.3/CHANGELOG  1970-01-01 01:00:00.000000000 +0100
+++ new/socket_wrapper-1.2.4/CHANGELOG  2020-03-24 13:29:41.000000000 +0100
@@ -0,0 +1,95 @@
+ChangeLog
+==========
+
+version 1.2.4 (released 2020-03-24)
+  * Added support for 10.53.57.0 network
+  * Added _{socket,close,connect,...} symbols on FreeBSD
+  * Fixed interaction with resolv_wrapper on FreeBSD
+
+version 1.2.3 (released 2019-03-21)
+  * Fixed missing NULL check for socket_wrapper_dir()
+  * Fixes building in Samba source tree
+
+version 1.2.2 (released 2019-03-21)
+  * Added environment variable to disable deep binding
+  * Fixed installation of socket_wrapper
+  * Fixed several small bugs
+
+version 1.2.1 (released 2018-11-14)
+  * Removed error message to fix applications doing stupid things
+
+version 1.2.0 (released 2018-11-13)
+  * Added threading support
+  * Moved to modern cmake
+  * Several smaller bugfixes
+
+version 1.1.9 (released 2017-12-04)
+  * Fixed thread - signal deadlock issue
+
+version 1.1.8 (released 2017-10-13)
+  * Added support for openat()
+  * Added support for open64() and fopen64()
+  * Always enabled logging support
+  * Increased maximum for wrapped interfaces to 64
+  * Improved fd duplication code
+  * Fixed strict-aliasing issues
+  * Fixed some use after free issues
+  * Fixed issues on ppc64le
+
+version 1.1.7 (released 2016-05-20)
+  * Added support for accept4()
+  * Added support for OpenBSD
+  * Fixed sendto() with UDP and a connected socket
+  * Fixed AF_RAWLINK sockets
+
+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
+
+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.
+  * Fixed the library loading code.
+
+version 1.1.2 (released 2014-10-01)
+  * Added support for fnctl(F_DUPFD).
+  * Added support for glibc 2.20.90.
+
+version 1.1.1 (released 2014-06-05)
+  * Disable incomplete address in use check in bind().
+
+version 1.1.0 (released 2014-06-02)
+  * Added support for IP_PKTINFO in recvmsg().
+  * Added support for IPV6_PKTINFO in recvmsg().
+  * Added support for IP_RECVDSTADDR in recvmsg() on BSD.
+  * Added support for more socket options in getsockopt().
+  * Added support for bindresvport().
+  * Fixed rebinding on connect().
+  * Fixed sockaddr buffer truncation in getsockname() and getpeername().
+  * Fixed special cases in bind().
+  * Fixed loading libc on some platforms.
+
+version 1.0.2 (released 2014-05-05)
+  * Fixed memory leaks
+  * Fixed calling open from libc.
+  * Fixed loading libc functions on some platforms.
+
+version 1.0.1 (released 2014-02-04)
+  * Added --libs to pkg-config.
+  * Added socket_wrapper-config.cmake
+  * Fixed a bug packaging the obj directory.
+
+version 1.0.0 (released 2014-02-02)
+  * Initial release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/CMakeLists.txt 
new/socket_wrapper-1.2.4/CMakeLists.txt
--- old/socket_wrapper-1.2.3/CMakeLists.txt     2019-03-21 14:41:58.000000000 
+0100
+++ new/socket_wrapper-1.2.4/CMakeLists.txt     2020-03-24 13:29:41.000000000 
+0100
@@ -11,20 +11,23 @@
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(socket_wrapper VERSION 1.2.3 LANGUAGES C)
+project(socket_wrapper VERSION 1.2.4 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
 
-# SOVERSION scheme: CURRENT.AGE.REVISION
+# SOVERSION scheme: MAJOR.MINOR.PATCH
 #   If there was an incompatible interface change:
-#     Increment CURRENT. Set AGE and REVISION to 0
+#     Increment MAJOR. Set MINOR and PATCH to 0
 #   If there was a compatible interface change:
-#     Increment AGE. Set REVISION to 0
+#     Increment MINOR. Set PATCH to 0
 #   If the source code was changed, but there were no interface changes:
-#     Increment REVISION.
-set(LIBRARY_VERSION "0.1.13")
-set(LIBRARY_SOVERSION "0")
+#     Increment PATCH.
+set(LIBRARY_VERSION_MAJOR 0)
+set(LIBRARY_VERSION_MINOR 1)
+set(LIBRARY_VERSION_PATCH 14)
+set(LIBRARY_VERSION 
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
+set(LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
 
 # add definitions
 include(DefinePlatformDefaults)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/ChangeLog 
new/socket_wrapper-1.2.4/ChangeLog
--- old/socket_wrapper-1.2.3/ChangeLog  2019-03-21 14:41:58.000000000 +0100
+++ new/socket_wrapper-1.2.4/ChangeLog  1970-01-01 01:00:00.000000000 +0100
@@ -1,90 +0,0 @@
-ChangeLog
-==========
-
-version 1.2.3 (released 2019-03-21)
-  * Fixed missing NULL check for socket_wrapper_dir()
-  * Fixes building in Samba source tree
-
-version 1.2.2 (released 2019-03-21)
-  * Added environment variable to disable deep binding
-  * Fixed installation of socket_wrapper
-  * Fixed several small bugs
-
-version 1.2.1 (released 2018-11-14)
-  * Removed error message to fix applications doing stupid things
-
-version 1.2.0 (released 2018-11-13)
-  * Added threading support
-  * Moved to modern cmake
-  * Several smaller bugfixes
-
-version 1.1.9 (released 2017-12-04)
-  * Fixed thread - signal deadlock issue
-
-version 1.1.8 (released 2017-10-13)
-  * Added support for openat()
-  * Added support for open64() and fopen64()
-  * Always enabled logging support
-  * Increased maximum for wrapped interfaces to 64
-  * Improved fd duplication code
-  * Fixed strict-aliasing issues
-  * Fixed some use after free issues
-  * Fixed issues on ppc64le
-
-version 1.1.7 (released 2016-05-20)
-  * Added support for accept4()
-  * Added support for OpenBSD
-  * Fixed sendto() with UDP and a connected socket
-  * Fixed AF_RAWLINK sockets
-
-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
-
-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.
-  * Fixed the library loading code.
-
-version 1.1.2 (released 2014-10-01)
-  * Added support for fnctl(F_DUPFD).
-  * Added support for glibc 2.20.90.
-
-version 1.1.1 (released 2014-06-05)
-  * Disable incomplete address in use check in bind().
-
-version 1.1.0 (released 2014-06-02)
-  * Added support for IP_PKTINFO in recvmsg().
-  * Added support for IPV6_PKTINFO in recvmsg().
-  * Added support for IP_RECVDSTADDR in recvmsg() on BSD.
-  * Added support for more socket options in getsockopt().
-  * Added support for bindresvport().
-  * Fixed rebinding on connect().
-  * Fixed sockaddr buffer truncation in getsockname() and getpeername().
-  * Fixed special cases in bind().
-  * Fixed loading libc on some platforms.
-
-version 1.0.2 (released 2014-05-05)
-  * Fixed memory leaks
-  * Fixed calling open from libc.
-  * Fixed loading libc functions on some platforms.
-
-version 1.0.1 (released 2014-02-04)
-  * Added --libs to pkg-config.
-  * Added socket_wrapper-config.cmake
-  * Fixed a bug packaging the obj directory.
-
-version 1.0.0 (released 2014-02-02)
-  * Initial release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/ConfigureChecks.cmake 
new/socket_wrapper-1.2.4/ConfigureChecks.cmake
--- old/socket_wrapper-1.2.3/ConfigureChecks.cmake      2019-02-20 
17:24:34.000000000 +0100
+++ new/socket_wrapper-1.2.4/ConfigureChecks.cmake      2020-03-24 
13:29:41.000000000 +0100
@@ -70,9 +70,9 @@
 check_function_exists(fopen64 HAVE_FOPEN64)
 check_function_exists(getprogname HAVE_GETPROGNAME)
 check_function_exists(getexecname HAVE_GETEXECNAME)
-
 check_function_exists(pledge HAVE_PLEDGE)
-
+check_function_exists(_socket HAVE__SOCKET)
+check_function_exists(_close HAVE__CLOSE)
 
 if (UNIX)
     find_library(DLFCN_LIBRARY dl)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/config.h.cmake 
new/socket_wrapper-1.2.4/config.h.cmake
--- old/socket_wrapper-1.2.3/config.h.cmake     2019-02-20 17:24:34.000000000 
+0100
+++ new/socket_wrapper-1.2.4/config.h.cmake     2020-03-24 13:29:41.000000000 
+0100
@@ -44,6 +44,8 @@
 #cmakedefine HAVE_GETPROGNAME 1
 #cmakedefine HAVE_GETEXECNAME 1
 #cmakedefine HAVE_PLEDGE 1
+#cmakedefine HAVE__SOCKET 1
+#cmakedefine HAVE__CLOSE 1
 
 #cmakedefine HAVE_ACCEPT_PSOCKLEN_T 1
 #cmakedefine HAVE_IOCTL_INT 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/doc/socket_wrapper.1 
new/socket_wrapper-1.2.4/doc/socket_wrapper.1
--- old/socket_wrapper-1.2.3/doc/socket_wrapper.1       2019-03-21 
08:43:11.000000000 +0100
+++ new/socket_wrapper-1.2.4/doc/socket_wrapper.1       2020-03-24 
13:29:41.000000000 +0100
@@ -75,9 +75,14 @@
 The user defines a directory where to put all the unix sockets using the 
environment variable "SOCKET_WRAPPER_DIR=/path/to/socket_dir"\&. When a server 
opens a port or a client wants to connect, socket_wrapper will translate IP 
addresses to a special socket_wrapper name and look for the relevant Unix 
socket in the SOCKET_WRAPPER_DIR\&.
 .RE
 .PP
+\fBSOCKET_WRAPPER_IPV4_NETWORK\fR
+.RS 4
+By default the loopback IPv4 network "127\&.0\&.0\&.0/8" and the 
"127\&.0\&.0\&.x" can be used\&. In order to make more realistic testing 
possible it is possible to use the "10\&.0\&.0\&.0/8" IPv4 network instead\&. 
But note within "10\&.0\&.0\&.0/8" only "10\&.53\&.57\&.<ID>" can be used, but 
the broadcast address is "10\&.255\&.255\&.255"\&. The following two value are 
allowed: SOCKET_WRAPPER_IPV4_NETWORK="127\&.0\&.0\&.0" (the default) and 
SOCKET_WRAPPER_IPV4_NETWORK="10\&.53\&.57\&.0"\&.
+.RE
+.PP
 \fBSOCKET_WRAPPER_DEFAULT_IFACE\fR
 .RS 4
-Additionally, the default interface to be used by an application is defined 
with "SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where <ID> is between 2 and 254\&. 
This is analogous to use the IPv4 addresses "127\&.0\&.0\&.<ID>" or IPv6 
addresses "fd00::5357:5f<IDx>" (where <IDx> is a hexadecimal presentation of 
<ID>)\&. You should always set the default interface\&. If you listen on 
INADDR_ANY then it will use the default interface to listen on\&.
+Additionally, the default interface to be used by an application is defined 
with "SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where the valid range for <ID> starts 
with 1 (the default) and ends with 64\&. This is analogous to use the IPv4 
addresses "127\&.0\&.0\&.<ID>"/"10\&.53\&.57\&.<ID>" or IPv6 addresses 
"fd00::5357:5f<IDx>" (where <IDx> is a hexadecimal presentation of <ID>)\&. You 
should always set the default interface\&. If you listen on INADDR_ANY then it 
will use the default interface to listen on\&.
 .RE
 .PP
 \fBSOCKET_WRAPPER_PCAP_FILE\fR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/doc/socket_wrapper.1.txt 
new/socket_wrapper-1.2.4/doc/socket_wrapper.1.txt
--- old/socket_wrapper-1.2.3/doc/socket_wrapper.1.txt   2019-03-21 
08:43:11.000000000 +0100
+++ new/socket_wrapper-1.2.4/doc/socket_wrapper.1.txt   2020-03-24 
13:29:41.000000000 +0100
@@ -36,14 +36,26 @@
 addresses to a special socket_wrapper name and look for the relevant Unix
 socket in the SOCKET_WRAPPER_DIR.
 
+*SOCKET_WRAPPER_IPV4_NETWORK*::
+
+By default the loopback IPv4 network "127.0.0.0/8" and the
+"127.0.0.x" can be used. In order to make more realistic testing
+possible it is possible to use the "10.0.0.0/8" IPv4 network instead.
+But note within "10.0.0.0/8" only "10.53.57.<ID>" can be used,
+but the broadcast address is "10.255.255.255".
+The following two value are allowed:
+SOCKET_WRAPPER_IPV4_NETWORK="127.0.0.0" (the default) and
+SOCKET_WRAPPER_IPV4_NETWORK="10.53.57.0".
+
 *SOCKET_WRAPPER_DEFAULT_IFACE*::
 
-Additionally, the default interface to be used by an application is defined
-with "SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where <ID> is between 2 and 254. This
-is analogous to use the IPv4 addresses "127.0.0.<ID>" or IPv6 addresses
-"fd00::5357:5f<IDx>" (where <IDx> is a hexadecimal presentation of <ID>). You
-should always set the default interface. If you listen on INADDR_ANY then it
-will use the default interface to listen on.
+Additionally, the default interface to be used by an application is defined 
with
+"SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where the valid range for <ID> starts with 
1
+(the default) and ends with 64. This is analogous to use the IPv4 addresses
+"127.0.0.<ID>"/"10.53.57.<ID>" or IPv6 addresses "fd00::5357:5f<IDx>" (where
+<IDx> is a hexadecimal presentation of <ID>). You should always set the default
+interface. If you listen on INADDR_ANY then it will use the default interface 
to
+listen on.
 
 *SOCKET_WRAPPER_PCAP_FILE*::
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/foo new/socket_wrapper-1.2.4/foo
--- old/socket_wrapper-1.2.3/foo        2018-09-06 17:56:35.000000000 +0200
+++ new/socket_wrapper-1.2.4/foo        1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
- src/socket_wrapper.c | 30 ++++++++++--------------------
- 1 file changed, 10 insertions(+), 20 deletions(-)
-
-diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
-index 0eff366..136b6d7 100644
---- a/src/socket_wrapper.c
-+++ b/src/socket_wrapper.c
-@@ -3193,26 +3193,6 @@ static int swrap_accept(int s,
- #endif
-       }
- 
--
--      /*
--       * prevent parent_si from being altered / closed
--       * while we read it
--       */
--      SWRAP_LOCK_SI(parent_si);
--
--      /*
--       * assume out sockaddr have the same size as the in parent
--       * socket family
--       */
--      in_addr.sa_socklen = socket_length(parent_si->family);
--      if (in_addr.sa_socklen <= 0) {
--              SWRAP_UNLOCK_SI(parent_si);
--              errno = EINVAL;
--              return -1;
--      }
--
--      SWRAP_UNLOCK_SI(parent_si);
--
- #ifdef HAVE_ACCEPT4
-       ret = libc_accept4(s, &un_addr.sa.s, &un_addr.sa_socklen, flags);
- #else
-@@ -3230,6 +3210,16 @@ static int swrap_accept(int s,
-       fd = ret;
- 
-       SWRAP_LOCK_SI(parent_si);
-+      /*
-+       * assume out sockaddr have the same size as the in parent
-+       * socket family
-+       */
-+      in_addr.sa_socklen = socket_length(parent_si->family);
-+      if (in_addr.sa_socklen <= 0) {
-+              SWRAP_UNLOCK_SI(parent_si);
-+              errno = EINVAL;
-+              return -1;
-+      }
- 
-       ret = sockaddr_convert_from_un(parent_si,
-                                      &un_addr.sa.un,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/src/socket_wrapper.c 
new/socket_wrapper-1.2.4/src/socket_wrapper.c
--- old/socket_wrapper-1.2.3/src/socket_wrapper.c       2019-03-21 
14:59:22.000000000 +0100
+++ new/socket_wrapper-1.2.4/src/socket_wrapper.c       2020-03-24 
13:29:41.000000000 +0100
@@ -1192,6 +1192,94 @@
  * SWRAP HELPER FUNCTIONS
  *********************************************************/
 
+/*
+ * We return 127.0.0.0 (default) or 10.53.57.0.
+ *
+ * This can be controlled by:
+ * SOCKET_WRAPPER_IPV4_NETWORK=127.0.0.0 (default)
+ * or
+ * SOCKET_WRAPPER_IPV4_NETWORK=10.53.57.0
+ */
+static in_addr_t swrap_ipv4_net(void)
+{
+       static int initialized;
+       static in_addr_t hv;
+       const char *net_str = NULL;
+       struct in_addr nv;
+       int ret;
+
+       if (initialized) {
+               return hv;
+       }
+       initialized = 1;
+
+       net_str = getenv("SOCKET_WRAPPER_IPV4_NETWORK");
+       if (net_str == NULL) {
+               net_str = "127.0.0.0";
+       }
+
+       ret = inet_pton(AF_INET, net_str, &nv);
+       if (ret <= 0) {
+               SWRAP_LOG(SWRAP_LOG_ERROR,
+                         "INVALID IPv4 Network [%s]\n",
+                         net_str);
+               abort();
+       }
+
+       hv = ntohl(nv.s_addr);
+
+       switch (hv) {
+       case 0x7f000000:
+               /* 127.0.0.0 */
+               break;
+       case 0x0a353900:
+               /* 10.53.57.0 */
+               break;
+       default:
+               SWRAP_LOG(SWRAP_LOG_ERROR,
+                         "INVALID IPv4 Network [%s][0x%x] should be "
+                         "127.0.0.0 or 10.53.57.0\n",
+                         net_str, (unsigned)hv);
+               abort();
+       }
+
+       return hv;
+}
+
+/*
+ * This returns 127.255.255.255 or 10.255.255.255
+ */
+static in_addr_t swrap_ipv4_bcast(void)
+{
+       in_addr_t hv;
+
+       hv = swrap_ipv4_net();
+       hv |= IN_CLASSA_HOST;
+
+       return hv;
+}
+
+/*
+ * This returns 127.0.0.${iface} or 10.53.57.${iface}
+ */
+static in_addr_t swrap_ipv4_iface(unsigned int iface)
+{
+       in_addr_t hv;
+
+       if (iface == 0 || iface > MAX_WRAPPED_INTERFACES) {
+               SWRAP_LOG(SWRAP_LOG_ERROR,
+                         "swrap_ipv4_iface(%u) invalid!\n",
+                         iface);
+               abort();
+               return -1;
+       }
+
+       hv = swrap_ipv4_net();
+       hv |= iface;
+
+       return hv;
+}
+
 #ifdef HAVE_IPV6
 /*
  * FD00::5357:5FXX
@@ -1442,6 +1530,12 @@
                return;
        }
 
+       /*
+        * Intialize the static cache early before
+        * any thread is able to start.
+        */
+       (void)swrap_ipv4_net();
+
        socket_wrapper_init_fds_idx();
 
        /* Needs to be called inside the sockets_mutex lock here. */
@@ -1536,6 +1630,9 @@
 
 static void set_socket_info_index(int fd, int idx)
 {
+       SWRAP_LOG(SWRAP_LOG_TRACE,
+                 "fd=%d idx=%d\n",
+                 fd, idx);
        socket_fds_idx[fd] = idx;
        /* This builtin issues a full memory barrier. */
        __sync_synchronize();
@@ -1543,6 +1640,9 @@
 
 static void reset_socket_info_index(int fd)
 {
+       SWRAP_LOG(SWRAP_LOG_TRACE,
+                 "fd=%d idx=%d\n",
+                 fd, -1);
        set_socket_info_index(fd, -1);
 }
 
@@ -1678,7 +1778,7 @@
 
                memset(in2, 0, sizeof(*in2));
                in2->sin_family = AF_INET;
-               in2->sin_addr.s_addr = htonl((127<<24) | iface);
+               in2->sin_addr.s_addr = htonl(swrap_ipv4_iface(iface));
                in2->sin_port = htons(prt);
 
                *len = sizeof(*in2);
@@ -1731,6 +1831,8 @@
                char u_type = '\0';
                char b_type = '\0';
                char a_type = '\0';
+               const unsigned int sw_net_addr = swrap_ipv4_net();
+               const unsigned int sw_bcast_addr = swrap_ipv4_bcast();
 
                switch (si->type) {
                case SOCK_STREAM:
@@ -1753,13 +1855,18 @@
                        is_bcast = 2;
                        type = a_type;
                        iface = socket_wrapper_default_iface();
-               } else if (b_type && addr == 0x7FFFFFFF) {
-                       /* 127.255.255.255 only udp */
+               } else if (b_type && addr == sw_bcast_addr) {
+                       /*
+                        * 127.255.255.255
+                        * or
+                        * 10.255.255.255
+                        * only udp
+                        */
                        is_bcast = 1;
                        type = b_type;
                        iface = socket_wrapper_default_iface();
-               } else if ((addr & 0xFFFFFF00) == 0x7F000000) {
-                       /* 127.0.0.X */
+               } else if ((addr & 0xFFFFFF00) == sw_net_addr) {
+                       /* 127.0.0.X or 10.53.57.X */
                        is_bcast = 0;
                        type = u_type;
                        iface = (addr & 0x000000FF);
@@ -1863,6 +1970,8 @@
                char d_type = '\0';
                char b_type = '\0';
                char a_type = '\0';
+               const unsigned int sw_net_addr = swrap_ipv4_net();
+               const unsigned int sw_bcast_addr = swrap_ipv4_bcast();
 
                prt = ntohs(in->sin_port);
 
@@ -1893,12 +2002,12 @@
                        is_bcast = 2;
                        type = a_type;
                        iface = socket_wrapper_default_iface();
-               } else if (b_type && addr == 0x7FFFFFFF) {
+               } else if (b_type && addr == sw_bcast_addr) {
                        /* 127.255.255.255 only udp */
                        is_bcast = 1;
                        type = b_type;
                        iface = socket_wrapper_default_iface();
-               } else if ((addr & 0xFFFFFF00) == 0x7F000000) {
+               } else if ((addr & 0xFFFFFF00) == sw_net_addr) {
                        /* 127.0.0.X */
                        is_bcast = 0;
                        type = u_type;
@@ -1916,8 +2025,7 @@
                        ZERO_STRUCT(bind_in);
                        bind_in.sin_family = in->sin_family;
                        bind_in.sin_port = in->sin_port;
-                       bind_in.sin_addr.s_addr = htonl(0x7F000000 | iface);
-
+                       bind_in.sin_addr.s_addr = 
htonl(swrap_ipv4_iface(iface));
                        si->bindname.sa_socklen = blen;
                        memcpy(&si->bindname.sa.in, &bind_in, blen);
                }
@@ -2455,6 +2563,7 @@
        if (strncmp(s, "./", 2) == 0) {
                s += 2;
        }
+       SWRAP_LOG(SWRAP_LOG_TRACE, "SOCKET_WRAPPER_PCAP_FILE: %s", s);
        return s;
 }
 
@@ -3140,7 +3249,15 @@
        case AF_PACKET:
 #endif /* AF_PACKET */
        case AF_UNIX:
-               return libc_socket(family, type, protocol);
+               fd = libc_socket(family, type, protocol);
+               if (fd != -1) {
+                       /* Check if we have a stale fd and remove it */
+                       swrap_remove_stale(fd);
+                       SWRAP_LOG(SWRAP_LOG_TRACE,
+                                 "Unix socket fd=%d",
+                                 fd);
+               }
+               return fd;
        default:
                errno = EAFNOSUPPORT;
                return -1;
@@ -3384,6 +3501,9 @@
 
        fd = ret;
 
+       /* Check if we have a stale fd and remove it */
+       swrap_remove_stale(fd);
+
        SWRAP_LOCK_SI(parent_si);
 
        ret = sockaddr_convert_from_un(parent_si,
@@ -3536,8 +3656,8 @@
 
                memset(&in, 0, sizeof(in));
                in.sin_family = AF_INET;
-               in.sin_addr.s_addr = htonl(127<<24 |
-                                          socket_wrapper_default_iface());
+               in.sin_addr.s_addr = htonl(swrap_ipv4_iface(
+                                          socket_wrapper_default_iface()));
 
                si->myname = (struct swrap_address) {
                        .sa_socklen = sizeof(in),
@@ -3666,6 +3786,9 @@
        }
 
        if (si->family != serv_addr->sa_family) {
+               SWRAP_LOG(SWRAP_LOG_ERROR,
+                         "called for fd=%d (family=%d) called with invalid 
family=%d\n",
+                         s, si->family, serv_addr->sa_family);
                errno = EINVAL;
                ret = -1;
                goto done;
@@ -6076,6 +6199,7 @@
                return libc_close(fd);
        }
 
+       SWRAP_LOG(SWRAP_LOG_TRACE, "Close wrapper for fd=%d", fd);
        reset_socket_info_index(fd);
 
        si = swrap_get_socket_info(si_index);
@@ -6410,3 +6534,54 @@
                dlclose(swrap.libc.socket_handle);
        }
 }
+
+#if defined(HAVE__SOCKET) && defined(HAVE__CLOSE)
+/*
+ * On FreeBSD 12 (and maybe other platforms)
+ * system libraries like libresolv prefix there
+ * syscalls with '_' in order to always use
+ * the symbols from libc.
+ *
+ * In the interaction with resolv_wrapper,
+ * we need to inject socket wrapper into libresolv,
+ * which means we need to private all socket
+ * related syscalls also with the '_' prefix.
+ *
+ * This is tested in Samba's 'make test',
+ * there we noticed that providing '_read'
+ * and '_open' would cause errors, which
+ * means we skip '_read', '_write' and
+ * all non socket related calls without
+ * further analyzing the problem.
+ */
+#define SWRAP_SYMBOL_ALIAS(__sym, __aliassym) \
+       extern typeof(__sym) __aliassym __attribute__ ((alias(#__sym)))
+
+#ifdef HAVE_ACCEPT4
+SWRAP_SYMBOL_ALIAS(accept4, _accept4);
+#endif
+SWRAP_SYMBOL_ALIAS(accept, _accept);
+SWRAP_SYMBOL_ALIAS(bind, _bind);
+SWRAP_SYMBOL_ALIAS(close, _close);
+SWRAP_SYMBOL_ALIAS(connect, _connect);
+SWRAP_SYMBOL_ALIAS(dup, _dup);
+SWRAP_SYMBOL_ALIAS(dup2, _dup2);
+SWRAP_SYMBOL_ALIAS(fcntl, _fcntl);
+SWRAP_SYMBOL_ALIAS(getpeername, _getpeername);
+SWRAP_SYMBOL_ALIAS(getsockname, _getsockname);
+SWRAP_SYMBOL_ALIAS(getsockopt, _getsockopt);
+SWRAP_SYMBOL_ALIAS(ioctl, _ioctl);
+SWRAP_SYMBOL_ALIAS(listen, _listen);
+SWRAP_SYMBOL_ALIAS(readv, _readv);
+SWRAP_SYMBOL_ALIAS(recv, _recv);
+SWRAP_SYMBOL_ALIAS(recvfrom, _recvfrom);
+SWRAP_SYMBOL_ALIAS(recvmsg, _recvmsg);
+SWRAP_SYMBOL_ALIAS(send, _send);
+SWRAP_SYMBOL_ALIAS(sendmsg, _sendmsg);
+SWRAP_SYMBOL_ALIAS(sendto, _sendto);
+SWRAP_SYMBOL_ALIAS(setsockopt, _setsockopt);
+SWRAP_SYMBOL_ALIAS(socket, _socket);
+SWRAP_SYMBOL_ALIAS(socketpair, _socketpair);
+SWRAP_SYMBOL_ALIAS(writev, _writev);
+
+#endif /* SOCKET_WRAPPER_EXPORT_UNDERSCORE_SYMBOLS */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/socket_wrapper-1.2.3/tests/echo_srv.c 
new/socket_wrapper-1.2.4/tests/echo_srv.c
--- old/socket_wrapper-1.2.3/tests/echo_srv.c   2019-03-21 08:43:11.000000000 
+0100
+++ new/socket_wrapper-1.2.4/tests/echo_srv.c   2020-03-24 13:29:41.000000000 
+0100
@@ -920,7 +920,9 @@
     }
 
     echo(sock, &opts);
-    close(sock);
+    if (sock >= 0) {
+        close(sock);
+    }
 
     if (opts.daemon && opts.pidfile != NULL) {
         unlink(opts.pidfile);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/socket_wrapper-1.2.3/tests/test_fork_thread_deadlock.c 
new/socket_wrapper-1.2.4/tests/test_fork_thread_deadlock.c
--- old/socket_wrapper-1.2.3/tests/test_fork_thread_deadlock.c  2018-11-19 
17:17:13.000000000 +0100
+++ new/socket_wrapper-1.2.4/tests/test_fork_thread_deadlock.c  2020-03-24 
13:29:41.000000000 +0100
@@ -45,8 +45,10 @@
 
 static void test_swrap_signal_handler(int signum)
 {
+       ssize_t w;
        fprintf(stderr, "PID: %u, SIGNUM: %d\n", (unsigned int)getpid(), 
signum);
-       write(1, "DEADLOCK?\n", 10);
+       w = write(1, "DEADLOCK?\n", 10);
+       fprintf(stderr, "WRITE: %zu\n", w);
 }
 
 static void test_swrap_fork_pthread(void **state)



Reply via email to