-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
httping: fix build on < 10.11 #25943
Open
barracuda156
wants to merge
1
commit into
macports:master
Choose a base branch
from
barracuda156:httping
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+126
−4
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
PortSystem 1.0 | ||
PortGroup cmake 1.1 | ||
PortGroup github 1.0 | ||
PortGroup openssl 1.0 | ||
|
||
github.setup folkertvanheusden HTTPing 3.6 v | ||
revision 0 | ||
|
@@ -27,15 +28,21 @@ long_description Give it an url, and it will show you how long it takes to \ | |
|
||
github.tarball_from archive | ||
|
||
depends_lib port:fftw-3 \ | ||
port:gettext \ | ||
port:ncurses \ | ||
path:lib/libssl.dylib:openssl | ||
depends_build-append \ | ||
port:gettext | ||
|
||
depends_lib-append port:fftw-3 \ | ||
port:gettext-runtime \ | ||
port:ncurses | ||
|
||
installs_libs no | ||
|
||
patchfiles patch-tcp.c.diff | ||
|
||
# https://trac.macports.org/ticket/70146 | ||
# https://github.com/folkertvanheusden/HTTPing/pull/22 | ||
patchfiles-append 0001-Define-NO_TFO-on-macOS-10.11.patch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's wait and see what the outcome is from the discussion with upstream as we don't want to carry patched like this. |
||
|
||
configure.args -DCMAKE_EXE_LINKER_FLAGS="-lintl" | ||
|
||
destroot { | ||
|
115 changes: 115 additions & 0 deletions
115
net/httping/files/0001-Define-NO_TFO-on-macOS-10.11.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
From c5acacdf6503797e47772f00c744bb03476be2c4 Mon Sep 17 00:00:00 2001 | ||
From: Sergey Fedorov <[email protected]> | ||
Date: Fri, 27 Sep 2024 00:36:42 +0800 | ||
Subject: [PATCH] Define NO_TFO on macOS < 10.11 | ||
|
||
--- | ||
gen.h | 7 +++++++ | ||
help.c | 4 ++++ | ||
main.c | 8 +++++++- | ||
tcp.c | 7 +++++++ | ||
4 files changed, 25 insertions(+), 1 deletion(-) | ||
|
||
diff --git gen.h gen.h | ||
index 68a0e9b..9fe7a07 100644 | ||
--- gen.h | ||
+++ gen.h | ||
@@ -34,6 +34,13 @@ | ||
#define gettext(x) (x) | ||
#endif | ||
|
||
+#ifdef __APPLE__ | ||
+#include <AvailabilityMacros.h> | ||
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 | ||
+#define NO_TFO | ||
+#endif | ||
+#endif | ||
+ | ||
typedef struct | ||
{ | ||
double cur, min, avg, max, sd, med; | ||
diff --git help.c help.c | ||
index 3eddb55..3d507f0 100644 | ||
--- help.c | ||
+++ help.c | ||
@@ -71,7 +71,9 @@ void version(void) | ||
#endif | ||
#endif | ||
|
||
+#ifndef NO_TFO | ||
fprintf(stderr, gettext(" * TFO (TCP fast open) support included (-F)\n")); | ||
+#endif | ||
fprintf(stderr, gettext("\n")); | ||
} | ||
|
||
@@ -207,7 +209,9 @@ void usage(const char *me) | ||
format_help("-r", "--resolve-once", gettext("resolve hostname only once (useful when pinging roundrobin DNS: also takes the first DNS lookup out of the loop so that the first measurement is also correct)")); | ||
format_help("-W", NULL, gettext("do not abort the program if resolving failed: keep retrying")); | ||
format_help("-y x", "--bind-to", gettext("bind to an ip-address (and thus interface) with an optional port")); | ||
+#ifndef NO_TFO | ||
format_help("-F", "--tcp-fast-open", gettext("\"TCP fast open\" (TFO), reduces the latency of TCP connects")); | ||
+#endif | ||
#ifdef linux | ||
format_help(NULL, "--priority", gettext("set priority of packets")); | ||
#endif | ||
diff --git main.c main.c | ||
index 4b44b26..39ab05d 100644 | ||
--- main.c | ||
+++ main.c | ||
@@ -1396,7 +1396,11 @@ int main(int argc, char *argv[]) | ||
break; | ||
|
||
case 'F': | ||
+#ifdef NO_TFO | ||
+ fprintf(stderr, gettext("Warning: TCP TFO is not supported. Disabling.\n")); | ||
+#else | ||
use_tfo = 1; | ||
+#endif | ||
break; | ||
|
||
case 22: | ||
@@ -2157,7 +2161,7 @@ persistent_loop: | ||
#if defined(linux) || defined(__FreeBSD__) | ||
if (getsockopt(fd, IPPROTO_TCP, TCP_INFO, &info, &info_len) == 0) | ||
{ | ||
-#ifdef TCPI_OPT_SYN_DATA | ||
+#if defined(TCPI_OPT_SYN_DATA) && !defined(NO_TFO) | ||
if (info.tcpi_options & TCPI_OPT_SYN_DATA) | ||
tfo_success = 1; | ||
#endif | ||
@@ -2345,8 +2349,10 @@ persistent_loop: | ||
#endif | ||
} | ||
|
||
+#ifndef NO_TFO | ||
if (tfo_success) | ||
str_add(&line, " F"); | ||
+#endif | ||
|
||
#if HAVE_NCURSES | ||
if (ncurses_mode) | ||
diff --git tcp.c tcp.c | ||
index 9f95c39..11df814 100644 | ||
--- tcp.c | ||
+++ tcp.c | ||
@@ -159,6 +159,12 @@ int connect_to(int fd, struct addrinfo *ai, double timeout, char *tfo, char *msg | ||
to.tv_usec = (long)(timeout * 1000.0) % 1000000; | ||
|
||
/* connect to peer */ | ||
+#ifdef NO_TFO | ||
+ (void)tfo; | ||
+ (void)msg; | ||
+ (void)msg_len; | ||
+ (void)msg_accepted; | ||
+#else | ||
if (tfo && *tfo) | ||
{ | ||
#if defined(__FreeBSD__) | ||
@@ -182,6 +188,7 @@ int connect_to(int fd, struct addrinfo *ai, double timeout, char *tfo, char *msg | ||
} | ||
} | ||
else | ||
+#endif | ||
{ | ||
int rc = -1; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are changing the
depends_lib
dependencies so that requires to increase therevision