commit 64ff80cac56f4db8c790370a3977837304850f90
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Jan 20 15:17:28 2024 +1100

    Keep going on error getting verbose info

    `nc -4 -k -l -q0 -p1042 -u -v` would exit with
    "nc: getnameinfo: Temporary failure in name resolution".
    That error is fixed now (reports "Bound to localhost 1042") but have audited
    (no_return) calls to err() and errx() to not use them when getting info for
    a verbose message.

commit 251def46872eb65b82d38895b3fc991ffda11ea5 (tag: 7.4-1)
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Fri Nov 24 16:16:42 2023 +1100

    Stop hang after EOF from pipe

    `nc -4 -q0 -u localhost 1042 <<<XXXX` would send XXXX but nc would not then
    exit despite option `-q0`. Further investigation showed this would happen
    whenever stdin was a pipe.

    nc only reads from stdin when poll(2) returns POLLIN for fd0.

    After nc reads the last characters from a pipe, poll() only returns
    POLLHUP, rather than POLLIN|POLLHUP. So nc was not doing another read()
    which would have returned zero bytes signalling EOF.

    Make it look like that last read() was done.

commit c9a384ba134d7b0f6d0872a215822f3780a6288d
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Thu Nov 23 09:37:52 2023 +1100

    Manually merge OpenBSD 7.4 updates

    Also outdent a block of code that was in 1 level too many

    OpenBSD commit message was:

	netcat: avoid issuing syscalls on fd -1

	In case a socket error condition occurs, readwrite() invalidates the
	corresponding fd. Later on, readwrite() may still issue a syscall on
	it. Avoid that by adding a couple of checks for fd == -1.

	Reported and fix suggested by Leah Neukirchen.
	Fixes https://github.com/libressl/openbsd/issues/143

	"looks right" deraadt

    1 of the 4 code changes was already done (differently). Apply other 3.

    This brings netcat.c up to CVS revision 1.226
    (current, as of 2023-11-24).

commit 365befed5f276325efabed59b64c529a42da4b1b (tag: 7.3-1)
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Mon May 22 14:16:26 2023 +1000

    Display abstract socket names correctly

    Because names start with NUL, display '@' followed by 2nd name char onwards.
    Also take care not to display more characters than actual name length.
    (Required for verbose listener when client has shorter abstract name than
    previous client).

commit fc9f6378d56640b49dec9d0c4537f5b104c0ed56
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat May 20 15:02:18 2023 +1000

    v7.2_3C: Don't unlink an abstract socket

commit b9f556b74dc6a4c3f8127891c9cc06742d8d7ca0
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat May 20 14:25:06 2023 +1000

    Put netcat version in netcat.c

commit a2476392baf6c4063641ac2cbeb4970e51887a59
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat May 20 13:41:14 2023 +1000

    Incorporate new Debian abstract-unix-domain-socket patch

    Not tested yet and may well clash with local changes

commit 4ff38b09604c66043374a36a1625f9c2de23a6fe
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Fri May 19 17:25:12 2023 +1000

    Re-order a dcl for Debian abstract-unix-domain-socket patch

    So hunk 2 succeeds

commit aa9367531701903b13d80267486dceb8cb1a43ca
Author: deraadt <deraadt@openbsd.org>
Date:   Wed Jan 4 12:53:38 2023 +0000

    ugly white space

    This brings netcat.c up to CVS revision 1.225
    (current, as of 2023-05-22).

commit 51da88812757ce71b58e227f8a3da6ce7512ff55
Author: tb <tb@openbsd.org>
Date:   Sun Dec 18 12:53:18 2022 +0000

    nc: skip connection info on failed or skipped udptest()

    In udp mode, nc would always print that the connected succeeded
    independently of whether that was actually the case. Don't do that.

    idea/ok mpf

commit fd97b71cbb91a5031b6f0d431e423ba4b8755ff7
Author: tb <tb@openbsd.org>
Date:   Sun Dec 18 12:51:10 2022 +0000

    nc: do not test the connection in non-interactive mode

    The connection test writes four X to the socket, which corrupts data
    that we may want to pipe into nc. So don't do that if stdin is not a
    tty but still do it in scan mode, this is needed according to chris.

    based on a diff by and ok mpf

commit 8f4fd9762f28901514fa6390a9510ef4bee21035
Author: tb <tb@openbsd.org>
Date:   Sun Dec 18 12:48:28 2022 +0000

    nc: clean up and simplify connection_infO()

    ok mpf as part of a larger diff

commit fce8d76c1bdfe9ef87cde39127403b7a709d64d5
Author: tb <tb@openbsd.org>
Date:   Sun Dec 18 12:47:31 2022 +0000

    nc: pass protocol name to connection_info()

    Avoids repeated use of ternary operator on globals.

commit 836e78ae73cc668ca5e5f1ceb5ad23cf9de47762
Author: tb <tb@openbsd.org>
Date:   Tue Feb 14 12:28:11 2023 +1100

    nc: factor printing of connection info into a function

    This simply moves a chunk of code in this spaghetti mess into its own
    function with minimal changes.

    idea from a diff by mpf

commit 599de1f0e665a26b518bff0c05418ab2041da511
Author: tb <tb@openbsd.org>
Date:   Tue Feb 14 14:00:04 2023 +1100

    KNF, mostly whitespace - no binary change on amd64

commit d7dacb5533172bb360b2ab6d8ba68905ab482031 (tag: 7.2-2)
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Tue Dec 20 09:50:06 2022 +1100

    Enable exchange of maximum-length UDP packets

    Increase buffer size to 64K, the maximum length of a UDP message.

commit 6c7d785004b243c7d422fbd5428e8971b22952cd
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sun Dec 11 12:58:43 2022 +1100

    Make AF_UNIX UDP sockets behave more like IP ones

    IP client and single-shot server instances have always exited after sending
    a UDP message to a peer that has disappeared.
    AF_UNIX instances would just hang around, not reading from STDIN.
    The difference was that AF_UNIX write() gets an error when peer has gone but
    IP write() succeeds, with POLLERR showing up in the next poll(),
    triggering exit.
    Multi-shot AF_UNIX listeners (-k option) would show data from new clients
    but couldn't respond because they had also stopped reading STDIN.
    The single-shotters now exit on network write error while multi-shot server
    makes it look like error never happened.

commit e2b141f5deaf30626da0755ad4ab54df2a844aaa (tag: 7.2-1)
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sun Dec 11 14:22:37 2022 +1100

    Update README.md

    No longer have branches for OpenBSD revisions.

commit 0ab8751ac22df156fd8ee657e02384f2b7fa3e38
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Dec 3 17:56:12 2022 +1100

    Remove all code conditionally compiled on ifdef TLS

commit e690256b03389a7ec5216bff916e0f1a6fc24986
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Dec 3 16:54:39 2022 +1100

    Cherry-pick OpenBSD 7.2 updates

    The changes to netcat.c were purely whitespace and not adopted.

commit e2db78d2f1ec864fe004688b668680277bc0d5ee
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Wed Apr 27 11:32:35 2022 +1000

    Delete client AF_UNIX socket on exit whether temporary or not

    This is what the OpenBSD netcat used to do (except ctl-C, which now works)

commit 6daecd2a49ccd93fd6402b40acf4b92e1d1c6ff8
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Mon Apr 18 20:59:05 2022 +1000

    Split all lines >80cc

commit 65e96482d9ec8c5303b544c6c6bfeed71017be7d
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Mon Apr 18 16:37:03 2022 +1000

    Delete temporary AF_UNIX socket on exit

    There was code to delete the AF_UNIX socket of a client whether temporary or
    not but this relied on readwrite() returning.
    Some recent enhancements can make readwrite() exit directly
    e.g. -q0 then ^D, so make sure to at least delete a socket in /tmp.
    With the signal handler introduced in 3569cd0e, the socket is
    also deleted on control-C.

    The quit() function had the wrong signature for a signal handler: fix.

commit 06e096c72f5b260e3ca68fbd340227b25c185c74
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Apr 16 17:17:15 2022 +1000

    Eliminate one "magic number"

    Instead of defining UNIX_DG_TMP_SOCKET_SIZE to 19, define the temp string
    and define UNIX_DG_TMP_SOCKET_SIZE to the size of that string.

commit 3569cd0e9c106907eac250395a88caadc9b720c6
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Apr 16 08:48:51 2022 +1000

    Add signal handler to exit normally on ^C / SIGINT

commit 0c998dba845e64f74aef6a2726123f94eb80ec82
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Fri Apr 8 16:25:59 2022 +1000

    Listener displays AF_UNIX caller names correctly

    (i.e. when verbose is asserted)

commit 31fd7cf7ec8254e18576d33de764797e5b36710e
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Fri Apr 8 16:19:37 2022 +1000

    Code only checks once whether to use sendto / recvfrom

    (i.e. instead of checking on every packet)

commit ed4e3ece430fd11162b7c4ee71ac42b2800e113d
Author: beck <beck@openbsd.org>
Date:   Mon Jul 12 15:09:18 2021 +0000

    Change the error reporting pattern throughout the tree when unveil fails to
    report the path that the failure occured on.
    Suggested by deraadt@ after some tech discussion.

    Work done and verified by Ashton Fagg <ashton@fagg.id.au>

    ok deraadt@ semarie@ claudio@

commit d25c6b632b04e3774d7f32b0a36a233351b8dec9
Author: jmc <jmc@openbsd.org>
Date:   Wed Mar 31 20:41:35 2021 +0000

    one of the examples needs an -N (and explanation); diff from robert scheck

    discussed with and tweaked by sthen

commit b8c68eb8d76a5d482508ccbd4a3b51735db65009 (tag: 1.217-1)
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Apr 4 15:31:51 2020 +1100

    nc -h outputs revision stamp

commit b81812abe0307594583de0985a768f2e8bb4c337
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Fri Apr 3 10:43:36 2020 +1100

    Ensure lines output by nc -h do not exceed 80 chars in length

commit 69fffc50a10b28d19d5652ca6ecb22349a519bc4
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 19:06:52 2012 +0800

    Misc failures and features (Debian patch)

commit 7dd257a132d4d14ea22f8ffdb70d5bb63a25868b
Author: Guilhem Moulin <guilhem@debian.org>
Date:   Mon Oct 22 04:50:54 2018 +0200

    Use -s/-p flags to specify listen address (Debian patch)

    The patch is somewhat modified because of openbsd changes
    between 1.206 & 1.217.

    In particular, they removed uport = NULL and host = NULL,
    so the updated patch does not reinstate them.

commit f596ae156499e9cf7ba85ca796b52590482ca1cd
Author: Guilhem Moulin <guilhem@debian.org>
Date:   Mon Oct 22 04:15:52 2018 +0200

    Destination port list (Debian patch)

commit 9f5e6574123b84c3bb30e024fa33e9d158f0331a
Author: Thomas Habets <habets@google.com>
Date:   Sat Feb 18 21:07:22 2017 +0000

    Set TCP MD5SIG correctly for client connections (Debian patch)

commit e2c9a92035f06b75f3213776ca39819440080870
Author: Aron Xu <aron@debian.org>
Date:   Tue Feb 14 23:02:00 2012 +0800

    Serialized handling multiple clients (Debian patch)

commit 4e8b05eef6cc3368cfb1657c919895216a9be150
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 15:56:51 2012 +0800

    Broadcast support (Debian patch)

commit 5bbafee4b00ffa01b778aca0cb15bf3787911937
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 15:56:51 2012 +0800

    Dccp support (Debian patch)

commit 64ecd1b1631b96b85ea3e08b8d70687511d96d1a
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 15:29:37 2012 +0800

    Udp scan timeout (Debian patch)

commit 98489bbca147fc449ee957a8d33212044dd3fefe
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 15:16:04 2012 +0800

    Quit timer (Debian patch, updated)

    This is the Debian quit timer patch, but with -q option re-worked.

    -N only does a shutdown of net out, as it used to.
    In the case of a tcp -N client and server w/out -k,
    client ^D causes the server to shut down due to an asymmetry in the code.
    Server shutdown then causes the client to shut down.
    This is the only case where -N appears to operate like -q0.

    Implementation detail:
    there is a new ctrld_seen flag to explicitly record ^D (or end of file).

commit 97f95cc4c98d46d96146da3d3f6a42529f1b6c20
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 14:57:45 2012 +0800

    Send crlf (Debian patch)

commit 64b7bf789faeb07ccfc3b99fbbe208094d0856b2
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 14:45:08 2012 +0800

    Get sev by name (Debian patch)

commit f257188e08780e5bfaaf8f44c0595f93a4bc769e
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 14:43:56 2012 +0800

    Connect timeout (Debian patch, updated)

    This is the Debian connect timeout patch to use select's ability to
    update its timeout arg after EINTR.
    Connect error reporting is re-worked in line with the OpenBSD update.
    The no-longer-used timeout_connect() function is removed.

commit f1a896807287a27426db0af11b3c9709e4509bba
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Mar 28 13:40:57 2020 +1100

    Server UDP nc with -k sends message to most recent client

    (Prior to this, standard input was effectively discarded).

    -k -l -u -v reports each time a message comes from a different client
    than the previous message came from.

commit 685dfd344c28911c23f133518bd8614e75e9cf75
Author: Guilhem Moulin <guilhem@debian.org>
Date:   Fri Jun 9 13:21:23 2017 +0200

    Build without TLS support (Debian patch)

commit 222f9f85d13177333831d8092cb3bd331d8c2552
Author: Aron Xu <aron@debian.org>
Date:   Mon Feb 13 15:59:31 2012 +0800

    Port to linux with libbsd (Debian patch)

commit 42d974bc6596bb64c62802168a92ffdda674dc29
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Mar 28 12:55:19 2020 +1100

    Use correct preposition in verbose reports

    Rather than reporting everything as "on" report e.g.
    "Connection received from", "Bound to" and so on.

commit 4daab1efce46a5de823c6d8a0a595e682b7c5590
Author: Duncan Roe <duncan_roe@optusnet.com.au>
Date:   Sat Mar 28 12:45:06 2020 +1100

    Only force fd's to -1 once

    The motivation for this is to make debug logs less confusing.

    All changed lines have previously demonstrated the problem.
