aboutsummaryrefslogtreecommitdiff
path: root/patches/netcat.c.patch
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2018-11-16 04:40:18 -0600
committerBrent Cook <bcook@openbsd.org>2018-11-16 04:40:18 -0600
commit0829e7f654e321c16d1f82b769f3c2299b160cb8 (patch)
tree7348c1b494813a84bcc7326f9b4063048c06317b /patches/netcat.c.patch
parent3c1371061a3cb1fa5cb96383f0c4fbf756f8d4e0 (diff)
downloadportable-0829e7f654e321c16d1f82b769f3c2299b160cb8.tar.gz
portable-0829e7f654e321c16d1f82b769f3c2299b160cb8.tar.bz2
portable-0829e7f654e321c16d1f82b769f3c2299b160cb8.zip
rebase netcat.c.patch
Diffstat (limited to 'patches/netcat.c.patch')
-rw-r--r--patches/netcat.c.patch48
1 files changed, 24 insertions, 24 deletions
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch
index 07205ec..2bb5bc9 100644
--- a/patches/netcat.c.patch
+++ b/patches/netcat.c.patch
@@ -1,5 +1,5 @@
1--- apps/nc/netcat.c.orig 2018-11-07 17:01:38.000000000 -0600 1--- apps/nc/netcat.c.orig Fri Nov 9 12:02:51 2018
2+++ apps/nc/netcat.c 2018-11-07 17:37:57.000000000 -0600 2+++ apps/nc/netcat.c Fri Nov 16 04:38:56 2018
3@@ -92,9 +92,13 @@ 3@@ -92,9 +92,13 @@
4 int Dflag; /* sodebug */ 4 int Dflag; /* sodebug */
5 int Iflag; /* TCP receive buffer size */ 5 int Iflag; /* TCP receive buffer size */
@@ -11,7 +11,7 @@
11+#ifdef SO_RTABLE 11+#ifdef SO_RTABLE
12 int rtableid = -1; 12 int rtableid = -1;
13+#endif 13+#endif
14 14
15 int usetls; /* use TLS */ 15 int usetls; /* use TLS */
16 char *Cflag; /* Public cert file */ 16 char *Cflag; /* Public cert file */
17@@ -266,12 +270,14 @@ 17@@ -266,12 +270,14 @@
@@ -44,16 +44,16 @@
44@@ -344,9 +352,11 @@ 44@@ -344,9 +352,11 @@
45 argc -= optind; 45 argc -= optind;
46 argv += optind; 46 argv += optind;
47 47
48+#ifdef SO_RTABLE 48+#ifdef SO_RTABLE
49 if (rtableid >= 0) 49 if (rtableid >= 0)
50 if (setrtable(rtableid) == -1) 50 if (setrtable(rtableid) == -1)
51 err(1, "setrtable"); 51 err(1, "setrtable");
52+#endif 52+#endif
53 53
54 /* Cruft to make sure options are clean, and used properly. */ 54 /* Cruft to make sure options are clean, and used properly. */
55 if (argv[0] && !argv[1] && family == AF_UNIX) { 55 if (argv[0] && !argv[1] && family == AF_UNIX) {
56@@ -909,7 +919,10 @@ 56@@ -916,7 +926,10 @@
57 remote_connect(const char *host, const char *port, struct addrinfo hints) 57 remote_connect(const char *host, const char *port, struct addrinfo hints)
58 { 58 {
59 struct addrinfo *res, *res0; 59 struct addrinfo *res, *res0;
@@ -62,13 +62,13 @@
62+#ifdef SO_BINDANY 62+#ifdef SO_BINDANY
63+ int on = 1; 63+ int on = 1;
64+#endif 64+#endif
65 65
66 if ((error = getaddrinfo(host, port, &hints, &res0))) 66 if ((error = getaddrinfo(host, port, &hints, &res0)))
67 errx(1, "getaddrinfo for host \"%s\" port %s: %s", host, 67 errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
68@@ -924,8 +937,10 @@ 68@@ -931,8 +944,10 @@
69 if (sflag || pflag) { 69 if (sflag || pflag) {
70 struct addrinfo ahints, *ares; 70 struct addrinfo ahints, *ares;
71 71
72+#ifdef SO_BINDANY 72+#ifdef SO_BINDANY
73 /* try SO_BINDANY, but don't insist */ 73 /* try SO_BINDANY, but don't insist */
74 setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)); 74 setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
@@ -76,7 +76,7 @@
76 memset(&ahints, 0, sizeof(struct addrinfo)); 76 memset(&ahints, 0, sizeof(struct addrinfo));
77 ahints.ai_family = res->ai_family; 77 ahints.ai_family = res->ai_family;
78 ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; 78 ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
79@@ -996,7 +1011,10 @@ 79@@ -1003,7 +1018,10 @@
80 local_listen(const char *host, const char *port, struct addrinfo hints) 80 local_listen(const char *host, const char *port, struct addrinfo hints)
81 { 81 {
82 struct addrinfo *res, *res0; 82 struct addrinfo *res, *res0;
@@ -86,24 +86,24 @@
86+ int ret, x = 1; 86+ int ret, x = 1;
87+#endif 87+#endif
88 int error; 88 int error;
89 89
90 /* Allow nodename to be null. */ 90 /* Allow nodename to be null. */
91@@ -1017,9 +1035,11 @@ 91@@ -1024,9 +1042,11 @@
92 res->ai_protocol)) < 0) 92 res->ai_protocol)) < 0)
93 continue; 93 continue;
94 94
95+#ifdef SO_REUSEPORT 95+#ifdef SO_REUSEPORT
96 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); 96 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
97 if (ret == -1) 97 if (ret == -1)
98 err(1, NULL); 98 err(1, NULL);
99+#endif 99+#endif
100 100
101 set_common_sockopts(s, res->ai_family); 101 set_common_sockopts(s, res->ai_family);
102 102
103@@ -1475,11 +1495,13 @@ 103@@ -1492,11 +1512,13 @@
104 { 104 {
105 int x = 1; 105 int x = 1;
106 106
107+#ifdef TCP_MD5SIG 107+#ifdef TCP_MD5SIG
108 if (Sflag) { 108 if (Sflag) {
109 if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG, 109 if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
@@ -114,10 +114,10 @@
114 if (Dflag) { 114 if (Dflag) {
115 if (setsockopt(s, SOL_SOCKET, SO_DEBUG, 115 if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
116 &x, sizeof(x)) == -1) 116 &x, sizeof(x)) == -1)
117@@ -1490,9 +1512,16 @@ 117@@ -1507,9 +1529,16 @@
118 IP_TOS, &Tflag, sizeof(Tflag)) == -1) 118 IP_TOS, &Tflag, sizeof(Tflag)) == -1)
119 err(1, "set IP ToS"); 119 err(1, "set IP ToS");
120 120
121+#ifdef IPV6_TCLASS 121+#ifdef IPV6_TCLASS
122 else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, 122 else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
123 IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1) 123 IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
@@ -131,16 +131,16 @@
131 } 131 }
132 if (Iflag) { 132 if (Iflag) {
133 if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, 133 if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
134@@ -1516,13 +1545,17 @@ 134@@ -1533,13 +1562,17 @@
135 } 135 }
136 136
137 if (minttl != -1) { 137 if (minttl != -1) {
138+#ifdef IP_MINTTL 138+#ifdef IP_MINTTL
139 if (af == AF_INET && setsockopt(s, IPPROTO_IP, 139 if (af == AF_INET && setsockopt(s, IPPROTO_IP,
140 IP_MINTTL, &minttl, sizeof(minttl))) 140 IP_MINTTL, &minttl, sizeof(minttl)))
141 err(1, "set IP min TTL"); 141 err(1, "set IP min TTL");
142+#endif 142+#endif
143 143
144- else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, 144- else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
145+#ifdef IPV6_MINHOPCOUNT 145+#ifdef IPV6_MINHOPCOUNT
146+ if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, 146+ if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
@@ -149,8 +149,8 @@
149+#endif 149+#endif
150 } 150 }
151 } 151 }
152 152
153@@ -1748,14 +1781,22 @@ 153@@ -1761,14 +1794,22 @@
154 \t-P proxyuser\tUsername for proxy authentication\n\ 154 \t-P proxyuser\tUsername for proxy authentication\n\
155 \t-p port\t Specify local port for remote connects\n\ 155 \t-p port\t Specify local port for remote connects\n\
156 \t-R CAfile CA bundle\n\ 156 \t-R CAfile CA bundle\n\