diff options
author | Brent Cook <bcook@openbsd.org> | 2016-06-30 20:00:29 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2016-06-30 20:00:29 -0500 |
commit | ccf66c469faf898161109d8277d669e4841df319 (patch) | |
tree | 5975e84c4ec635959b4044e5db9b584b3b45558b /patches/netcat.c.patch | |
parent | ec4c98718de35311541f3e5aca3a9c5e7101d62f (diff) | |
download | portable-ccf66c469faf898161109d8277d669e4841df319.tar.gz portable-ccf66c469faf898161109d8277d669e4841df319.tar.bz2 portable-ccf66c469faf898161109d8277d669e4841df319.zip |
update for netcat changes
Diffstat (limited to 'patches/netcat.c.patch')
-rw-r--r-- | patches/netcat.c.patch | 90 |
1 files changed, 15 insertions, 75 deletions
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index cf10de5..19154a3 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch | |||
@@ -1,5 +1,5 @@ | |||
1 | --- apps/nc/netcat.c.orig Wed Jun 29 21:28:27 2016 | 1 | --- apps/nc/netcat.c.orig Thu Jun 30 19:56:49 2016 |
2 | +++ apps/nc/netcat.c Thu Jun 30 08:16:42 2016 | 2 | +++ apps/nc/netcat.c Thu Jun 30 19:59:09 2016 |
3 | @@ -65,7 +65,9 @@ | 3 | @@ -65,7 +65,9 @@ |
4 | #define POLL_NETIN 2 | 4 | #define POLL_NETIN 2 |
5 | #define POLL_STDOUT 3 | 5 | #define POLL_STDOUT 3 |
@@ -131,7 +131,7 @@ | |||
131 | 131 | ||
132 | set_common_sockopts(s, res0->ai_family); | 132 | set_common_sockopts(s, res0->ai_family); |
133 | 133 | ||
134 | @@ -1401,29 +1426,28 @@ | 134 | @@ -1401,11 +1426,13 @@ |
135 | { | 135 | { |
136 | int x = 1; | 136 | int x = 1; |
137 | 137 | ||
@@ -145,86 +145,26 @@ | |||
145 | if (Dflag) { | 145 | if (Dflag) { |
146 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, | 146 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, |
147 | &x, sizeof(x)) == -1) | 147 | &x, sizeof(x)) == -1) |
148 | err(1, NULL); | 148 | @@ -1442,13 +1469,17 @@ |
149 | } | ||
150 | if (Tflag != -1) { | ||
151 | - int proto, option; | ||
152 | - | ||
153 | - if (af == AF_INET6) { | ||
154 | - proto = IPPROTO_IPV6; | ||
155 | - option = IPV6_TCLASS; | ||
156 | - } else { | ||
157 | - proto = IPPROTO_IP; | ||
158 | - option = IP_TOS; | ||
159 | - } | ||
160 | - | ||
161 | - if (setsockopt(s, proto, option, &Tflag, sizeof(Tflag)) == -1) | ||
162 | + if (af == AF_INET && setsockopt(s, IPPROTO_IP, | ||
163 | + IP_TOS, &Tflag, sizeof(Tflag)) == -1) | ||
164 | err(1, "set IP ToS"); | ||
165 | + | ||
166 | +#ifdef IPV6_TCLASS | ||
167 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | ||
168 | + IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1) | ||
169 | + err(1, "set IPv6 traffic class"); | ||
170 | +#endif | ||
171 | } | ||
172 | if (Iflag) { | ||
173 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, | ||
174 | @@ -1435,29 +1459,30 @@ | ||
175 | &Oflag, sizeof(Oflag)) == -1) | ||
176 | err(1, "set TCP send buffer size"); | ||
177 | } | 149 | } |
178 | - if (ttl != -1 || minttl != -1) { | 150 | |
179 | - int proto, in_ttl_opt, out_ttl_opt; | 151 | if (minttl != -1) { |
180 | - switch (af) { | ||
181 | - case AF_INET: | ||
182 | - proto = IPPROTO_IP; | ||
183 | - in_ttl_opt = IP_MINTTL; | ||
184 | - out_ttl_opt = IP_TTL; | ||
185 | - break; | ||
186 | - case AF_INET6: | ||
187 | - proto = IPPROTO_IPV6; | ||
188 | - in_ttl_opt = IPV6_MINHOPCOUNT; | ||
189 | - out_ttl_opt = IPV6_UNICAST_HOPS; | ||
190 | - break; | ||
191 | - default: | ||
192 | - errx(1, "unknown address family: %d", af); | ||
193 | - } | ||
194 | - if (minttl != -1 && setsockopt(s, proto, in_ttl_opt, | ||
195 | - &minttl, sizeof(minttl))) | ||
196 | - err(1, "setsockopt minttl"); | ||
197 | - if (ttl != -1 && setsockopt(s, proto, out_ttl_opt, | ||
198 | - &ttl, sizeof(ttl))) | ||
199 | - err(1, "setsockopt ttl"); | ||
200 | + | ||
201 | + if (ttl != -1) { | ||
202 | + if (af == AF_INET && setsockopt(s, IPPROTO_IP, | ||
203 | + IP_TTL, &ttl, sizeof(ttl))) | ||
204 | + err(1, "set IP TTL"); | ||
205 | + | ||
206 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | ||
207 | + IPV6_UNICAST_HOPS, &ttl, sizeof(ttl))) | ||
208 | + err(1, "set IPv6 unicast hops"); | ||
209 | } | ||
210 | + | ||
211 | + if (minttl != -1) { | ||
212 | +#ifdef IP_MINTTL | 152 | +#ifdef IP_MINTTL |
213 | + if (af == AF_INET && setsockopt(s, IPPROTO_IP, | 153 | if (af == AF_INET && setsockopt(s, IPPROTO_IP, |
214 | + IP_MINTTL, &minttl, sizeof(minttl)) == -1) | 154 | IP_MINTTL, &minttl, sizeof(minttl))) |
215 | + err(1, "set IP min TTL"); | 155 | err(1, "set IP min TTL"); |
216 | +#endif | 156 | +#endif |
217 | + | 157 | |
158 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | ||
218 | +#ifdef IPV6_MINHOPCOUNT | 159 | +#ifdef IPV6_MINHOPCOUNT |
219 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 160 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
220 | + IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)) == -1) | 161 | IPV6_MINHOPCOUNT, &minttl, sizeof(minttl))) |
221 | + err(1, "set IPv6 min hop count"); | 162 | err(1, "set IPv6 min hop count"); |
222 | +#endif | 163 | +#endif |
223 | + } | 164 | } |
224 | } | 165 | } |
225 | 166 | ||
226 | int | 167 | @@ -1605,14 +1636,22 @@ |
227 | @@ -1613,14 +1638,22 @@ | ||
228 | \t-P proxyuser\tUsername for proxy authentication\n\ | 168 | \t-P proxyuser\tUsername for proxy authentication\n\ |
229 | \t-p port\t Specify local port for remote connects\n\ | 169 | \t-p port\t Specify local port for remote connects\n\ |
230 | \t-R CAfile CA bundle\n\ | 170 | \t-R CAfile CA bundle\n\ |