]> The Tcpdump Group git mirrors - libpcap/commitdiff
Use the XPG 4.2 versions of the networking APIs in Solaris.
authorGuy Harris <[email protected]>
Fri, 17 Nov 2017 23:06:33 +0000 (15:06 -0800)
committerGuy Harris <[email protected]>
Fri, 17 Nov 2017 23:06:33 +0000 (15:06 -0800)
Those, unlike the default versions, comply with the Single UNIX
Specification, meaning they are able to detect truncation of datagrams
when received with recvmsg().

aclocal.m4
configure
configure.ac
ftmacros.h

index 4362d4ff8e3f061accea5b1a54bbb9dd931d3229..650604b500aa037682af5c7897efc41de4fba4c2 100644 (file)
@@ -1055,9 +1055,13 @@ dnl
 AC_DEFUN(AC_LBL_LIBRARY_NET, [
     # Most operating systems have gethostbyname() in the default searched
     # libraries (i.e. libc):
-    # Some OSes (eg. Solaris) place it in libnsl
+    # Some OSes (eg. Solaris) place it in libnsl, but in at least some
+    # versions of Solaris, there are alternate versions of these APIs
+    # in libxnet, and those versions conform to the Single UNIX
+    # Specification, meaning you can actually check for truncation
+    # of incoming datagrams in recvmsg(), so we prefer that.
     # Some strange OSes (SINIX) have it in libsocket:
-    AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)
+    AC_SEARCH_LIBS(gethostbyname, xnet nsl socket resolv)
     # Unfortunately libsocket sometimes depends on libnsl and
     # AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.
     if test "$ac_cv_search_gethostbyname" = "no"
index 8b9a8ea6a664deb3e9545f037595619ef6d880e1..5f9445fc9e8e2a112aa1ce3d6e0b24f170e9c505 100755 (executable)
--- a/configure
+++ b/configure
@@ -4789,7 +4789,11 @@ fi
 
     # Most operating systems have gethostbyname() in the default searched
     # libraries (i.e. libc):
-    # Some OSes (eg. Solaris) place it in libnsl
+    # Some OSes (eg. Solaris) place it in libnsl, but in at least some
+    # versions of Solaris, there are alternate versions of these APIs
+    # in libxnet, and those versions conform to the Single UNIX
+    # Specification, meaning you can actually check for truncation
+    # of incoming datagrams in recvmsg(), so we prefer that.
     # Some strange OSes (SINIX) have it in libsocket:
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
 $as_echo_n "checking for library containing gethostbyname... " >&6; }
@@ -4815,7 +4819,7 @@ return gethostbyname ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' nsl socket resolv; do
+for ac_lib in '' xnet nsl socket resolv; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -7235,6 +7239,7 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#      include "ftmacros.h"
 #      include <sys/socket.h>
 int
 main ()
@@ -7267,6 +7272,7 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#      include "ftmacros.h"
 #      include <sys/socket.h>
 int
 main ()
index 7f16399cf86c49c1f47c6330ca0925fa7b3e4da4..65daad890a4baae8d428cb0b7ded3622eee93bae 100644 (file)
@@ -1303,6 +1303,7 @@ yes)      AC_MSG_RESULT(yes)
        AC_MSG_CHECKING(if struct msghdr has a msg_control member)
        AC_CACHE_VAL(ac_cv_lbl_struct_msghdr_has_msg_control,
            AC_TRY_COMPILE([
+#      include "ftmacros.h"
 #      include <sys/socket.h>],
                [u_int i = sizeof(((struct msghdr *)0)->msg_control)],
                ac_cv_lbl_struct_msghdr_has_msg_control=yes,
@@ -1314,6 +1315,7 @@ yes)      AC_MSG_RESULT(yes)
        AC_MSG_CHECKING(if struct msghdr has a msg_flags member)
        AC_CACHE_VAL(ac_cv_lbl_struct_msghdr_has_msg_flags,
            AC_TRY_COMPILE([
+#      include "ftmacros.h"
 #      include <sys/socket.h>],
                [u_int i = sizeof(((struct msghdr *)0)->msg_flags)],
                ac_cv_lbl_struct_msghdr_has_msg_flags=yes,
index 19b9fb43c6eef5b9f496f802fd6473f7b5a49e37..8e3194934d8c2434f2ca5bf6a7ee9bf9d2c07600 100644 (file)
  */
 #if defined(sun) || defined(__sun)
   #define __EXTENSIONS__
+
+  /*
+   * We also need to define _XPG4_2 in order to get
+   * the Single UNIX Specification version of
+   * recvmsg().
+   */
+  #define _XPG4_2
 #elif defined(_hpux) || defined(hpux) || defined(__hpux)
   #define _REENTRANT
 #elif defined(__linux__) || defined(linux) || defined(__linux)