diff options
author | Brent Cook <bcook@openbsd.org> | 2015-09-13 18:57:29 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2015-09-13 18:57:29 -0500 |
commit | 696ba18c6ab02ded424aa4d87712064eba82f804 (patch) | |
tree | 0054cc4606c8f81c382518cd435db5941c7f9434 | |
parent | 8c90be2a29053ac613dfe0c11a423da16c7c4520 (diff) | |
download | portable-696ba18c6ab02ded424aa4d87712064eba82f804.tar.gz portable-696ba18c6ab02ded424aa4d87712064eba82f804.tar.bz2 portable-696ba18c6ab02ded424aa4d87712064eba82f804.zip |
fixup windows and older linux builds
-rw-r--r-- | include/Makefile.am | 1 | ||||
-rw-r--r-- | include/compat/sys/socket.h | 10 | ||||
-rw-r--r-- | patches/netcat.c.patch | 14 |
3 files changed, 21 insertions, 4 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 929ff7d..24a83cf 100644 --- a/include/Makefile.am +++ b/include/Makefile.am | |||
@@ -31,6 +31,7 @@ noinst_HEADERS += compat/sys/ioctl.h | |||
31 | noinst_HEADERS += compat/sys/mman.h | 31 | noinst_HEADERS += compat/sys/mman.h |
32 | noinst_HEADERS += compat/sys/param.h | 32 | noinst_HEADERS += compat/sys/param.h |
33 | noinst_HEADERS += compat/sys/select.h | 33 | noinst_HEADERS += compat/sys/select.h |
34 | noinst_HEADERS += compat/sys/socket.h | ||
34 | noinst_HEADERS += compat/sys/stat.h | 35 | noinst_HEADERS += compat/sys/stat.h |
35 | noinst_HEADERS += compat/sys/time.h | 36 | noinst_HEADERS += compat/sys/time.h |
36 | noinst_HEADERS += compat/sys/types.h | 37 | noinst_HEADERS += compat/sys/types.h |
diff --git a/include/compat/sys/socket.h b/include/compat/sys/socket.h new file mode 100644 index 0000000..17e84f1 --- /dev/null +++ b/include/compat/sys/socket.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/socket.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <sys/socket.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index c5206f6..1c6565f 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch | |||
@@ -1,5 +1,5 @@ | |||
1 | --- apps/nc/netcat.c.orig Sun Sep 13 08:12:39 2015 | 1 | --- apps/nc/netcat.c.orig Sun Sep 13 08:12:39 2015 |
2 | +++ apps/nc/netcat.c Sun Sep 13 16:39:51 2015 | 2 | +++ apps/nc/netcat.c Sun Sep 13 18:56:27 2015 |
3 | @@ -98,9 +98,13 @@ | 3 | @@ -98,9 +98,13 @@ |
4 | int Dflag; /* sodebug */ | 4 | int Dflag; /* sodebug */ |
5 | int Iflag; /* TCP receive buffer size */ | 5 | int Iflag; /* TCP receive buffer size */ |
@@ -83,7 +83,7 @@ | |||
83 | memset(&ahints, 0, sizeof(struct addrinfo)); | 83 | memset(&ahints, 0, sizeof(struct addrinfo)); |
84 | ahints.ai_family = res0->ai_family; | 84 | ahints.ai_family = res0->ai_family; |
85 | ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; | 85 | ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; |
86 | @@ -887,9 +902,11 @@ | 86 | @@ -887,13 +902,17 @@ |
87 | res0->ai_protocol)) < 0) | 87 | res0->ai_protocol)) < 0) |
88 | continue; | 88 | continue; |
89 | 89 | ||
@@ -93,9 +93,15 @@ | |||
93 | err(1, "setsockopt SO_RTABLE"); | 93 | err(1, "setsockopt SO_RTABLE"); |
94 | +#endif | 94 | +#endif |
95 | 95 | ||
96 | +#ifdef SO_REUSEPORT | ||
96 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); | 97 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); |
97 | if (ret == -1) | 98 | if (ret == -1) |
98 | @@ -1337,11 +1354,13 @@ | 99 | err(1, NULL); |
100 | +#endif | ||
101 | |||
102 | set_common_sockopts(s, res0->ai_family); | ||
103 | |||
104 | @@ -1337,11 +1356,13 @@ | ||
99 | { | 105 | { |
100 | int x = 1; | 106 | int x = 1; |
101 | 107 | ||
@@ -109,7 +115,7 @@ | |||
109 | if (Dflag) { | 115 | if (Dflag) { |
110 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, | 116 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, |
111 | &x, sizeof(x)) == -1) | 117 | &x, sizeof(x)) == -1) |
112 | @@ -1516,15 +1535,19 @@ | 118 | @@ -1516,15 +1537,19 @@ |
113 | \t-P proxyuser\tUsername for proxy authentication\n\ | 119 | \t-P proxyuser\tUsername for proxy authentication\n\ |
114 | \t-p port\t Specify local port for remote connects\n\ | 120 | \t-p port\t Specify local port for remote connects\n\ |
115 | \t-R CAfile CA bundle\n\ | 121 | \t-R CAfile CA bundle\n\ |