gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (7eb3139e -> d4b9fc7e)


From: gnunet
Subject: [libmicrohttpd] branch master updated (7eb3139e -> d4b9fc7e)
Date: Wed, 07 Oct 2020 10:31:16 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 7eb3139e memorypool: added sanity checks
     new 8a1ae1ca memorypool: more sanity checks
     new b47b1c94 configure: fixed typo, fixed detection of memory pagesize
     new d4b9fc7e configure: check whether IPv6 could be used for testing

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                     | 11 +++--
 configure.ac                  | 95 ++++++++++++++++++++++++++++++++++++++++++-
 src/microhttpd/memorypool.c   |  3 ++
 src/microhttpd/test_options.c |  6 +--
 4 files changed, 108 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e4727a55..9e85001c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed 07 Oct 2020 11:07:00 MSK
+    W32 default target version changed to Vista, XP is still supported.
+    Minor fixes and additional asserts for memorypool.
+    IPv6 tests are not used if IPv6 is disabled at run-time. -EG
+
 Sun 27 Sep 2020 10:08:03 PM CEST
     Fixed incorrect triggering of epoll edge polling for
     "upgraded" TLS connections.  Fixed a few cases where
@@ -16,7 +21,7 @@ Thu 24 Sep 2020 16:55:00 MSK
     the registries.
     Fixed portability of test_upgrade_large.
     Minor testsuite fixes.
-    Restored parallel build of libmicrohttpd (except tests).
+    Restored parallel build of libmicrohttpd (except tests). -EG
 
 Fri 11 Sep 2020 10:08:22 PM CEST
     Fix crash problem in PostProcessor reported by MD. -CG
@@ -205,11 +210,11 @@ Mon May 20 15:39:35 MSK 2019
        Compiler warning fixes. -EG/CG
        Fixed example for non-64bits platforms. -EG
 
-Web May 15 23:51:49 MSK 2019
+Wed May 15 23:51:49 MSK 2019
        Optimized and improved processing speed by using precalculated and
        already calculated lengths of strings. -EG
 
-Web May 15 14:54:00 MSK 2019
+Wed May 15 14:54:00 MSK 2019
        Fixed build from source on GNU Hurd. -EG
 
 Mon May  6 11:58:00 MSK 2019
diff --git a/configure.ac b/configure.ac
index ca62015a..d8d12277 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1415,7 +1415,7 @@ have_inet6=no
 ])
 AC_MSG_RESULT($have_inet6)
 
-MHD_CHECK_FUNC([[sysconf]], [[#include <unitstd.h>]], [[long a = sysconf(0); 
if (a) return 1;]])
+MHD_CHECK_FUNC([[sysconf]], [[#include <unistd.h>]], [[long a = sysconf(0); if 
(a) return 1;]])
 
 HIDDEN_VISIBILITY_CFLAGS=""
 AS_CASE(["$host"],
@@ -2129,6 +2129,99 @@ AC_CACHE_CHECK([[for calloc()]], 
[[mhd_cv_have_func_calloc]],
 AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]],
   [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable 
`calloc' function.])])
 
+# Some systems have IPv6 disabled in kernel at run-time
+AS_IF([[test "x${have_inet6}" = "xyes" && test "x${cross_compiling}" = "xno"]],
+ [
+   AC_CACHE_CHECK([whether IPv6 could be used for 
testing],[mhd_cv_ipv6_for_testing],
+     [
+       AC_RUN_IFELSE(
+         [
+           AC_LANG_SOURCE([[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+static void zr_mem(void *ptr, socklen_t size)
+{ char *mem = ptr; while(size--) {mem[0] = 0; mem++;} }
+
+int main(void)
+{
+  int ret = 30;
+  struct sockaddr_in6 sa;
+#if !defined(_WIN32) || defined(__CYGWIN__)
+  int sckt;
+  const int invld_sckt = -1;
+#else
+  SOCKET sckt;
+  const SOCKET invld_sckt = INVALID_SOCKET;
+  WSADATA wsa_data;
+
+  WSAStartup(MAKEWORD(2, 2), &wsa_data);
+#endif
+  zr_mem(&sa, sizeof(sa));
+  sa.sin6_family = AF_INET6;
+  sa.sin6_port = 0;
+  sa.sin6_addr = in6addr_loopback;
+#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
+  sa.sin6_len = sizeof(sa);
+#endif
+  sckt = socket (PF_INET6, SOCK_STREAM, 0);
+  if (invld_sckt != sckt)
+  {
+    if (0 == bind (sckt, (struct sockaddr *)&sa, sizeof(sa)))
+    {
+      if (0 == listen (sckt, 1))
+        ret = 0;
+      else
+        ret = 1; /* listen() failed */
+    } else ret = 2; /* bind() failed */
+#if !defined(_WIN32) || defined(__CYGWIN__)
+    close (sckt);
+#else
+    closesocket (sckt);
+#endif
+  } else ret = 3; /* socket() failed */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  WSACleanup();
+#endif
+  return ret;
+}
+           ]])
+         ], [[mhd_cv_ipv6_for_testing="yes"]], 
[[mhd_cv_ipv6_for_testing="no"]], [[mhd_cv_ipv6_for_testing="no"]]
+       )
+     ]
+   )
+ ]
+)
+AS_VAR_IF([mhd_cv_ipv6_for_testing],["yes"],
+       [AC_DEFINE([[USE_IPV6_TESTING]], [[1]], [Define to 1 if your kernel 
supports IPv6 and IPv6 is enabled and useful for testing.])]
+)
+
+
 # Check for fork() and waitpid(). They are used for tests.
 AC_MSG_CHECKING([[for fork()]])
 mhd_have_fork_waitpid='no'
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 4d619464..a979c64a 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -98,6 +98,7 @@ MHD_init_mem_pools_ (void)
 #else
   MHD_sys_page_size_ = MHD_DEF_PAGE_SIZE_;
 #endif /* _WIN32 */
+  mhd_assert (0 == (MHD_sys_page_size_ % ALIGN_SIZE));
 }
 
 
@@ -147,6 +148,7 @@ MHD_pool_create (size_t max)
   struct MemoryPool *pool;
   size_t alloc_size;
 
+  mhd_assert (max > 0);
   pool = malloc (sizeof (struct MemoryPool));
   if (NULL == pool)
     return NULL;
@@ -195,6 +197,7 @@ MHD_pool_create (size_t max)
     pool->is_mmap = true;
   }
 #endif /* _WIN32 || MAP_ANONYMOUS */
+  mhd_assert (0 == (((uintptr_t) pool->memory) % ALIGN_SIZE));
   pool->pos = 0;
   pool->end = alloc_size;
   pool->size = alloc_size;
diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c
index 9685837e..575b6a2b 100644
--- a/src/microhttpd/test_options.c
+++ b/src/microhttpd/test_options.c
@@ -84,7 +84,7 @@ test_ip_addr_option ()
 {
   struct MHD_Daemon *d;
   struct sockaddr_in daemon_ip_addr;
-#if HAVE_INET6
+#if HAVE_INET6 && defined (USE_IPV6_TESTING)
   struct sockaddr_in6 daemon_ip_addr6;
 #endif
 
@@ -93,7 +93,7 @@ test_ip_addr_option ()
   daemon_ip_addr.sin_port = 0;
   daemon_ip_addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
 
-#if HAVE_INET6
+#if HAVE_INET6 && defined (USE_IPV6_TESTING)
   memset (&daemon_ip_addr6, 0, sizeof (struct sockaddr_in6));
   daemon_ip_addr6.sin6_family = AF_INET6;
   daemon_ip_addr6.sin6_port = 0;
@@ -109,7 +109,7 @@ test_ip_addr_option ()
 
   MHD_stop_daemon (d);
 
-#if HAVE_INET6
+#if HAVE_INET6 && defined (USE_IPV6_TESTING)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 0,
                         NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR,
                         &daemon_ip_addr6, MHD_OPTION_END);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]