rebase netcat.c.patch
This commit is contained in:
parent
3c1371061a
commit
0829e7f654
@ -1,5 +1,5 @@
|
|||||||
--- apps/nc/netcat.c.orig 2018-11-07 17:01:38.000000000 -0600
|
--- apps/nc/netcat.c.orig Fri Nov 9 12:02:51 2018
|
||||||
+++ apps/nc/netcat.c 2018-11-07 17:37:57.000000000 -0600
|
+++ apps/nc/netcat.c Fri Nov 16 04:38:56 2018
|
||||||
@@ -92,9 +92,13 @@
|
@@ -92,9 +92,13 @@
|
||||||
int Dflag; /* sodebug */
|
int Dflag; /* sodebug */
|
||||||
int Iflag; /* TCP receive buffer size */
|
int Iflag; /* TCP receive buffer size */
|
||||||
@ -11,7 +11,7 @@
|
|||||||
+#ifdef SO_RTABLE
|
+#ifdef SO_RTABLE
|
||||||
int rtableid = -1;
|
int rtableid = -1;
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
int usetls; /* use TLS */
|
int usetls; /* use TLS */
|
||||||
char *Cflag; /* Public cert file */
|
char *Cflag; /* Public cert file */
|
||||||
@@ -266,12 +270,14 @@
|
@@ -266,12 +270,14 @@
|
||||||
@ -44,16 +44,16 @@
|
|||||||
@@ -344,9 +352,11 @@
|
@@ -344,9 +352,11 @@
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
+#ifdef SO_RTABLE
|
+#ifdef SO_RTABLE
|
||||||
if (rtableid >= 0)
|
if (rtableid >= 0)
|
||||||
if (setrtable(rtableid) == -1)
|
if (setrtable(rtableid) == -1)
|
||||||
err(1, "setrtable");
|
err(1, "setrtable");
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
/* Cruft to make sure options are clean, and used properly. */
|
/* Cruft to make sure options are clean, and used properly. */
|
||||||
if (argv[0] && !argv[1] && family == AF_UNIX) {
|
if (argv[0] && !argv[1] && family == AF_UNIX) {
|
||||||
@@ -909,7 +919,10 @@
|
@@ -916,7 +926,10 @@
|
||||||
remote_connect(const char *host, const char *port, struct addrinfo hints)
|
remote_connect(const char *host, const char *port, struct addrinfo hints)
|
||||||
{
|
{
|
||||||
struct addrinfo *res, *res0;
|
struct addrinfo *res, *res0;
|
||||||
@ -62,13 +62,13 @@
|
|||||||
+#ifdef SO_BINDANY
|
+#ifdef SO_BINDANY
|
||||||
+ int on = 1;
|
+ int on = 1;
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
if ((error = getaddrinfo(host, port, &hints, &res0)))
|
if ((error = getaddrinfo(host, port, &hints, &res0)))
|
||||||
errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
|
errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
|
||||||
@@ -924,8 +937,10 @@
|
@@ -931,8 +944,10 @@
|
||||||
if (sflag || pflag) {
|
if (sflag || pflag) {
|
||||||
struct addrinfo ahints, *ares;
|
struct addrinfo ahints, *ares;
|
||||||
|
|
||||||
+#ifdef SO_BINDANY
|
+#ifdef SO_BINDANY
|
||||||
/* try SO_BINDANY, but don't insist */
|
/* try SO_BINDANY, but don't insist */
|
||||||
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
|
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
|
||||||
@ -76,7 +76,7 @@
|
|||||||
memset(&ahints, 0, sizeof(struct addrinfo));
|
memset(&ahints, 0, sizeof(struct addrinfo));
|
||||||
ahints.ai_family = res->ai_family;
|
ahints.ai_family = res->ai_family;
|
||||||
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
|
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
|
||||||
@@ -996,7 +1011,10 @@
|
@@ -1003,7 +1018,10 @@
|
||||||
local_listen(const char *host, const char *port, struct addrinfo hints)
|
local_listen(const char *host, const char *port, struct addrinfo hints)
|
||||||
{
|
{
|
||||||
struct addrinfo *res, *res0;
|
struct addrinfo *res, *res0;
|
||||||
@ -86,24 +86,24 @@
|
|||||||
+ int ret, x = 1;
|
+ int ret, x = 1;
|
||||||
+#endif
|
+#endif
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Allow nodename to be null. */
|
/* Allow nodename to be null. */
|
||||||
@@ -1017,9 +1035,11 @@
|
@@ -1024,9 +1042,11 @@
|
||||||
res->ai_protocol)) < 0)
|
res->ai_protocol)) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
+#ifdef SO_REUSEPORT
|
+#ifdef SO_REUSEPORT
|
||||||
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
|
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
set_common_sockopts(s, res->ai_family);
|
set_common_sockopts(s, res->ai_family);
|
||||||
|
|
||||||
@@ -1475,11 +1495,13 @@
|
@@ -1492,11 +1512,13 @@
|
||||||
{
|
{
|
||||||
int x = 1;
|
int x = 1;
|
||||||
|
|
||||||
+#ifdef TCP_MD5SIG
|
+#ifdef TCP_MD5SIG
|
||||||
if (Sflag) {
|
if (Sflag) {
|
||||||
if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
|
if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
|
||||||
@ -114,10 +114,10 @@
|
|||||||
if (Dflag) {
|
if (Dflag) {
|
||||||
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
|
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
|
||||||
&x, sizeof(x)) == -1)
|
&x, sizeof(x)) == -1)
|
||||||
@@ -1490,9 +1512,16 @@
|
@@ -1507,9 +1529,16 @@
|
||||||
IP_TOS, &Tflag, sizeof(Tflag)) == -1)
|
IP_TOS, &Tflag, sizeof(Tflag)) == -1)
|
||||||
err(1, "set IP ToS");
|
err(1, "set IP ToS");
|
||||||
|
|
||||||
+#ifdef IPV6_TCLASS
|
+#ifdef IPV6_TCLASS
|
||||||
else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
|
else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
|
||||||
IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
|
IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
|
||||||
@ -131,16 +131,16 @@
|
|||||||
}
|
}
|
||||||
if (Iflag) {
|
if (Iflag) {
|
||||||
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
|
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
|
||||||
@@ -1516,13 +1545,17 @@
|
@@ -1533,13 +1562,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minttl != -1) {
|
if (minttl != -1) {
|
||||||
+#ifdef IP_MINTTL
|
+#ifdef IP_MINTTL
|
||||||
if (af == AF_INET && setsockopt(s, IPPROTO_IP,
|
if (af == AF_INET && setsockopt(s, IPPROTO_IP,
|
||||||
IP_MINTTL, &minttl, sizeof(minttl)))
|
IP_MINTTL, &minttl, sizeof(minttl)))
|
||||||
err(1, "set IP min TTL");
|
err(1, "set IP min TTL");
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
- else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
|
- else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
|
||||||
+#ifdef IPV6_MINHOPCOUNT
|
+#ifdef IPV6_MINHOPCOUNT
|
||||||
+ if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
|
+ if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
|
||||||
@ -149,8 +149,8 @@
|
|||||||
+#endif
|
+#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1748,14 +1781,22 @@
|
@@ -1761,14 +1794,22 @@
|
||||||
\t-P proxyuser\tUsername for proxy authentication\n\
|
\t-P proxyuser\tUsername for proxy authentication\n\
|
||||||
\t-p port\t Specify local port for remote connects\n\
|
\t-p port\t Specify local port for remote connects\n\
|
||||||
\t-R CAfile CA bundle\n\
|
\t-R CAfile CA bundle\n\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user