rebase nc(1) patch
This commit is contained in:
parent
5bb829d86d
commit
93be612b5c
@ -1,6 +1,6 @@
|
|||||||
--- apps/nc/netcat.c.orig Thu Jul 7 07:25:23 2016
|
--- apps/nc/netcat.c.orig Sun Sep 4 05:37:35 2016
|
||||||
+++ apps/nc/netcat.c Thu Jul 7 07:25:37 2016
|
+++ apps/nc/netcat.c Sun Sep 4 05:40:24 2016
|
||||||
@@ -91,9 +91,13 @@
|
@@ -92,9 +92,13 @@
|
||||||
int Dflag; /* sodebug */
|
int Dflag; /* sodebug */
|
||||||
int Iflag; /* TCP receive buffer size */
|
int Iflag; /* TCP receive buffer size */
|
||||||
int Oflag; /* TCP send buffer size */
|
int Oflag; /* TCP send buffer size */
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
int usetls; /* use TLS */
|
int usetls; /* use TLS */
|
||||||
char *Cflag; /* Public cert file */
|
char *Cflag; /* Public cert file */
|
||||||
@@ -145,7 +149,7 @@
|
@@ -146,7 +150,7 @@
|
||||||
struct servent *sv;
|
struct servent *sv;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
struct sockaddr_storage cliaddr;
|
struct sockaddr_storage cliaddr;
|
||||||
@ -23,7 +23,7 @@
|
|||||||
const char *errstr, *proxyhost = "", *proxyport = NULL;
|
const char *errstr, *proxyhost = "", *proxyport = NULL;
|
||||||
struct addrinfo proxyhints;
|
struct addrinfo proxyhints;
|
||||||
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
|
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
|
||||||
@@ -255,12 +259,14 @@
|
@@ -256,12 +260,14 @@
|
||||||
case 'u':
|
case 'u':
|
||||||
uflag = 1;
|
uflag = 1;
|
||||||
break;
|
break;
|
||||||
@ -38,7 +38,7 @@
|
|||||||
case 'v':
|
case 'v':
|
||||||
vflag = 1;
|
vflag = 1;
|
||||||
break;
|
break;
|
||||||
@@ -293,9 +299,11 @@
|
@@ -294,9 +300,11 @@
|
||||||
errx(1, "TCP send window %s: %s",
|
errx(1, "TCP send window %s: %s",
|
||||||
errstr, optarg);
|
errstr, optarg);
|
||||||
break;
|
break;
|
||||||
@ -50,7 +50,7 @@
|
|||||||
case 'T':
|
case 'T':
|
||||||
errstr = NULL;
|
errstr = NULL;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@@ -319,9 +327,11 @@
|
@@ -320,9 +328,11 @@
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
@ -62,17 +62,17 @@
|
|||||||
|
|
||||||
if (family == AF_UNIX) {
|
if (family == AF_UNIX) {
|
||||||
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
|
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
|
||||||
@@ -824,7 +834,10 @@
|
@@ -825,7 +835,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;
|
||||||
- int s, error, on = 1, save_errno;
|
- int s = -1, error, on = 1, save_errno;
|
||||||
+ int s, error, save_errno;
|
+ int s = -1, error, save_errno;
|
||||||
+#ifdef SO_BINDANY
|
+#ifdef SO_BINDANY
|
||||||
+ int on = 1;
|
+ int on = 1;
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
if ((error = getaddrinfo(host, port, &hints, &res)))
|
if ((error = getaddrinfo(host, port, &hints, &res0)))
|
||||||
errx(1, "getaddrinfo: %s", gai_strerror(error));
|
errx(1, "getaddrinfo: %s", gai_strerror(error));
|
||||||
@@ -839,8 +852,10 @@
|
@@ -839,8 +852,10 @@
|
||||||
if (sflag || pflag) {
|
if (sflag || pflag) {
|
||||||
@ -83,22 +83,22 @@
|
|||||||
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
|
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
|
||||||
+#endif
|
+#endif
|
||||||
memset(&ahints, 0, sizeof(struct addrinfo));
|
memset(&ahints, 0, sizeof(struct addrinfo));
|
||||||
ahints.ai_family = res0->ai_family;
|
ahints.ai_family = res->ai_family;
|
||||||
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
|
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
|
||||||
@@ -911,7 +926,10 @@
|
@@ -911,7 +926,10 @@
|
||||||
local_listen(char *host, char *port, struct addrinfo hints)
|
local_listen(char *host, char *port, struct addrinfo hints)
|
||||||
{
|
{
|
||||||
struct addrinfo *res, *res0;
|
struct addrinfo *res, *res0;
|
||||||
- int s, ret, x = 1, save_errno;
|
- int s = -1, ret, x = 1, save_errno;
|
||||||
+ int s, save_errno;
|
+ int s = -1, save_errno;
|
||||||
+#ifdef SO_REUSEPORT
|
+#ifdef SO_REUSEPORT
|
||||||
+ int ret, x = 1;
|
+ int ret, x = 1;
|
||||||
+#endif
|
+#endif
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Allow nodename to be null. */
|
/* Allow nodename to be null. */
|
||||||
@@ -933,9 +951,11 @@
|
@@ -932,9 +950,11 @@
|
||||||
res0->ai_protocol)) < 0)
|
res->ai_protocol)) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
+#ifdef SO_REUSEPORT
|
+#ifdef SO_REUSEPORT
|
||||||
@ -107,9 +107,9 @@
|
|||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
set_common_sockopts(s, res0->ai_family);
|
set_common_sockopts(s, res->ai_family);
|
||||||
|
|
||||||
@@ -1393,11 +1413,13 @@
|
@@ -1392,11 +1412,13 @@
|
||||||
{
|
{
|
||||||
int x = 1;
|
int x = 1;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@
|
|||||||
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)
|
||||||
@@ -1434,13 +1456,17 @@
|
@@ -1433,13 +1455,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minttl != -1) {
|
if (minttl != -1) {
|
||||||
@ -142,7 +142,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,14 +1623,22 @@
|
@@ -1596,14 +1622,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