[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/03: test_client_put_stop: check 'net.inet.tcp.blackho
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/03: test_client_put_stop: check 'net.inet.tcp.blackhole' value |
Date: |
Mon, 06 Dec 2021 19:41:16 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 43938f8d41e3f1680afcfb30d1f2cbf95a0e0483
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Dec 6 21:26:06 2021 +0300
test_client_put_stop: check 'net.inet.tcp.blackhole' value
---
configure.ac | 13 +++++++++++
src/microhttpd/test_client_put_stop.c | 41 ++++++++++++++++++++++++++---------
2 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index cbe609d4..84e513e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1918,6 +1918,19 @@ MHD_CHECK_FUNC([[sysctl]], [[
]], [[int mib[2] = {CTL_KERN, KERN_MAXPROC}; if (sysctl(mib, 2, NULL, NULL,
NULL, 0)) return 1;]]
)
+MHD_CHECK_FUNC([[sysctlbyname]], [[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+ ]], [[sysctlbyname("test", NULL, NULL, NULL, 0);]]
+)
+
MHD_CHECK_FUNC([[usleep]], [[#include <unistd.h>]], [[usleep(100000);]])
MHD_CHECK_FUNC([[nanosleep]], [[#include <time.h>]], [[struct timespec ts2,
ts1 = {0, 0}; nanosleep(&ts1, &ts2);]])
diff --git a/src/microhttpd/test_client_put_stop.c
b/src/microhttpd/test_client_put_stop.c
index 342583e0..e2689ec3 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -269,17 +269,29 @@ static unsigned int rate_limiter; /**< Maximum number
of checks per second */
static void
test_global_init (void)
{
- if (MHD_YES != MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE))
+ rate_limiter = 0;
+#ifdef HAVE_SYSCTLBYNAME
+ if (use_hard_close)
{
-#if defined(HAVE_SIGNAL_H) && defined(SIGPIPE)
- if (SIG_ERR == signal (SIGPIPE, SIG_IGN))
- externalErrorExitDesc ("Error suppressing SIGPIPE signal");
-#else /* ! HAVE_SIGNAL_H || ! SIGPIPE */
- fprintf (stderr, "Cannot suppress SIGPIPE signal.\n");
- /* exit (77); */
-#endif
+ int blck_hl;
+ size_t blck_hl_size = sizeof (blck_hl);
+ if (0 == sysctlbyname ("net.inet.tcp.blackhole", &blck_hl, &blck_hl_size,
+ NULL, 0))
+ {
+ if (2 <= blck_hl)
+ {
+ fprintf (stderr, "'sysctl net.inet.tcp.blackhole = %d', test is "
+ "unreliable with this system setting, skipping.\n", blck_hl);
+ exit (77);
+ }
+ }
+ else
+ {
+ if (ENOENT != errno)
+ externalErrorExitDesc ("Cannot get 'net.inet.tcp.blackhole' value");
+ }
}
- rate_limiter = 0;
+#endif
#if defined(HAVE_SYSCTL) && defined(CTL_NET) && defined(PF_INET) && \
defined(IPPROTO_ICMP) && defined(ICMPCTL_ICMPLIM)
if (use_hard_close)
@@ -329,7 +341,16 @@ test_global_init (void)
}
#endif /* HAVE_SYSCTL && CTL_NET && PF_INET &&
IPPROTO_ICMP && ICMPCTL_ICMPLIM */
-
+ if (MHD_YES != MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE))
+ {
+#if defined(HAVE_SIGNAL_H) && defined(SIGPIPE)
+ if (SIG_ERR == signal (SIGPIPE, SIG_IGN))
+ externalErrorExitDesc ("Error suppressing SIGPIPE signal");
+#else /* ! HAVE_SIGNAL_H || ! SIGPIPE */
+ fprintf (stderr, "Cannot suppress SIGPIPE signal.\n");
+ /* exit (77); */
+#endif
+ }
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.