Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package netcat-openbsd for openSUSE:Factory
checked in at 2026-12-01 16:58:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/netcat-openbsd (Old)
and /work/SRC/openSUSE:Factory/.netcat-openbsd.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "netcat-openbsd"
Tue Dec 1 16:58:06 2026 rev:31 rq:1401121 version:1.239
Changes:
--------
--- /work/SRC/openSUSE:Factory/netcat-openbsd/netcat-openbsd.changes
2025-06-06 22:35:13.797362316 +0200
+++
/work/SRC/openSUSE:Factory/.netcat-openbsd.new.1340718/netcat-openbsd.changes
2026-12-01 16:58:36.743208816 +0100
@@ -1,0 +2,21 @@
+Fri Nov 27 13:23:04 UTC 2026 - Andrea Manzini <[email protected]>
+
+- Update to upstream version 1.239 (OpenBSD 8.0):
+ * Add support for SOCKS v.4A via -X 4A.
+ * Support TLS ALPN configuration option alpn.
+ * Add DiffServ Voice-Admit (va) traffic class keyword.
+ * Use strtonum for port validation during service lookup.
+ * Fix HTTP proxy response header parsing.
+ * Debian patches refreshed for 1.239.
+ * Fix buffer overread in set_common_sockopts() for TCP MD5SIG
+ (set-TCP-MD5SIG-correctly-for-client-connections.patch).
+- Spec file modernized and cleaned:
+ * Drop obsolete Group tag.
+ * Use %make_build macro.
+ * Switch Source0 to https.
+ * Add PATCH-FIX-OPENSUSE tags for all patches.
+- Refreshed SUSE patches:
+ * port-select-on-connect.patch
+ * enable-udp-ip_recverr.patch
+
+-------------------------------------------------------------------
Old:
----
netcat-openbsd_1.229.orig.tar.gz
New:
----
netcat-openbsd_1.239.orig.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ netcat-openbsd.spec ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.637287973 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.639288057 +0100
@@ -1,7 +1,7 @@
#
# spec file for package netcat-openbsd
#
-# Copyright (c) 2025 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,32 +17,49 @@
Name: netcat-openbsd
-Version: 1.229
+Version: 1.239
Release: 0
Summary: TCP/IP swiss army knife
License: BSD-3-Clause
-Group: Productivity/Networking/Other
URL: https://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/
-Source0:
http://deb.debian.org/debian/pool/main/n/netcat-openbsd/netcat-openbsd_%{version}.orig.tar.gz
-# Debian patches from:
http://http.debian.net/debian/pool/main/n/netcat-openbsd/netcat-openbsd_%{version}-2.debian.tar.xz
+Source0:
https://deb.debian.org/debian/pool/main/n/netcat-openbsd/netcat-openbsd_%{version}.orig.tar.gz
+# Debian patches from:
https://deb.debian.org/debian/pool/main/n/netcat-openbsd/netcat-openbsd_%%{version}-1.debian.tar.xz
+# PATCH-FIX-OPENSUSE port-to-linux-with-libbsd.patch -- port to Linux with
libbsd from Debian
Patch0: port-to-linux-with-libbsd.patch
+# PATCH-FIX-OPENSUSE build-without-TLS-support.patch -- build without TLS
support from Debian
Patch1: build-without-TLS-support.patch
+# PATCH-FIX-OPENSUSE connect-timeout.patch -- fix connect timeout from Debian
Patch2: connect-timeout.patch
+# PATCH-FIX-OPENSUSE get-sev-by-name.patch -- lookup service by name from
Debian
Patch3: get-sev-by-name.patch
+# PATCH-FIX-OPENSUSE send-crlf.patch -- flag to translate terminal line feeds
to CRLF from Debian
Patch4: send-crlf.patch
+# PATCH-FIX-OPENSUSE quit-timer.patch -- flag to specify a quit timer from
Debian
Patch5: quit-timer.patch
+# PATCH-FIX-OPENSUSE udp-scan-timeout.patch -- fix UDP scan timeout from Debian
Patch6: udp-scan-timeout.patch
+# PATCH-FIX-OPENSUSE dccp-support.patch -- DCCP support from Debian
Patch7: dccp-support.patch
+# PATCH-FIX-OPENSUSE broadcast-support.patch -- broadcast support from Debian
Patch8: broadcast-support.patch
+# PATCH-FIX-OPENSUSE serialized-handling-multiple-clients.patch -- serialized
handling of multiple clients from Debian
Patch9: serialized-handling-multiple-clients.patch
+# PATCH-FIX-OPENSUSE set-TCP-MD5SIG-correctly-for-client-connections.patch --
fix TCP MD5SIG from Debian
Patch10: set-TCP-MD5SIG-correctly-for-client-connections.patch
+# PATCH-FIX-OPENSUSE destination-port-list.patch -- specify list of
destination ports from Debian
Patch11: destination-port-list.patch
+# PATCH-FIX-OPENSUSE use-flags-to-specify-listen-address.patch -- use -s/-p
flags to specify listening address from Debian
Patch12: use-flags-to-specify-listen-address.patch
+# PATCH-FIX-OPENSUSE make-getnameinfo-errors-nonfatal-in-report_sock.patch --
nonfatal getnameinfo errors in report_sock from Debian
Patch13: make-getnameinfo-errors-nonfatal-in-report_sock.patch
+# PATCH-FIX-OPENSUSE abstract-unix-domain-socket.patch -- abstract UNIX domain
socket support from Debian
Patch14: abstract-unix-domain-socket.patch
+# PATCH-FIX-OPENSUSE misc-failures-and-features.patch -- miscellaneous fixes
from Debian
Patch15: misc-failures-and-features.patch
# SUSE patches
+# PATCH-FIX-OPENSUSE port-select-on-connect.patch -- bind address no port
support
Patch20: port-select-on-connect.patch
+# PATCH-FIX-OPENSUSE enable-udp-ip_recverr.patch -- enable ICMP errors for UDP
Patch21: enable-udp-ip_recverr.patch
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libbsd)
@@ -67,7 +84,7 @@
%autosetup -p1
%build
-make %{?_smp_mflags} \
+%make_build \
CFLAGS="%{optflags} -fvisibility=hidden"
%install
++++++ abstract-unix-domain-socket.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.671289394 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.673289478 +0100
@@ -15,7 +15,7 @@
2 files changed, 55 insertions(+), 23 deletions(-)
diff --git a/nc.1 b/nc.1
-index d30389a..8285c10 100644
+index 91b719e..5b2e224 100644
--- a/nc.1
+++ b/nc.1
@@ -235,6 +235,9 @@ Cannot be used together with
@@ -29,7 +29,7 @@
Use UDP instead of TCP.
Cannot be used together with
diff --git a/netcat.c b/netcat.c
-index 061a774..2f8890b 100644
+index eda2739..0878dae 100644
--- a/netcat.c
+++ b/netcat.c
@@ -98,6 +98,7 @@
@@ -40,7 +40,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-@@ -208,6 +209,7 @@ int timeout_connect(int, const struct sockaddr *,
socklen_t);
+@@ -209,6 +210,7 @@ int timeout_connect(int, const struct sockaddr *,
socklen_t);
int socks_connect(const char *, const char *, struct addrinfo,
const char *, const char *, struct addrinfo, int, const char *);
int udptest(int);
@@ -48,7 +48,7 @@
void connection_info(const char *, const char *, const char *, const char *);
int unix_bind(char *, int);
int unix_connect(char *);
-@@ -931,6 +933,46 @@ main(int argc, char *argv[])
+@@ -938,6 +940,46 @@ main(int argc, char *argv[])
return ret;
}
@@ -95,7 +95,7 @@
/*
* unix_bind()
* Returns a unix socket bound to the given path
-@@ -939,24 +981,17 @@ int
+@@ -946,24 +988,17 @@ int
unix_bind(char *path, int flags)
{
struct sockaddr_un s_un;
@@ -125,7 +125,7 @@
save_errno = errno;
close(s);
errno = save_errno;
-@@ -1066,7 +1101,10 @@ int
+@@ -1073,7 +1108,10 @@ int
unix_connect(char *path)
{
struct sockaddr_un s_un;
@@ -137,7 +137,7 @@
if (uflag) {
if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) == -1)
-@@ -1076,16 +1114,7 @@ unix_connect(char *path)
+@@ -1083,16 +1121,7 @@ unix_connect(char *path)
return -1;
}
++++++ broadcast-support.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.684289937 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.686290021 +0100
@@ -8,7 +8,7 @@
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/nc.1 b/nc.1
-index da37f06..49a3d4d 100644
+index f262939..6ee1584 100644
--- a/nc.1
+++ b/nc.1
@@ -33,7 +33,7 @@
@@ -30,7 +30,7 @@
Send CRLF as line-ending. Each line feed (LF) character from the input
data is translated into CR+LF before being written to the socket. Line
diff --git a/netcat.c b/netcat.c
-index 1c50615..99747a2 100644
+index 529fdb2..fba472d 100644
--- a/netcat.c
+++ b/netcat.c
@@ -132,6 +132,7 @@
@@ -41,7 +41,7 @@
int dflag; /* detached, no stdin */
int Fflag; /* fdpass sock to stdout */
unsigned int iflag; /* Interval Flag */
-@@ -261,9 +262,9 @@ main(int argc, char *argv[])
+@@ -262,9 +263,9 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv,
#ifdef HAVE_TLS
@@ -53,7 +53,7 @@
#endif
!= -1) {
switch (ch) {
-@@ -273,6 +274,13 @@ main(int argc, char *argv[])
+@@ -274,6 +275,13 @@ main(int argc, char *argv[])
case '6':
family = AF_INET6;
break;
@@ -67,7 +67,7 @@
case 'U':
family = AF_UNIX;
break;
-@@ -1907,6 +1915,15 @@ set_common_sockopts(int s, int af)
+@@ -1919,6 +1927,15 @@ set_common_sockopts(int s, int af)
{
int x = 1;
@@ -83,7 +83,7 @@
#ifdef TCP_MD5SIG
if (Sflag) {
if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
-@@ -2185,6 +2202,7 @@ help(void)
+@@ -2203,6 +2220,7 @@ help(void)
fprintf(stderr, "\tCommand Summary:\n\
\t-4 Use IPv4\n\
\t-6 Use IPv6\n\
++++++ build-without-TLS-support.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.698290523 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.700290606 +0100
@@ -8,12 +8,12 @@
Forwarded: not-needed
---
Makefile | 2 -
- nc.1 | 114 +++---------------------------------------
+ nc.1 | 118 +++----------------------------------------
netcat.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------
- 3 files changed, 153 insertions(+), 135 deletions(-)
+ 3 files changed, 153 insertions(+), 139 deletions(-)
diff --git a/Makefile b/Makefile
-index 93ca5ee..31d7536 100644
+index 2c92548..ef2a679 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,6 @@
@@ -24,9 +24,9 @@
-DPADD+= ${LIBTLS} ${LIBSSL} ${LIBCRYPTO}
PKG_CONFIG ?= pkg-config
- LIBS= `$(PKG_CONFIG) --libs libbsd` -lresolv
+ LIBS ?= `$(PKG_CONFIG) --libs libbsd` -lresolv
diff --git a/nc.1 b/nc.1
-index 596bd8e..2eb732e 100644
+index 75ac68b..d285e62 100644
--- a/nc.1
+++ b/nc.1
@@ -33,20 +33,14 @@
@@ -150,7 +150,7 @@
.It Fl r
Choose source and/or destination ports randomly
instead of sequentially within a range or in the order that the system
-@@ -238,35 +180,7 @@ Cannot be used together with
+@@ -238,39 +180,7 @@ Cannot be used together with
or
.Fl x .
.It Fl T Ar keyword
@@ -171,6 +171,10 @@
-The following TLS options specify a value in the form of a
-.Ar key Ns = Ns Ar value
-pair:
+-.Cm alpn ,
+-which allows the TLS ALPN to be specified (see
+-.Xr tls_config_set_alpn 3
+-for further details);
-.Cm ciphers ,
-which allows the supported TLS ciphers to be specified (see
-.Xr tls_config_set_ciphers 3
@@ -187,7 +191,7 @@
.Ar keyword
may be one of
.Cm critical ,
-@@ -290,13 +204,13 @@ to script telnet sessions.
+@@ -294,13 +204,13 @@ to script telnet sessions.
Use
.Ux Ns -domain
sockets.
@@ -205,7 +209,7 @@
.Fl x .
For
.Ux Ns -domain
-@@ -359,12 +273,6 @@ An IPv6 address can be specified unambiguously by
enclosing
+@@ -369,12 +279,6 @@ An IPv6 address can be specified unambiguously by
enclosing
in square brackets.
A proxy cannot be used with any of the options
.Fl lsuU .
@@ -218,7 +222,7 @@
.It Fl z
Only scan for listening daemons, without sending any data to them.
Cannot be used together with
-@@ -522,16 +430,6 @@ the source port, with a timeout of 5 seconds:
+@@ -532,16 +436,6 @@ the source port, with a timeout of 5 seconds:
.Pp
.Dl $ nc -p 31337 -w 5 host.example.com 42
.Pp
@@ -236,7 +240,7 @@
.Pp
.Dl $ nc -u host.example.com 53
diff --git a/netcat.c b/netcat.c
-index d23e566..bec6e46 100644
+index 915a8b7..3bb403c 100644
--- a/netcat.c
+++ b/netcat.c
@@ -99,7 +99,9 @@
@@ -275,15 +279,15 @@
int usetls; /* use TLS */
const char *Cflag; /* Public cert file */
const char *Kflag; /* Private key file */
-@@ -156,6 +161,7 @@ char *tls_expecthash; /*
required hash of peer cert */
- char *tls_ciphers; /* TLS ciphers */
+@@ -157,6 +162,7 @@ char *tls_ciphers; /* TLS
ciphers */
char *tls_protocols; /* TLS protocols */
+ char *tls_alpn; /* TLS ALPN */
FILE *Zflag; /* file to save peer cert */
+#endif
int recvcount, recvlimit;
int timeout = -1;
-@@ -170,10 +176,16 @@ int strtoport(char *portstr, int udp);
+@@ -171,10 +177,16 @@ int strtoport(char *portstr, int udp);
void build_ports(char *);
void help(void) __attribute__((noreturn));
int local_listen(const char *, const char *, struct addrinfo);
@@ -300,7 +304,7 @@
int timeout_connect(int, const struct sockaddr *, socklen_t);
int socks_connect(const char *, const char *, struct addrinfo,
const char *, const char *, struct addrinfo, int, const char *);
-@@ -184,15 +196,24 @@ int unix_connect(char *);
+@@ -185,15 +197,24 @@ int unix_connect(char *);
int unix_listen(char *);
void set_common_sockopts(int, int);
int process_tos_opt(char *, int *);
@@ -325,7 +329,7 @@
int
main(int argc, char *argv[])
-@@ -207,20 +228,28 @@ main(int argc, char *argv[])
+@@ -208,20 +229,28 @@ main(int argc, char *argv[])
const char *errstr;
struct addrinfo proxyhints;
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
@@ -354,7 +358,7 @@
!= -1) {
switch (ch) {
case '4':
-@@ -242,24 +271,30 @@ main(int argc, char *argv[])
+@@ -245,24 +274,30 @@ main(int argc, char *argv[])
else
errx(1, "unsupported proxy protocol");
break;
@@ -385,7 +389,7 @@
case 'h':
help();
break;
-@@ -268,9 +303,11 @@ main(int argc, char *argv[])
+@@ -271,9 +306,11 @@ main(int argc, char *argv[])
if (errstr)
errx(1, "interval %s: %s", errstr, optarg);
break;
@@ -397,7 +401,7 @@
case 'k':
kflag = 1;
break;
-@@ -299,10 +336,12 @@ main(int argc, char *argv[])
+@@ -302,10 +339,12 @@ main(int argc, char *argv[])
case 'p':
pflag = optarg;
break;
@@ -410,7 +414,7 @@
case 'r':
rflag = 1;
break;
-@@ -344,12 +383,14 @@ main(int argc, char *argv[])
+@@ -347,12 +386,14 @@ main(int argc, char *argv[])
if ((proxy = strdup(optarg)) == NULL)
err(1, NULL);
break;
@@ -425,7 +429,7 @@
case 'z':
zflag = 1;
break;
-@@ -368,9 +409,11 @@ main(int argc, char *argv[])
+@@ -371,9 +412,11 @@ main(int argc, char *argv[])
errx(1, "TCP send window %s: %s",
errstr, optarg);
break;
@@ -437,7 +441,7 @@
case 'S':
#ifdef TCP_MD5SIG
Sflag = 1;
-@@ -381,8 +424,10 @@ main(int argc, char *argv[])
+@@ -384,8 +427,10 @@ main(int argc, char *argv[])
case 'T':
errstr = NULL;
errno = 0;
@@ -448,7 +452,7 @@
if (process_tos_opt(optarg, &Tflag))
break;
if (strlen(optarg) > 1 && optarg[0] == '0' &&
-@@ -392,7 +437,11 @@ main(int argc, char *argv[])
+@@ -395,7 +440,11 @@ main(int argc, char *argv[])
Tflag = (int)strtonum(optarg, 0, 255,
&errstr);
if (Tflag < 0 || Tflag > 255 || errstr || errno)
@@ -460,7 +464,7 @@
break;
default:
usage(1);
-@@ -425,6 +474,7 @@ main(int argc, char *argv[])
+@@ -428,6 +477,7 @@ main(int argc, char *argv[])
} else
usage(1);
@@ -468,7 +472,7 @@
if (usetls) {
if (Cflag && unveil(Cflag, "r") == -1)
err(1, "unveil %s", Cflag);
-@@ -459,15 +509,19 @@ main(int argc, char *argv[])
+@@ -464,15 +514,19 @@ main(int argc, char *argv[])
err(1, "unveil /");
}
}
@@ -488,7 +492,7 @@
if (Fflag && usetls)
errx(1, "cannot use -c and -F");
if (TLSopt && !usetls)
-@@ -486,6 +540,7 @@ main(int argc, char *argv[])
+@@ -491,6 +545,7 @@ main(int argc, char *argv[])
errx(1, "you must specify -c to use -H");
if (tls_expectname && !usetls)
errx(1, "you must specify -c to use -e");
@@ -496,7 +500,7 @@
/* Get name of temporary socket for unix datagram client */
if ((family == AF_UNIX) && uflag && !lflag) {
-@@ -552,6 +607,7 @@ main(int argc, char *argv[])
+@@ -557,6 +612,7 @@ main(int argc, char *argv[])
proxyhints.ai_flags |= AI_NUMERICHOST;
}
@@ -504,7 +508,7 @@
if (usetls) {
if ((tls_cfg = tls_config_new()) == NULL)
errx(1, "unable to allocate TLS config");
-@@ -588,6 +644,7 @@ main(int argc, char *argv[])
+@@ -595,6 +651,7 @@ main(int argc, char *argv[])
} else if (pledge("stdio inet dns", NULL) == -1)
err(1, "pledge");
}
@@ -512,7 +516,7 @@
if (lflag) {
ret = 0;
-@@ -598,6 +655,7 @@ main(int argc, char *argv[])
+@@ -605,6 +662,7 @@ main(int argc, char *argv[])
s = unix_listen(host);
}
@@ -520,7 +524,7 @@
if (usetls) {
tls_config_verify_client_optional(tls_cfg);
if ((tls_ctx = tls_server()) == NULL)
-@@ -606,6 +664,7 @@ main(int argc, char *argv[])
+@@ -613,6 +671,7 @@ main(int argc, char *argv[])
errx(1, "tls configuration failed (%s)",
tls_error(tls_ctx));
}
@@ -528,7 +532,7 @@
/* Allow only one connection at a time, but stay alive. */
for (;;) {
if (family != AF_UNIX) {
-@@ -621,7 +680,11 @@ main(int argc, char *argv[])
+@@ -628,7 +687,11 @@ main(int argc, char *argv[])
* let it receive datagrams from multiple
* socket pairs.
*/
@@ -540,7 +544,7 @@
} else if (uflag && !kflag) {
/*
* For UDP and not -k, we will use recvfrom()
-@@ -647,9 +710,14 @@ main(int argc, char *argv[])
+@@ -654,9 +717,14 @@ main(int argc, char *argv[])
(struct sockaddr *)&z, len,
family == AF_UNIX ? host : NULL);
@@ -555,7 +559,7 @@
int connfd;
len = sizeof(cliaddr);
-@@ -663,6 +731,7 @@ main(int argc, char *argv[])
+@@ -670,6 +738,7 @@ main(int argc, char *argv[])
report_sock("Connection received",
(struct sockaddr *)&cliaddr, len,
family == AF_UNIX ? host : NULL);
@@ -563,7 +567,7 @@
if ((usetls) &&
(tls_cctx = tls_setup_server(tls_ctx,
connfd, host)))
readwrite(connfd, tls_cctx);
-@@ -672,6 +741,10 @@ main(int argc, char *argv[])
+@@ -679,6 +748,10 @@ main(int argc, char *argv[])
timeout_tls(s, tls_cctx, tls_close);
close(connfd);
tls_free(tls_cctx);
@@ -574,7 +578,7 @@
}
if (!kflag)
-@@ -682,7 +755,11 @@ main(int argc, char *argv[])
+@@ -689,7 +762,11 @@ main(int argc, char *argv[])
if ((s = unix_connect(host)) > 0) {
if (!zflag)
@@ -586,7 +590,7 @@
close(s);
} else {
warn("%s", host);
-@@ -702,6 +779,7 @@ main(int argc, char *argv[])
+@@ -709,6 +786,7 @@ main(int argc, char *argv[])
for (s = -1, i = 0; portlist[i] != NULL; i++) {
if (s != -1)
close(s);
@@ -594,7 +598,7 @@
tls_free(tls_ctx);
tls_ctx = NULL;
-@@ -712,6 +790,7 @@ main(int argc, char *argv[])
+@@ -719,6 +797,7 @@ main(int argc, char *argv[])
errx(1, "tls configuration failed (%s)",
tls_error(tls_ctx));
}
@@ -602,7 +606,7 @@
if (xflag)
s = socks_connect(host, portlist[i], hints,
proxy, proxyport, proxyhints, socksv,
-@@ -741,6 +820,7 @@ main(int argc, char *argv[])
+@@ -748,6 +827,7 @@ main(int argc, char *argv[])
}
if (Fflag)
fdpass(s);
@@ -610,7 +614,7 @@
else {
if (usetls)
tls_setup_client(tls_ctx, s, host);
-@@ -749,13 +829,19 @@ main(int argc, char *argv[])
+@@ -756,13 +836,19 @@ main(int argc, char *argv[])
if (tls_ctx)
timeout_tls(s, tls_ctx, tls_close);
}
@@ -630,7 +634,7 @@
return ret;
}
-@@ -797,6 +883,7 @@ unix_bind(char *path, int flags)
+@@ -804,6 +890,7 @@ unix_bind(char *path, int flags)
return s;
}
@@ -638,7 +642,7 @@
int
timeout_tls(int s, struct tls *tls_ctx, int (*func)(struct tls *))
{
-@@ -884,6 +971,7 @@ tls_setup_server(struct tls *tls_ctx, int connfd, char
*host)
+@@ -891,6 +978,7 @@ tls_setup_server(struct tls *tls_ctx, int connfd, char
*host)
}
return NULL;
}
@@ -646,7 +650,7 @@
/*
* unix_connect()
-@@ -1130,7 +1218,11 @@ local_listen(const char *host, const char *port, struct
addrinfo hints)
+@@ -1137,7 +1225,11 @@ local_listen(const char *host, const char *port, struct
addrinfo hints)
* Loop that polls on the network file descriptor and stdin.
*/
void
@@ -658,7 +662,7 @@
{
struct pollfd pfd[4];
int stdin_fd = STDIN_FILENO;
-@@ -1230,12 +1322,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
+@@ -1237,12 +1329,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
/* try to read from stdin */
if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) {
ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf,
@@ -677,7 +681,7 @@
pfd[POLL_STDIN].fd = -1;
/* read something - poll net out */
if (stdinbufpos > 0)
-@@ -1247,12 +1344,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
+@@ -1254,12 +1351,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
/* try to write to network */
if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) {
ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf,
@@ -696,7 +700,7 @@
pfd[POLL_NETOUT].fd = -1;
/* buffer empty - remove self from polling */
if (stdinbufpos == 0)
-@@ -1264,12 +1366,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
+@@ -1271,12 +1373,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
/* try to read from network */
if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) {
ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf,
@@ -715,7 +719,7 @@
pfd[POLL_NETIN].fd = -1;
/* eof on net in - remove from pfd */
if (ret == 0) {
-@@ -1296,12 +1403,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
+@@ -1303,12 +1410,17 @@ readwrite(int net_fd, struct tls *tls_ctx)
/* try to write to stdout */
if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) {
ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf,
@@ -734,7 +738,7 @@
pfd[POLL_STDOUT].fd = -1;
/* buffer empty - remove self from polling */
if (netinbufpos == 0)
-@@ -1325,7 +1437,11 @@ readwrite(int net_fd, struct tls *tls_ctx)
+@@ -1332,7 +1444,11 @@ readwrite(int net_fd, struct tls *tls_ctx)
}
ssize_t
@@ -746,7 +750,7 @@
{
ssize_t n;
ssize_t adjust;
-@@ -1333,16 +1449,22 @@ drainbuf(int fd, unsigned char *buf, size_t *bufpos,
struct tls *tls)
+@@ -1340,16 +1456,22 @@ drainbuf(int fd, unsigned char *buf, size_t *bufpos,
struct tls *tls)
if (fd == -1)
return -1;
@@ -769,7 +773,7 @@
if (n <= 0)
return n;
/* adjust buffer */
-@@ -1354,7 +1476,11 @@ drainbuf(int fd, unsigned char *buf, size_t *bufpos,
struct tls *tls)
+@@ -1361,7 +1483,11 @@ drainbuf(int fd, unsigned char *buf, size_t *bufpos,
struct tls *tls)
}
ssize_t
@@ -781,7 +785,7 @@
{
size_t num = BUFSIZE - *bufpos;
ssize_t n;
-@@ -1362,16 +1488,22 @@ fillbuf(int fd, unsigned char *buf, size_t *bufpos,
struct tls *tls)
+@@ -1369,16 +1495,22 @@ fillbuf(int fd, unsigned char *buf, size_t *bufpos,
struct tls *tls)
if (fd == -1)
return -1;
@@ -804,7 +808,7 @@
if (n <= 0)
return n;
*bufpos += n;
-@@ -1718,6 +1850,7 @@ process_tos_opt(char *s, int *val)
+@@ -1731,6 +1863,7 @@ process_tos_opt(char *s, int *val)
return 0;
}
@@ -812,15 +816,15 @@
int
process_tls_opt(char *s, int *flags)
{
-@@ -1831,6 +1964,7 @@ report_tls(struct tls *tls_ctx, char *host)
- break;
- }
+@@ -1849,6 +1982,7 @@ report_tls(struct tls *tls_ctx, char *host)
+ if ((alpn_proto = tls_conn_alpn_selected(tls_ctx)) != NULL)
+ fprintf(stderr, "Application Layer Protocol: %s\n", alpn_proto);
}
+#endif
void
report_sock(const char *msg, const struct sockaddr *sa, socklen_t salen,
-@@ -1872,17 +2006,12 @@ help(void)
+@@ -1890,17 +2024,12 @@ help(void)
fprintf(stderr, "\tCommand Summary:\n\
\t-4 Use IPv4\n\
\t-6 Use IPv6\n\
@@ -838,7 +842,7 @@
\t-k Keep inbound sockets open for multiple connects\n\
\t-l Listen mode, for inbound connects\n\
\t-M ttl Outgoing TTL / Hop Limit\n\
-@@ -1890,14 +2019,12 @@ help(void)
+@@ -1908,14 +2037,12 @@ help(void)
\t-N Shutdown the network socket after EOF on stdin\n\
\t-n Suppress name/port resolutions\n\
\t-O length TCP send buffer length\n\
@@ -854,15 +858,15 @@
\t-t Answer TELNET negotiation\n\
\t-U Use UNIX domain socket\n\
\t-u UDP mode\n\
-@@ -1907,7 +2034,6 @@ help(void)
+@@ -1925,7 +2052,6 @@ help(void)
\t-w timeout Timeout for connects and final net reads\n\
- \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\
+ \t-X proto Proxy protocol: \"4\", \"4A\", \"5\" (SOCKS) or
\"connect\"\n\
\t-x addr[:port]\tSpecify proxy address and port\n\
- \t-Z Peer certificate file\n\
\t-z Zero-I/O mode [used for scanning]\n\
Port numbers can be individual or ranges: lo-hi [inclusive]\n");
exit(0);
-@@ -1917,15 +2043,11 @@ void
+@@ -1935,15 +2061,11 @@ void
usage(int ret)
{
fprintf(stderr,
++++++ connect-timeout.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.714291191 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.718291358 +0100
@@ -7,7 +7,7 @@
1 file changed, 77 insertions(+), 5 deletions(-)
diff --git a/netcat.c b/netcat.c
-index bec6e46..461e2bd 100644
+index 3bb403c..5ed422b 100644
--- a/netcat.c
+++ b/netcat.c
@@ -90,6 +90,7 @@
@@ -29,7 +29,7 @@
/* Command Line Options */
int dflag; /* detached, no stdin */
int Fflag; /* fdpass sock to stdout */
-@@ -215,6 +220,8 @@ ssize_t drainbuf(int, unsigned char *, size_t *);
+@@ -216,6 +221,8 @@ ssize_t drainbuf(int, unsigned char *, size_t *);
ssize_t fillbuf(int, unsigned char *, size_t *);
#endif
@@ -38,7 +38,7 @@
int
main(int argc, char *argv[])
{
-@@ -1088,18 +1095,21 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
+@@ -1095,18 +1102,21 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
}
}
@@ -65,7 +65,7 @@
}
save_errno = errno;
-@@ -1141,6 +1151,68 @@ timeout_connect(int s, const struct sockaddr *name,
socklen_t namelen)
+@@ -1148,6 +1158,68 @@ timeout_connect(int s, const struct sockaddr *name,
socklen_t namelen)
return ret;
}
++++++ dccp-support.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.729291818 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.734292027 +0100
@@ -8,7 +8,7 @@
2 files changed, 76 insertions(+), 13 deletions(-)
diff --git a/nc.1 b/nc.1
-index fbcc098..da37f06 100644
+index 1724081..f262939 100644
--- a/nc.1
+++ b/nc.1
@@ -33,7 +33,7 @@
@@ -20,7 +20,7 @@
.Op Fl I Ar length
.Op Fl i Ar interval
.Op Fl M Ar ttl
-@@ -288,6 +288,8 @@ An IPv6 address can be specified unambiguously by enclosing
+@@ -294,6 +294,8 @@ An IPv6 address can be specified unambiguously by enclosing
in square brackets.
A proxy cannot be used with any of the options
.Fl lsuU .
@@ -30,7 +30,7 @@
Only scan for listening daemons, without sending any data to them.
Cannot be used together with
diff --git a/netcat.c b/netcat.c
-index dd893ac..1c50615 100644
+index cb7db2d..529fdb2 100644
--- a/netcat.c
+++ b/netcat.c
@@ -146,6 +146,7 @@ int rflag; /*
Random ports flag */
@@ -41,7 +41,7 @@
int vflag; /* Verbosity */
int xflag; /* Socks proxy */
int zflag; /* Port Scan Flag */
-@@ -225,6 +226,7 @@ ssize_t drainbuf(int, unsigned char *, size_t *, int);
+@@ -226,6 +227,7 @@ ssize_t drainbuf(int, unsigned char *, size_t *, int);
ssize_t fillbuf(int, unsigned char *, size_t *);
#endif
@@ -49,7 +49,7 @@
static int connect_with_timeout(int, const struct sockaddr *, socklen_t, int);
static void quit(int sig);
-@@ -261,7 +263,7 @@ main(int argc, char *argv[])
+@@ -262,7 +264,7 @@ main(int argc, char *argv[])
#ifdef HAVE_TLS
"46C:cDde:FH:hI:i:K:klM:m:NnO:o:P:p:q:R:rSs:T:tUuV:vW:w:X:x:Z:z"))
#else
@@ -58,7 +58,7 @@
#endif
!= -1) {
switch (ch) {
-@@ -378,6 +380,13 @@ main(int argc, char *argv[])
+@@ -381,6 +383,13 @@ main(int argc, char *argv[])
case 'u':
uflag = 1;
break;
@@ -72,7 +72,7 @@
case 'V':
#ifdef RT_TABLEID_MAX
rtableid = (int)strtonum(optarg, 0,
-@@ -482,6 +491,10 @@ main(int argc, char *argv[])
+@@ -485,6 +494,10 @@ main(int argc, char *argv[])
/* Cruft to make sure options are clean, and used properly. */
if (argc == 1 && family == AF_UNIX) {
@@ -83,7 +83,7 @@
host = argv[0];
} else if (argc == 0 && lflag) {
if (sflag)
-@@ -583,8 +596,20 @@ main(int argc, char *argv[])
+@@ -588,8 +601,20 @@ main(int argc, char *argv[])
if (family != AF_UNIX) {
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = family;
@@ -106,7 +106,7 @@
if (nflag)
hints.ai_flags |= AI_NUMERICHOST;
}
-@@ -592,7 +617,10 @@ main(int argc, char *argv[])
+@@ -597,7 +622,10 @@ main(int argc, char *argv[])
if (xflag) {
if (uflag)
errx(1, "no proxy support for UDP mode");
@@ -118,7 +118,7 @@
if (lflag)
errx(1, "no proxy support for listen");
-@@ -838,9 +866,11 @@ main(int argc, char *argv[])
+@@ -845,9 +873,11 @@ main(int argc, char *argv[])
continue;
}
}
@@ -132,7 +132,7 @@
}
if (Fflag)
fdpass(s);
-@@ -1054,6 +1084,21 @@ unix_listen(char *path)
+@@ -1061,6 +1091,21 @@ unix_listen(char *path)
return s;
}
@@ -154,7 +154,7 @@
/*
* remote_connect()
* Returns a socket connected to a remote host. Properly binds to a local
-@@ -1085,8 +1130,20 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
+@@ -1092,8 +1137,20 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
#endif
memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res->ai_family;
@@ -177,7 +177,7 @@
ahints.ai_flags = AI_PASSIVE;
if ((error = getaddrinfo(sflag, pflag, &ahints, &ares)))
errx(1, "getaddrinfo: %s", gai_strerror(error));
-@@ -1116,16 +1173,18 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
+@@ -1123,16 +1180,18 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
timeout)) == CONNECTION_SUCCESS)
break;
@@ -198,7 +198,7 @@
error == CONNECTION_TIMEOUT ? "timed out" :
"failed");
}
-@@ -1742,7 +1801,8 @@ build_ports(char *p)
+@@ -1749,7 +1808,8 @@ build_ports(char *p)
int hi, lo, cp;
int x = 0;
@@ -208,15 +208,15 @@
if (sv) {
if (asprintf(&portlist[0], "%d", ntohs(sv->s_port)) < 0)
err(1, "asprintf");
-@@ -2155,6 +2215,7 @@ help(void)
+@@ -2173,6 +2233,7 @@ help(void)
\t-w timeout Timeout for connects and final net reads\n\
- \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\
+ \t-X proto Proxy protocol: \"4\", \"4A\", \"5\" (SOCKS) or
\"connect\"\n\
\t-x addr[:port]\tSpecify proxy address and port\n\
+ \t-Z DCCP mode\n\
\t-z Zero-I/O mode [used for scanning]\n\
Port numbers can be individual or ranges: lo-hi [inclusive]\n");
exit(0);
-@@ -2164,7 +2225,7 @@ void
+@@ -2182,7 +2243,7 @@ void
usage(int ret)
{
fprintf(stderr,
++++++ destination-port-list.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.746292529 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.748292612 +0100
@@ -8,10 +8,10 @@
2 files changed, 68 insertions(+), 44 deletions(-)
diff --git a/nc.1 b/nc.1
-index 49a3d4d..80c654c 100644
+index 6ee1584..ed659b4 100644
--- a/nc.1
+++ b/nc.1
-@@ -417,15 +417,35 @@ The
+@@ -423,15 +423,35 @@ The
flag can be used to tell
.Nm
to report open ports,
@@ -51,10 +51,10 @@
Alternatively, it might be useful to know which server software
is running, and which versions.
diff --git a/netcat.c b/netcat.c
-index 990c31b..bef27a4 100644
+index c453f6b..26e9b8d 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -191,7 +191,7 @@ int minttl = -1;
+@@ -192,7 +192,7 @@ int minttl = -1;
void atelnet(int, unsigned char *, unsigned int);
int strtoport(char *portstr, int udp);
@@ -63,7 +63,7 @@
void help(void) __attribute__((noreturn));
int local_listen(const char *, const char *, struct addrinfo);
#ifdef HAVE_TLS
-@@ -241,7 +241,7 @@ int
+@@ -242,7 +242,7 @@ int
main(int argc, char *argv[])
{
int ch, s = -1, ret, socksv;
@@ -72,7 +72,7 @@
char ipaddr[NI_MAXHOST];
struct addrinfo hints;
socklen_t len;
-@@ -521,10 +521,10 @@ main(int argc, char *argv[])
+@@ -524,10 +524,10 @@ main(int argc, char *argv[])
if (zflag)
errx(1, "cannot use -z and -l");
} else if (argc == 1 && lflag) {
@@ -85,7 +85,7 @@
} else
usage(1);
-@@ -723,7 +723,7 @@ main(int argc, char *argv[])
+@@ -730,7 +730,7 @@ main(int argc, char *argv[])
else
s = unix_listen(host);
} else
@@ -94,7 +94,7 @@
if (s < 0)
err(1, NULL);
-@@ -1810,57 +1810,61 @@ strtoport(char *portstr, int udp)
+@@ -1817,57 +1817,61 @@ strtoport(char *portstr, int udp)
* that we should try to connect to.
*/
void
++++++ enable-udp-ip_recverr.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.764293281 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.766293364 +0100
@@ -1,8 +1,8 @@
-Index: netcat-openbsd-1.229/netcat.c
+Index: netcat-openbsd-1.239/netcat.c
===================================================================
---- netcat-openbsd-1.229.orig/netcat.c 2025-06-04 07:36:53.985608901 +0000
-+++ netcat-openbsd-1.229/netcat.c 2025-06-04 07:37:13.091297946 +0000
-@@ -1990,6 +1990,21 @@ connection_info(const char *host, const
+--- netcat-openbsd-1.239.orig/netcat.c
++++ netcat-openbsd-1.239/netcat.c
+@@ -2002,6 +2002,21 @@ connection_info(const char *host, const
fprintf(stderr, " %s port [%s/%s] succeeded!\n", port, proto, service);
}
@@ -22,9 +22,9 @@
+}
+
void
- set_common_sockopts(int s, const struct sockaddr* sa)
+ set_common_sockopts(int s, const struct sockaddr* sa, socklen_t sa_len)
{
-@@ -2084,6 +2099,8 @@ set_common_sockopts(int s, const struct
+@@ -2096,6 +2111,8 @@ set_common_sockopts(int s, const struct
errx(1, "can't set IPv6 min hop count (unavailable)");
#endif
}
++++++ get-sev-by-name.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.777293824 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.780293950 +0100
@@ -7,10 +7,10 @@
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/netcat.c b/netcat.c
-index 461e2bd..2dc1abd 100644
+index 5ed422b..a9a38c5 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -1700,11 +1700,16 @@ strtoport(char *portstr, int udp)
+@@ -1707,11 +1707,16 @@ strtoport(char *portstr, int udp)
void
build_ports(char *p)
{
++++++ make-getnameinfo-errors-nonfatal-in-report_sock.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.791294409 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.794294535 +0100
@@ -11,10 +11,10 @@
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/netcat.c b/netcat.c
-index 0caba28..061a774 100644
+index faa3353f..eda2739 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -2220,9 +2220,11 @@ report_sock(const char *msg, const struct sockaddr *sa,
socklen_t salen,
+@@ -2238,9 +2238,11 @@ report_sock(const char *msg, const struct sockaddr *sa,
socklen_t salen,
case 0:
break;
case EAI_SYSTEM:
++++++ misc-failures-and-features.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.804294953 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.811295245 +0100
@@ -8,10 +8,10 @@
2 files changed, 80 insertions(+), 8 deletions(-)
diff --git a/nc.1 b/nc.1
-index 8285c10..a159c73 100644
+index 5b2e224..141b116 100644
--- a/nc.1
+++ b/nc.1
-@@ -371,6 +371,54 @@ The connection may be terminated using an
+@@ -377,6 +377,54 @@ The connection may be terminated using an
as the
.Fl N
flag was given.
@@ -66,7 +66,7 @@
.Sh DATA TRANSFER
The example in the previous section can be expanded to build a
basic data transfer model.
-@@ -523,6 +571,9 @@ Original implementation by
+@@ -529,6 +577,9 @@ Original implementation by
.br
Rewritten with IPv6 support by
.An Eric Jackson Aq Mt [email protected] .
@@ -77,7 +77,7 @@
UDP port scans using the
.Fl uz
diff --git a/netcat.c b/netcat.c
-index 2f8890b..2a3714a 100644
+index 0878dae..969d98f 100644
--- a/netcat.c
+++ b/netcat.c
@@ -114,7 +114,7 @@
@@ -89,7 +89,7 @@
#define POLL_STDIN 0
#define POLL_NETOUT 1
-@@ -618,10 +618,20 @@ main(int argc, char *argv[])
+@@ -623,10 +623,20 @@ main(int argc, char *argv[])
if (sflag) {
unix_dg_tmp_socket = sflag;
} else {
@@ -113,7 +113,7 @@
unix_dg_tmp_socket = unix_dg_tmp_socket_buf;
}
}
-@@ -851,8 +861,14 @@ main(int argc, char *argv[])
+@@ -858,8 +868,14 @@ main(int argc, char *argv[])
ret = 1;
}
@@ -129,7 +129,7 @@
return ret;
} else {
int i = 0;
-@@ -991,6 +1007,11 @@ unix_bind(char *path, int flags)
+@@ -998,6 +1014,11 @@ unix_bind(char *path, int flags)
0)) == -1)
return -1;
@@ -141,7 +141,7 @@
if (bind(s, (struct sockaddr *)&s_un, addrlen) == -1) {
save_errno = errno;
close(s);
-@@ -1108,7 +1129,7 @@ unix_connect(char *path)
+@@ -1115,7 +1136,7 @@ unix_connect(char *path)
if (uflag) {
if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) == -1)
@@ -150,7 +150,7 @@
} else {
if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1)
return -1;
-@@ -1381,12 +1402,12 @@ local_listen(const char *host, const char *port,
struct addrinfo hints)
+@@ -1388,12 +1409,12 @@ local_listen(const char *host, const char *port,
struct addrinfo hints)
ret = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
if (ret == -1)
@@ -164,5 +164,5 @@
+ warn("Couldn't set SO_REUSEPORT");
#endif
- set_common_sockopts(s, res->ai_addr);
+ set_common_sockopts(s, res->ai_addr, res->ai_addrlen);
++++++ netcat-openbsd_1.229.orig.tar.gz -> netcat-openbsd_1.239.orig.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netcat-openbsd-1.229/nc.1
new/netcat-openbsd-1.239/nc.1
--- old/netcat-openbsd-1.229/nc.1 2025-04-27 22:13:07.000000000 +0200
+++ new/netcat-openbsd-1.239/nc.1 2026-10-20 05:29:09.000000000 +0200
@@ -1,4 +1,4 @@
-.\" $OpenBSD: nc.1,v 1.98 2024/04/01 12:40:18 deraadt Exp $
+.\" $OpenBSD: nc.1,v 1.101 2025/06/24 13:37:39 tb Exp $
.\"
.\" Copyright (c) 1996 David Sacerdote
.\" All rights reserved.
@@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: April 1 2024 $
+.Dd $Mdocdate: June 24 2025 $
.Dt NC 1
.Os
.Sh NAME
@@ -257,6 +257,10 @@
The following TLS options specify a value in the form of a
.Ar key Ns = Ns Ar value
pair:
+.Cm alpn ,
+which allows the TLS ALPN to be specified (see
+.Xr tls_config_set_alpn 3
+for further details);
.Cm ciphers ,
which allows the supported TLS ciphers to be specified (see
.Xr tls_config_set_ciphers 3
@@ -338,12 +342,18 @@
Supported protocols are
.Cm 4
(SOCKS v.4),
+.Cm 4A
+(SOCKS v.4A),
.Cm 5
(SOCKS v.5)
and
.Cm connect
(HTTPS proxy).
If the protocol is not specified, SOCKS version 5 is used.
+Note that the SOCKS v.4 protocol is very limited and can only be used when
+the destination host can be resolved to an IPv4 address.
+The other protocols pass the destination as a string to be interpreted
+by the remote proxy and do not have this limitation.
.It Fl x Ar proxy_address Ns Op : Ns Ar port
Connect to
.Ar destination
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netcat-openbsd-1.229/netcat.c
new/netcat-openbsd-1.239/netcat.c
--- old/netcat-openbsd-1.229/netcat.c 2025-04-27 22:13:07.000000000 +0200
+++ new/netcat-openbsd-1.239/netcat.c 2026-10-20 05:29:09.000000000 +0200
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.229 2024/11/02 17:19:27 tb Exp $ */
+/* $OpenBSD: netcat.c,v 1.239 2026/09/20 17:47:16 beck Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <[email protected]>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -108,6 +108,7 @@
char *tls_expecthash; /* required hash of peer cert */
char *tls_ciphers; /* TLS ciphers */
char *tls_protocols; /* TLS protocols */
+char *tls_alpn; /* TLS ALPN */
FILE *Zflag; /* file to save peer cert */
int recvcount, recvlimit;
@@ -190,6 +191,8 @@
socksv = -1; /* HTTP proxy CONNECT */
else if (strcmp(optarg, "4") == 0)
socksv = 4; /* SOCKS v.4 */
+ else if (strcasecmp(optarg, "4A") == 0)
+ socksv = 44; /* SOCKS v.4A */
else if (strcmp(optarg, "5") == 0)
socksv = 5; /* SOCKS v.5 */
else
@@ -378,6 +381,8 @@
*/
} else {
if (family == AF_UNIX) {
+ if (unveil("/tmp", "rwc") == -1)
+ err(1, "unveil /tmp");
if (unveil(host, "rwc") == -1)
err(1, "unveil %s", host);
if (uflag && !kflag) {
@@ -397,7 +402,7 @@
}
if (family == AF_UNIX) {
- if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
+ if (pledge("stdio rpath wpath cpath unix", NULL) == -1)
err(1, "pledge");
} else if (Fflag && Pflag) {
if (pledge("stdio inet dns sendfd tty", NULL) == -1)
@@ -532,6 +537,8 @@
errx(1, "%s", tls_config_error(tls_cfg));
if (tls_config_set_ciphers(tls_cfg, tls_ciphers) == -1)
errx(1, "%s", tls_config_error(tls_cfg));
+ if (tls_alpn != NULL && tls_config_set_alpn(tls_cfg, tls_alpn)
== -1)
+ errx(1, "%s", tls_config_error(tls_cfg));
if (!lflag && (TLSopt & TLS_CCERT))
errx(1, "clientcert is only valid with -l");
if (TLSopt & TLS_NONAME)
@@ -1537,7 +1544,12 @@
/* Look up service name unless -n. */
if (!nflag) {
- sv = getservbyport(ntohs(atoi(port)), proto);
+ const char *errstr;
+
+ int p = strtonum(port, 1, PORT_MAX, &errstr);
+ if (errstr)
+ errx(1, "port number %s: %s", errstr, port);
+ sv = getservbyport(htons(p), proto);
if (sv != NULL)
service = sv->s_name;
}
@@ -1645,6 +1657,7 @@
{ "netcontrol", IPTOS_PREC_NETCONTROL },
{ "reliability", IPTOS_RELIABILITY },
{ "throughput", IPTOS_THROUGHPUT },
+ { "va", IPTOS_DSCP_VA },
{ NULL, -1 },
};
@@ -1669,11 +1682,12 @@
int flag;
char **value;
} *t, tlskeywords[] = {
+ { "alpn", -1, &tls_alpn },
{ "ciphers", -1, &tls_ciphers },
{ "clientcert", TLS_CCERT, NULL },
{ "muststaple", TLS_MUSTSTAPLE, NULL },
- { "noverify", TLS_NOVERIFY, NULL },
{ "noname", TLS_NONAME, NULL },
+ { "noverify", TLS_NOVERIFY, NULL },
{ "protocols", -1, &tls_protocols
},
{ NULL, -1, NULL },
};
@@ -1692,6 +1706,8 @@
errx(1, "invalid tls value `%s'", s);
*t->value = v;
} else {
+ if (v != NULL)
+ errx(1, "invalid tls value `%s'", s);
*flags |= t->flag;
}
return 1;
@@ -1706,7 +1722,7 @@
const char *pem;
size_t plen;
- if ((pem = tls_peer_cert_chain_pem(tls_ctx, &plen)) == NULL)
+ if ((pem = tls_peer_cert_unverified_bundle_pem(tls_ctx, &plen)) == NULL)
errx(1, "Can't get peer certificate");
if (fprintf(fp, "%.*s", (int)plen, pem) < 0)
err(1, "unable to save peer cert");
@@ -1718,7 +1734,7 @@
report_tls(struct tls *tls_ctx, char *host)
{
time_t t;
- const char *ocsp_url;
+ const char *alpn_proto, *ocsp_url;
fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n",
tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host);
@@ -1770,6 +1786,8 @@
tls_peer_ocsp_result(tls_ctx));
break;
}
+ if ((alpn_proto = tls_conn_alpn_selected(tls_ctx)) != NULL)
+ fprintf(stderr, "Application Layer Protocol: %s\n", alpn_proto);
}
void
@@ -1842,7 +1860,7 @@
\t-v Verbose\n\
\t-W recvlimit Terminate after receiving a number of packets\n\
\t-w timeout Timeout for connects and final net reads\n\
- \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\
+ \t-X proto Proxy protocol: \"4\", \"4A\", \"5\" (SOCKS) or
\"connect\"\n\
\t-x addr[:port]\tSpecify proxy address and port\n\
\t-Z Peer certificate file\n\
\t-z Zero-I/O mode [used for scanning]\n\
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netcat-openbsd-1.229/socks.c
new/netcat-openbsd-1.239/socks.c
--- old/netcat-openbsd-1.229/socks.c 2025-04-27 22:13:07.000000000 +0200
+++ new/netcat-openbsd-1.239/socks.c 2026-10-20 05:29:09.000000000 +0200
@@ -1,4 +1,4 @@
-/* $OpenBSD: socks.c,v 1.31 2022/06/08 20:20:26 djm Exp $ */
+/* $OpenBSD: socks.c,v 1.34 2025/05/22 06:40:26 djm Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -293,19 +293,33 @@
default:
errx(1, "connection failed, unsupported address type");
}
- } else if (socksv == 4) {
- /* This will exit on lookup failure */
- decode_addrport(host, port, (struct sockaddr *)&addr,
- sizeof(addr), 1, 0);
+ } else if (socksv == 4 || socksv == 44) {
+ if (socksv == 4) {
+ /* This will exit on lookup failure */
+ decode_addrport(host, port, (struct sockaddr *)&addr,
+ sizeof(addr), 1, 0);
+ }
/* Version 4 */
buf[0] = SOCKS_V4;
buf[1] = SOCKS_CONNECT; /* connect */
memcpy(buf + 2, &in4->sin_port, sizeof in4->sin_port);
- memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
+ if (socksv == 4) {
+ memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
+ } else {
+ /* SOCKS4A uses addr of 0.0.0.x, and hostname later */
+ buf[4] = buf[5] = buf[6] = 0;
+ buf[7] = 1;
+ }
buf[8] = 0; /* empty username */
wlen = 9;
-
+ if (socksv == 44) {
+ /* SOCKS4A has nul-terminated hostname after user */
+ if (strlcpy(buf + 9, host,
+ sizeof(buf) - 9) >= sizeof(buf) - 9)
+ errx(1, "hostname too big");
+ wlen = 9 + strlen(host) + 1;
+ }
cnt = atomicio(vwrite, proxyfd, buf, wlen);
if (cnt != wlen)
err(1, "write failed (%zu/%zu)", cnt, wlen);
@@ -373,16 +387,16 @@
/* Read status reply */
proxy_read_line(proxyfd, buf, sizeof(buf));
if (proxyuser != NULL &&
- (strncmp(buf, "HTTP/1.0 407 ", 12) == 0 ||
- strncmp(buf, "HTTP/1.1 407 ", 12) == 0)) {
+ (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 ||
+ strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) {
if (authretry > 1) {
fprintf(stderr, "Proxy authentication "
"failed\n");
}
close(proxyfd);
goto again;
- } else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 &&
- strncmp(buf, "HTTP/1.1 200 ", 12) != 0)
+ } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 &&
+ strncmp(buf, "HTTP/1.1 200 ", 13) != 0)
errx(1, "Proxy error: \"%s\"", buf);
/* Headers continue until we hit an empty line */
++++++ port-select-on-connect.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.880298129 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.886298380 +0100
@@ -1,8 +1,8 @@
-Index: netcat-openbsd-1.229/netcat.c
+Index: netcat-openbsd-1.239/netcat.c
===================================================================
---- netcat-openbsd-1.229.orig/netcat.c 2025-06-04 07:36:38.214088834 +0000
-+++ netcat-openbsd-1.229/netcat.c 2025-06-04 07:36:53.985608901 +0000
-@@ -1228,7 +1228,10 @@ remote_connect(const char *host, const c
+--- netcat-openbsd-1.239.orig/netcat.c
++++ netcat-openbsd-1.239/netcat.c
+@@ -1235,7 +1235,10 @@ remote_connect(const char *host, const c
ahints.ai_flags = AI_PASSIVE;
if ((error = getaddrinfo(sflag, pflag, &ahints, &ares)))
errx(1, "getaddrinfo: %s", gai_strerror(error));
++++++ port-to-linux-with-libbsd.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.900298965 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.904299132 +0100
@@ -11,7 +11,7 @@
4 files changed, 139 insertions(+), 63 deletions(-)
diff --git a/Makefile b/Makefile
-index 5f20c40..93ca5ee 100644
+index 5f20c40..2c92548 100644
--- a/Makefile
+++ b/Makefile
@@ -5,4 +5,18 @@ SRCS= netcat.c atomicio.c socks.c
@@ -20,7 +20,7 @@
-.include <bsd.prog.mk>
+PKG_CONFIG ?= pkg-config
-+LIBS= `$(PKG_CONFIG) --libs libbsd` -lresolv
++LIBS ?= `$(PKG_CONFIG) --libs libbsd` -lresolv
+OBJS= $(SRCS:.c=.o)
+CFLAGS= -g -O2
+LDFLAGS= -Wl,--no-add-needed
@@ -35,7 +35,7 @@
+clean:
+ rm -f $(OBJS) nc
diff --git a/nc.1 b/nc.1
-index 76b6dc0..596bd8e 100644
+index 2ffdcd1..75ac68b 100644
--- a/nc.1
+++ b/nc.1
@@ -213,8 +213,6 @@ Proxy authentication is only supported for HTTP CONNECT
proxies at present.
@@ -47,7 +47,7 @@
.It Fl R Ar CAfile
Load the root CA bundle for TLS certificate verification from
.Ar CAfile ,
-@@ -273,6 +271,7 @@ For the IPv4 TOS/IPv6 traffic class value,
+@@ -277,6 +275,7 @@ For the IPv4 TOS/IPv6 traffic class value,
may be one of
.Cm critical ,
.Cm inetcontrol ,
@@ -56,7 +56,7 @@
.Cm netcontrol ,
.Cm throughput ,
diff --git a/netcat.c b/netcat.c
-index 8c60fd1..d23e566 100644
+index af6124c..915a8b7 100644
--- a/netcat.c
+++ b/netcat.c
@@ -32,6 +32,8 @@
@@ -127,7 +127,7 @@
#include "atomicio.h"
-@@ -269,10 +316,14 @@ main(int argc, char *argv[])
+@@ -272,10 +319,14 @@ main(int argc, char *argv[])
uflag = 1;
break;
case 'V':
@@ -142,7 +142,7 @@
break;
case 'v':
vflag = 1;
-@@ -321,7 +372,11 @@ main(int argc, char *argv[])
+@@ -324,7 +375,11 @@ main(int argc, char *argv[])
oflag = optarg;
break;
case 'S':
@@ -154,7 +154,7 @@
break;
case 'T':
errstr = NULL;
-@@ -346,13 +401,22 @@ main(int argc, char *argv[])
+@@ -349,13 +404,22 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
@@ -177,12 +177,12 @@
} else if (argc == 1 && lflag) {
uport = argv[0];
} else if (argc == 2) {
-@@ -396,33 +460,6 @@ main(int argc, char *argv[])
+@@ -401,33 +465,6 @@ main(int argc, char *argv[])
}
}
- if (family == AF_UNIX) {
-- if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
+- if (pledge("stdio rpath wpath cpath unix", NULL) == -1)
- err(1, "pledge");
- } else if (Fflag && Pflag) {
- if (pledge("stdio inet dns sendfd tty", NULL) == -1)
@@ -211,7 +211,7 @@
if (!lflag && kflag)
errx(1, "must use -l with -k");
if (uflag && usetls)
-@@ -579,10 +616,6 @@ main(int argc, char *argv[])
+@@ -586,10 +623,6 @@ main(int argc, char *argv[])
if (s == -1)
err(1, NULL);
if (uflag && kflag) {
@@ -222,7 +222,7 @@
/*
* For UDP and -k, don't connect the socket,
* let it receive datagrams from multiple
-@@ -609,10 +642,6 @@ main(int argc, char *argv[])
+@@ -616,10 +649,6 @@ main(int argc, char *argv[])
if (rv == -1)
err(1, "connect");
@@ -233,7 +233,7 @@
if (vflag)
report_sock("Connection received",
(struct sockaddr *)&z, len,
-@@ -938,8 +967,10 @@ remote_connect(const char *host, const char *port, struct
addrinfo hints,
+@@ -945,8 +974,10 @@ remote_connect(const char *host, const char *port, struct
addrinfo hints,
if (sflag || pflag) {
struct addrinfo ahints, *ares;
@@ -244,7 +244,7 @@
memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
-@@ -1052,9 +1083,15 @@ local_listen(const char *host, const char *port, struct
addrinfo hints)
+@@ -1059,9 +1090,15 @@ local_listen(const char *host, const char *port, struct
addrinfo hints)
res->ai_protocol)) == -1)
continue;
@@ -260,7 +260,7 @@
set_common_sockopts(s, res->ai_family);
-@@ -1559,11 +1596,13 @@ set_common_sockopts(int s, int af)
+@@ -1571,11 +1608,13 @@ set_common_sockopts(int s, int af)
{
int x = 1;
@@ -274,7 +274,7 @@
if (Dflag) {
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
&x, sizeof(x)) == -1)
-@@ -1574,9 +1613,14 @@ set_common_sockopts(int s, int af)
+@@ -1586,9 +1625,14 @@ set_common_sockopts(int s, int af)
IP_TOS, &Tflag, sizeof(Tflag)) == -1)
err(1, "set IP ToS");
@@ -289,7 +289,7 @@
}
if (Iflag) {
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
-@@ -1594,19 +1638,34 @@ set_common_sockopts(int s, int af)
+@@ -1606,19 +1650,34 @@ set_common_sockopts(int s, int af)
IP_TTL, &ttl, sizeof(ttl)))
err(1, "set IP TTL");
@@ -324,7 +324,7 @@
}
}
-@@ -1641,6 +1700,7 @@ process_tos_opt(char *s, int *val)
+@@ -1653,6 +1712,7 @@ process_tos_opt(char *s, int *val)
{ "cs7", IPTOS_DSCP_CS7 },
{ "ef", IPTOS_DSCP_EF },
{ "inetcontrol", IPTOS_PREC_INTERNETCONTROL },
@@ -332,7 +332,7 @@
{ "lowdelay", IPTOS_LOWDELAY },
{ "netcontrol", IPTOS_PREC_NETCONTROL },
{ "reliability", IPTOS_RELIABILITY },
-@@ -1805,6 +1865,9 @@ report_sock(const char *msg, const struct sockaddr *sa,
socklen_t salen,
+@@ -1823,6 +1883,9 @@ report_sock(const char *msg, const struct sockaddr *sa,
socklen_t salen,
void
help(void)
{
@@ -342,7 +342,7 @@
usage(0);
fprintf(stderr, "\tCommand Summary:\n\
\t-4 Use IPv4\n\
-@@ -1847,7 +1910,7 @@ help(void)
+@@ -1865,7 +1928,7 @@ help(void)
\t-Z Peer certificate file\n\
\t-z Zero-I/O mode [used for scanning]\n\
Port numbers can be individual or ranges: lo-hi [inclusive]\n");
@@ -352,7 +352,7 @@
void
diff --git a/socks.c b/socks.c
-index 7c7448c..8db10d4 100644
+index 1f1fb96..d2bcfda 100644
--- a/socks.c
+++ b/socks.c
@@ -38,7 +38,7 @@
@@ -407,8 +407,8 @@
break;
default:
errx(1, "connection failed, unsupported address type");
-@@ -308,11 +308,11 @@ socks_connect(const char *host, const char *port,
-
+@@ -322,11 +322,11 @@ socks_connect(const char *host, const char *port,
+ }
cnt = atomicio(vwrite, proxyfd, buf, wlen);
if (cnt != wlen)
- err(1, "write failed (%zu/%zu)", cnt, wlen);
@@ -421,7 +421,7 @@
if (buf[1] != 90) {
errx(1, "connection failed, SOCKSv4 error: %s",
socks4_strerror(buf[1]));
-@@ -326,21 +326,21 @@ socks_connect(const char *host, const char *port,
+@@ -340,21 +340,21 @@ socks_connect(const char *host, const char *port,
/* Try to be sane about numeric IPv6 addresses */
if (strchr(host, ':') != NULL) {
@@ -447,7 +447,7 @@
if (authretry > 1) {
char proxypass[256];
-@@ -348,20 +348,20 @@ socks_connect(const char *host, const char *port,
+@@ -362,20 +362,20 @@ socks_connect(const char *host, const char *port,
getproxypass(proxyuser, proxyhost,
proxypass, sizeof proxypass);
@@ -473,27 +473,27 @@
explicit_bzero(proxypass, sizeof proxypass);
explicit_bzero(buf, sizeof buf);
}
-@@ -371,23 +371,23 @@ socks_connect(const char *host, const char *port,
+@@ -385,23 +385,23 @@ socks_connect(const char *host, const char *port,
err(1, "write failed (%zu/2)", cnt);
/* Read status reply */
- proxy_read_line(proxyfd, buf, sizeof(buf));
+ proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
if (proxyuser != NULL &&
-- (strncmp(buf, "HTTP/1.0 407 ", 12) == 0 ||
-- strncmp(buf, "HTTP/1.1 407 ", 12) == 0)) {
-+ (strncmp((char*)buf, "HTTP/1.0 407 ", 12) == 0 ||
-+ strncmp((char*)buf, "HTTP/1.1 407 ", 12) == 0)) {
+- (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 ||
+- strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) {
++ (strncmp((char*)buf, "HTTP/1.0 407 ", 13) == 0 ||
++ strncmp((char*)buf, "HTTP/1.1 407 ", 13) == 0)) {
if (authretry > 1) {
fprintf(stderr, "Proxy authentication "
"failed\n");
}
close(proxyfd);
goto again;
-- } else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 &&
-- strncmp(buf, "HTTP/1.1 200 ", 12) != 0)
-+ } else if (strncmp((char*)buf, "HTTP/1.0 200 ", 12) != 0 &&
-+ strncmp((char*)buf, "HTTP/1.1 200 ", 12) != 0)
+- } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 &&
+- strncmp(buf, "HTTP/1.1 200 ", 13) != 0)
++ } else if (strncmp((char*)buf, "HTTP/1.0 200 ", 13) != 0 &&
++ strncmp((char*)buf, "HTTP/1.1 200 ", 13) != 0)
errx(1, "Proxy error: \"%s\"", buf);
/* Headers continue until we hit an empty line */
++++++ quit-timer.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.918299717 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.922299884 +0100
@@ -8,7 +8,7 @@
2 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/nc.1 b/nc.1
-index 478fedd..fbcc098 100644
+index 5c12630..1724081 100644
--- a/nc.1
+++ b/nc.1
@@ -41,6 +41,7 @@
@@ -36,7 +36,7 @@
Choose source and/or destination ports randomly
instead of sequentially within a range or in the order that the system
diff --git a/netcat.c b/netcat.c
-index 2f3e9a8..03d339c 100644
+index c8e1ec5..4d70e2a 100644
--- a/netcat.c
+++ b/netcat.c
@@ -139,6 +139,7 @@ int Nflag; /*
shutdown() network socket */
@@ -47,7 +47,7 @@
int rflag; /* Random ports flag */
char *sflag; /* Source Address */
int tflag; /* Telnet Emulation */
-@@ -223,6 +224,7 @@ ssize_t fillbuf(int, unsigned char *, size_t *);
+@@ -224,6 +225,7 @@ ssize_t fillbuf(int, unsigned char *, size_t *);
#endif
static int connect_with_timeout(int, const struct sockaddr *, socklen_t, int);
@@ -55,7 +55,7 @@
int
main(int argc, char *argv[])
-@@ -255,9 +257,9 @@ main(int argc, char *argv[])
+@@ -256,9 +258,9 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv,
#ifdef HAVE_TLS
@@ -67,7 +67,7 @@
#endif
!= -1) {
switch (ch) {
-@@ -349,6 +351,13 @@ main(int argc, char *argv[])
+@@ -352,6 +354,13 @@ main(int argc, char *argv[])
case 'p':
pflag = optarg;
break;
@@ -81,7 +81,7 @@
#ifdef HAVE_TLS
case 'R':
tls_cachanged = 1;
-@@ -1335,15 +1344,27 @@ readwrite(int net_fd)
+@@ -1342,15 +1351,27 @@ readwrite(int net_fd)
while (1) {
/* both inputs are gone, buffers are empty, we are done */
if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 &&
@@ -115,7 +115,7 @@
/* poll */
num_fds = poll(pfd, 4, timeout);
-@@ -1500,6 +1521,13 @@ readwrite(int net_fd)
+@@ -1507,6 +1528,13 @@ readwrite(int net_fd)
if (pfd[POLL_NETOUT].fd != -1 && Nflag)
shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
pfd[POLL_NETOUT].fd = -1;
@@ -129,7 +129,7 @@
}
/* net in gone and queue empty? */
if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) {
-@@ -2106,6 +2134,7 @@ help(void)
+@@ -2124,6 +2152,7 @@ help(void)
\t-O length TCP send buffer length\n\
\t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\
@@ -137,7 +137,7 @@
\t-r Randomize remote ports\n\
\t-S Enable the TCP MD5 signature option\n\
\t-s sourceaddr Local source address\n\
-@@ -2130,10 +2159,18 @@ usage(int ret)
+@@ -2148,10 +2177,18 @@ usage(int ret)
fprintf(stderr,
"usage: nc [-46CDdFhklNnrStUuvz] [-I length] [-i interval] [-M
ttl]\n"
"\t [-m minttl] [-O length] [-P proxy_username] [-p source_port]\n"
++++++ send-crlf.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.935300428 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.938300553 +0100
@@ -8,7 +8,7 @@
2 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/nc.1 b/nc.1
-index 2eb732e..478fedd 100644
+index d285e62..5c12630 100644
--- a/nc.1
+++ b/nc.1
@@ -33,7 +33,7 @@
@@ -32,7 +32,7 @@
.It Fl D
Enable debugging on the socket.
.It Fl d
-@@ -380,7 +385,7 @@ More complicated examples can be built up when the user
knows the format
+@@ -386,7 +391,7 @@ More complicated examples can be built up when the user
knows the format
of requests required by the server.
As another example, an email may be submitted to an SMTP server using:
.Bd -literal -offset indent
@@ -42,19 +42,19 @@
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
diff --git a/netcat.c b/netcat.c
-index 2dc1abd..2f3e9a8 100644
+index a9a38c5..c8e1ec5 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -166,6 +166,8 @@ char *tls_expecthash; /*
required hash of peer cert */
- char *tls_ciphers; /* TLS ciphers */
+@@ -167,6 +167,8 @@ char *tls_ciphers; /* TLS
ciphers */
char *tls_protocols; /* TLS protocols */
+ char *tls_alpn; /* TLS ALPN */
FILE *Zflag; /* file to save peer cert */
+#else
+int Cflag = 0; /* CRLF line-ending */
#endif
int recvcount, recvlimit;
-@@ -216,7 +218,7 @@ ssize_t fillbuf(int, unsigned char *, size_t *, struct tls
*);
+@@ -217,7 +219,7 @@ ssize_t fillbuf(int, unsigned char *, size_t *, struct tls
*);
void tls_setup_client(struct tls *, int, char *);
struct tls *tls_setup_server(struct tls *, int, char *);
#else
@@ -63,7 +63,7 @@
ssize_t fillbuf(int, unsigned char *, size_t *);
#endif
-@@ -255,7 +257,7 @@ main(int argc, char *argv[])
+@@ -256,7 +258,7 @@ main(int argc, char *argv[])
#ifdef HAVE_TLS
"46C:cDde:FH:hI:i:K:klM:m:NnO:o:P:p:R:rSs:T:tUuV:vW:w:X:x:Z:z"))
#else
@@ -72,7 +72,7 @@
#endif
!= -1) {
switch (ch) {
-@@ -285,6 +287,10 @@ main(int argc, char *argv[])
+@@ -288,6 +290,10 @@ main(int argc, char *argv[])
case 'c':
usetls = 1;
break;
@@ -83,7 +83,7 @@
#endif
case 'd':
dflag = 1;
-@@ -1339,12 +1345,6 @@ readwrite(int net_fd)
+@@ -1346,12 +1352,6 @@ readwrite(int net_fd)
stdinbufpos == 0 && netinbufpos == 0)
return;
@@ -96,7 +96,7 @@
/* poll */
num_fds = poll(pfd, 4, timeout);
-@@ -1424,7 +1424,7 @@ readwrite(int net_fd)
+@@ -1431,7 +1431,7 @@ readwrite(int net_fd)
pfd[POLL_NETOUT].events = POLLOUT;
else
#else
@@ -105,7 +105,7 @@
#endif
if (ret == -1)
pfd[POLL_NETOUT].fd = -1;
-@@ -1483,7 +1483,7 @@ readwrite(int net_fd)
+@@ -1490,7 +1490,7 @@ readwrite(int net_fd)
pfd[POLL_STDOUT].events = POLLOUT;
else
#else
@@ -114,7 +114,7 @@
#endif
if (ret == -1)
pfd[POLL_STDOUT].fd = -1;
-@@ -1509,36 +1509,43 @@ readwrite(int net_fd)
+@@ -1516,36 +1516,43 @@ readwrite(int net_fd)
}
ssize_t
@@ -179,7 +179,7 @@
/* adjust buffer */
adjust = *bufpos - n;
if (adjust > 0)
-@@ -2083,6 +2090,7 @@ help(void)
+@@ -2101,6 +2108,7 @@ help(void)
fprintf(stderr, "\tCommand Summary:\n\
\t-4 Use IPv4\n\
\t-6 Use IPv6\n\
@@ -187,7 +187,7 @@
\t-D Enable the debug socket option\n\
\t-d Detach from stdin\n\
\t-F Pass socket fd\n\
-@@ -2120,7 +2128,7 @@ void
+@@ -2138,7 +2146,7 @@ void
usage(int ret)
{
fprintf(stderr,
++++++ serialized-handling-multiple-clients.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.951301096 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.958301389 +0100
@@ -7,10 +7,10 @@
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/netcat.c b/netcat.c
-index 99747a2..8291173 100644
+index fba472d..8b586d8 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -713,7 +713,10 @@ main(int argc, char *argv[])
+@@ -720,7 +720,10 @@ main(int argc, char *argv[])
s = unix_bind(host, 0);
else
s = unix_listen(host);
@@ -22,7 +22,7 @@
#ifdef HAVE_TLS
if (usetls) {
-@@ -727,13 +730,6 @@ main(int argc, char *argv[])
+@@ -734,13 +737,6 @@ main(int argc, char *argv[])
#endif
/* Allow only one connection at a time, but stay alive. */
for (;;) {
@@ -36,7 +36,7 @@
if (uflag && kflag) {
/*
* For UDP and -k, don't connect the socket,
-@@ -807,8 +803,11 @@ main(int argc, char *argv[])
+@@ -814,8 +810,11 @@ main(int argc, char *argv[])
#endif
}
++++++ set-TCP-MD5SIG-correctly-for-client-connections.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.969301849 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.973302016 +0100
@@ -7,7 +7,7 @@
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/netcat.c b/netcat.c
-index 8291173..990c31b 100644
+index 8b586d8..c453f6b 100644
--- a/netcat.c
+++ b/netcat.c
@@ -46,6 +46,9 @@
@@ -20,7 +20,7 @@
#ifndef IPTOS_LOWDELAY
# define IPTOS_LOWDELAY 0x10
-@@ -175,6 +178,9 @@ FILE *Zflag; /* file
to save peer cert */
+@@ -176,6 +179,9 @@ FILE *Zflag; /* file
to save peer cert */
int Cflag = 0; /* CRLF line-ending */
#endif
@@ -30,16 +30,16 @@
int recvcount, recvlimit;
int timeout = -1;
int family = AF_UNSPEC;
-@@ -206,7 +212,7 @@ void connection_info(const char *, const char *,
const char *, const char *);
+@@ -207,7 +213,7 @@ void connection_info(const char *, const char *,
const char *, const char *);
int unix_bind(char *, int);
int unix_connect(char *);
int unix_listen(char *);
-void set_common_sockopts(int, int);
-+void set_common_sockopts(int, const struct sockaddr *);
++void set_common_sockopts(int, const struct sockaddr *, socklen_t);
int process_tos_opt(char *, int *);
#ifdef HAVE_TLS
int process_tls_opt(char *, int *);
-@@ -456,7 +462,10 @@ main(int argc, char *argv[])
+@@ -459,7 +465,10 @@ main(int argc, char *argv[])
break;
#endif
case 'S':
@@ -51,37 +51,37 @@
Sflag = 1;
#else
errx(1, "no TCP MD5 signature support available");
-@@ -1161,7 +1170,7 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
+@@ -1168,7 +1177,7 @@ remote_connect(const char *host, const char *port,
struct addrinfo hints,
freeaddrinfo(ares);
}
- set_common_sockopts(s, res->ai_family);
-+ set_common_sockopts(s, res->ai_addr);
++ set_common_sockopts(s, res->ai_addr, res->ai_addrlen);
if (ipaddr != NULL) {
herr = getnameinfo(res->ai_addr, res->ai_addrlen,
-@@ -1336,7 +1345,7 @@ local_listen(const char *host, const char *port, struct
addrinfo hints)
+@@ -1343,7 +1352,7 @@ local_listen(const char *host, const char *port, struct
addrinfo hints)
err(1, NULL);
#endif
- set_common_sockopts(s, res->ai_family);
-+ set_common_sockopts(s, res->ai_addr);
++ set_common_sockopts(s, res->ai_addr, res->ai_addrlen);
if (bind(s, (struct sockaddr *)res->ai_addr,
res->ai_addrlen) == 0)
-@@ -1910,9 +1919,10 @@ connection_info(const char *host, const char *port,
const char *proto,
+@@ -1922,9 +1931,10 @@ connection_info(const char *host, const char *port,
const char *proto,
}
void
-set_common_sockopts(int s, int af)
-+set_common_sockopts(int s, const struct sockaddr* sa)
++set_common_sockopts(int s, const struct sockaddr* sa, socklen_t sa_len)
{
int x = 1;
+ int af = sa->sa_family;
#ifdef SO_BROADCAST
if (bflag) {
-@@ -1923,10 +1933,18 @@ set_common_sockopts(int s, int af)
+@@ -1935,10 +1945,18 @@ set_common_sockopts(int s, int af)
err(1, NULL);
}
#endif
@@ -92,7 +92,7 @@
- &x, sizeof(x)) == -1)
+ struct tcp_md5sig sig;
+ memset(&sig, 0, sizeof(sig));
-+ memcpy(&sig.tcpm_addr, sa, sizeof(struct sockaddr_storage));
++ memcpy(&sig.tcpm_addr, sa, sa_len);
+ sig.tcpm_keylen = TCP_MD5SIG_MAXKEYLEN < strlen(Sflag_password)
+ ? TCP_MD5SIG_MAXKEYLEN
+ : strlen(Sflag_password);
++++++ udp-scan-timeout.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:38.985302517 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:38.988302643 +0100
@@ -7,7 +7,7 @@
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/netcat.c b/netcat.c
-index 03d339c..dd893ac 100644
+index 4d70e2a..cb7db2d 100644
--- a/netcat.c
+++ b/netcat.c
@@ -129,6 +129,8 @@
@@ -19,7 +19,7 @@
/* Command Line Options */
int dflag; /* detached, no stdin */
int Fflag; /* fdpass sock to stdout */
-@@ -1794,19 +1796,24 @@ build_ports(char *p)
+@@ -1801,19 +1803,24 @@ build_ports(char *p)
int
udptest(int s)
{
++++++ use-flags-to-specify-listen-address.patch ++++++
--- /var/tmp/diff_new_pack.ZXX7Bo/_old 2026-12-01 16:58:39.001303186 +0100
+++ /var/tmp/diff_new_pack.ZXX7Bo/_new 2026-12-01 16:58:39.005303353 +0100
@@ -8,7 +8,7 @@
2 files changed, 45 insertions(+), 20 deletions(-)
diff --git a/nc.1 b/nc.1
-index 80c654c..d30389a 100644
+index ed659b4..91b719e 100644
--- a/nc.1
+++ b/nc.1
@@ -143,8 +143,20 @@ multiple hosts.
@@ -44,10 +44,10 @@
.It Fl T Ar keyword
Change the IPv4 TOS/IPv6 traffic class value.
diff --git a/netcat.c b/netcat.c
-index bef27a4..0caba28 100644
+index 26e9b8d..faa3353f 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -507,27 +507,42 @@ main(int argc, char *argv[])
+@@ -510,27 +510,42 @@ main(int argc, char *argv[])
#endif
/* Cruft to make sure options are clean, and used properly. */