Commit graph

57 commits

Author SHA1 Message Date
Warner Losh d37eb51047 contrib: Remove various $FreeBSD$ tags not upstream
Sponsored by:		Netflix
2024-05-31 13:49:17 -06:00
Pietro Cerutti d4b3aefdf9 netcat: add --crlf to convert LF into CRLF
This adds the --crlf option to netcat, which triggers translation of \n
characters into \r\n sequences in the input -> network direction.
The Linux version of nc also supports this functionality with --crlf and
-C. The OpenBSD version uses -C to specify client certificates. Our
version is too old and doesn't have it, but I avoided adding -C anyway
to ease future syncs with upstream.

Attempts to upstream the feature were unsuccessful:
https://marc.info/?t=169282068500001

Differential Revision: https://reviews.freebsd.org/D41489
2023-08-28 10:58:17 +00:00
Tom Jones cef7ab70ff netcat: Allow nc to be an if_tun tunnel broker
Reviewed by:	kevans
Relnotes:	yes
Sponsored by:   Zenarmor
Sponsored by:   OPNsense
Sponsored by:   Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37435
2023-01-17 10:05:49 +00:00
Ed Maste bdcfd222ce Remove FREEBSD-vendor files
These files were intended to track version and perhaps maintainership
information for contrib software.  However, they were never used beyond
bzip2, netcat, and OpenSSH, and generally haven't been kept up to date
recently (my OpenSSH 8.7p1 update notwithstanding).  Just remove them to
avoid having confusing or outdated information.

Suggested by:	des
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-12-06 16:36:44 -05:00
Mark Johnston 5c346ead18 Adjust .Dd, missed in r363084.
MFC with:	r363084
2020-07-10 19:58:07 +00:00
Mark Johnston d041589227 Add a --sctp flag to nc.
The change adds an SCTP mode akin to UDP mode.  This is handy for doing
smoke testing of SCTP.

Use a long option to minimize the risk of option conflicts with OpenBSD.
For bonus points, this change unbreaks --no-tcpopt by adding a missing
case required by getopt_long().

Reviewed by:	delphij, tuexen
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25610
2020-07-10 19:54:04 +00:00
Edward Tomasz Napierala 1e62ecedf2 Add -M option to nc(1), which makes it print the TCP connection
statistics obtained with stats(3) in JSON format to standard error.

Reviewed by:	allanjude, thj, cem (earlier version)
Tested by:	thj
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D21324
2019-12-14 10:53:52 +00:00
Andrey V. Elsukov fcf596178b Merge projects/ipsec into head/.
Small summary
 -------------

o Almost all IPsec releated code was moved into sys/netipsec.
o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel
  option IPSEC_SUPPORT added. It enables support for loading
  and unloading of ipsec.ko and tcpmd5.ko kernel modules.
o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by
  default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type
  support was removed. Added TCP/UDP checksum handling for
  inbound packets that were decapsulated by transport mode SAs.
  setkey(8) modified to show run-time NAT-T configuration of SA.
o New network pseudo interface if_ipsec(4) added. For now it is
  build as part of ipsec.ko module (or with IPSEC kernel).
  It implements IPsec virtual tunnels to create route-based VPNs.
o The network stack now invokes IPsec functions using special
  methods. The only one header file <netipsec/ipsec_support.h>
  should be included to declare all the needed things to work
  with IPsec.
o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed.
  Now these protocols are handled directly via IPsec methods.
o TCP_SIGNATURE support was reworked to be more close to RFC.
o PF_KEY SADB was reworked:
  - now all security associations stored in the single SPI namespace,
    and all SAs MUST have unique SPI.
  - several hash tables added to speed up lookups in SADB.
  - SADB now uses rmlock to protect access, and concurrent threads
    can do SA lookups in the same time.
  - many PF_KEY message handlers were reworked to reflect changes
    in SADB.
  - SADB_UPDATE message was extended to support new PF_KEY headers:
    SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They
    can be used by IKE daemon to change SA addresses.
o ipsecrequest and secpolicy structures were cardinally changed to
  avoid locking protection for ipsecrequest. Now we support
  only limited number (4) of bundled SAs, but they are supported
  for both INET and INET6.
o INPCB security policy cache was introduced. Each PCB now caches
  used security policies to avoid SP lookup for each packet.
o For inbound security policies added the mode, when the kernel does
  check for full history of applied IPsec transforms.
o References counting rules for security policies and security
  associations were changed. The proper SA locking added into xform
  code.
o xform code was also changed. Now it is possible to unregister xforms.
  tdb_xxx structures were changed and renamed to reflect changes in
  SADB/SPDB, and changed rules for locking and refcounting.

Reviewed by:	gnn, wblock
Obtained from:	Yandex LLC
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D9352
2017-02-06 08:49:57 +00:00
Xin LI 100e2a06e2 MFV r288243: nc from OpenBSD 5.8. 2015-09-27 07:04:16 +00:00
Xin LI 8c54dbfb9b MFV r282611: netcat from OpenBSD 5.7.
MFC after:	2 weeks
2015-05-07 22:54:31 +00:00
Xin LI a5570ae0d7 MFV r273617: netcat from OpenBSD 5.6.
MFC after:	2 weeks
2014-10-25 00:37:35 +00:00
Xin LI 3ae0125a99 MFV r258194-264360: nc(1) from OpenBSD 5.5.
MFC after:	2 weeks
2014-04-11 22:12:31 +00:00
Xin LI 5abd6fdcfa MFV: netcat from OpenBSD 5.4.
No functional change.
2013-11-15 22:45:14 +00:00
Xin LI 3719c1c85c Reflect version update.
MFC after:	13 days
2013-04-15 18:35:09 +00:00
Xin LI 0772266e63 MFV r249496,249498. The most visible change is that we no longer shuts
down the connection when stdin closes, by default.  This matches Hobbit's
original netcat and GNU netcat.

Old behavior can be restored with the new -N flag.

MFC after:	2 weeks
2013-04-15 05:31:59 +00:00
Xin LI 52dba105d2 MFV: netcat from OpenBSD 5.2.
MFC after:	1 month
2012-10-22 18:56:31 +00:00
Xin LI 0426af06b1 Update FREEBSD-vendor to reflect the current version. 2012-05-04 21:06:53 +00:00
Xin LI ac3ea9104e Merge from OpenBSD 5.1.
MFC after:	3 weeks
2012-05-04 21:03:39 +00:00
Bjoern A. Zeeb aaf04b7cb6 Switch from setfib(2) moving the process to a different FIB to setsockopt(2)
with SO_SETFIB to only tag the socket with the right FIB.

That way either setfib(1) or nc -V can be used depending on what wants to be
achieved.  This also allows nc to be used for simple regression testing of
either feature.

Sponsored by:	Cisco Systems, Inc.
2012-02-14 11:37:04 +00:00
Xin LI 42821a2fc9 Merge from OpenBSD 5.0 (this is a dummy change, the vendor change does not
apply to us).
2011-12-26 09:07:08 +00:00
Xin LI 59c7ad52aa MFV: nc(1) from OpenBSD 4.9.
MFC after:	1 month
Obtained from:	OpenBSD
2011-05-11 21:52:26 +00:00
Xin LI 4f2bbc00f2 MFV: nc(1) from OpenBSD 4.8.
While I'm there, bump WARNS level to 2 as the vendor
have the right printf format string now.

MFC after:	1 month
Obtained from:	OpenBSD
2010-10-19 00:01:53 +00:00
Rebecca Cran dadef94c7a Remove extra word, which looks like a left-over from a deleted sentence. 2010-10-18 14:35:21 +00:00
Benedict Reuschling bc6940585f Use "printf" instead of "echo -n" in an example because it
should be more compatible for most shells that are out there.

I contacted Philip Guenther at OpenBSD about this PR and he
corrected the issue in their tree pretty fast.

PR:			docs/142243
Submitted by:		Yasir (yasir27 at mail dot ru)
Obtained from:		OpenBSD
Discussed with:		delphij
MFC after:		7 days
2010-07-26 18:33:33 +00:00
Xin LI 6856a5e345 Utilize IP_BINDANY which provided the same semantics of OpenBSD's
SO_BINDANY.
2010-04-15 23:21:24 +00:00
Xin LI 55e999851d Diff reduction with OpenBSD:
- Remove unused locally added variable;
 - Deprecate -o: it's the default behavior on OpenBSD.

X-MFC:	along with nc 4.7.
2010-04-15 19:15:05 +00:00
Xin LI d6655439ed Update metadata information as well as upgrade instructions. 2010-03-23 23:56:22 +00:00
Xin LI 26bf9c3b54 MFV: Update nc to the version from OpenBSD 4.7.
MFC after:	1 month
2010-03-23 23:00:35 +00:00
Xin LI faa9a79099 Update the version number. 2010-02-02 00:30:44 +00:00
Xin LI 2d5ea05a45 Update to 4.6.
Note: the -V option from OpenBSD is implemented using setfib(2) on FreeBSD.

MFC after:	2 weeks
2010-01-19 18:45:29 +00:00
Xin LI 933ef0ba72 What we have in base system is actually OpenBSD 4.5's netcat,
update this file to reflect the fact.
2009-12-08 19:12:38 +00:00
Dag-Erling Smørgrav 9517e86625 Update and remove CVS-specific items
Approved by:	re (kib)
2009-08-13 06:07:38 +00:00
Colin Percival f15e71c26a Fix .Dd value -- our mdoc macros don't know how to parse the $Mdocdate$
tag, so the file was being treated as having no date (i.e., the current
date was being inserted).

Approved by:	re (kib)
2009-07-11 17:35:55 +00:00
Xin LI c9b4549c3d Add an EXIT STATUS section to the manual page. Currently, nc(1)
does not follow sysexits(3), and returns 1 for all error cases.

PR:		docs/126451
2009-05-29 07:18:31 +00:00
Xin LI 1a9dc239f5 Update netcat to the version carried with OpenBSD 4.5. 2009-05-28 23:23:49 +00:00
Xin LI 7dcaa833c8 Merge nc(1) from OpenBSD 4.4. While there, rename our '-O' (no
tcp options) to '--no-tcpopt' in order to resolve a comflicit
with OpenBSD's -O semantics.
2008-12-19 23:00:23 +00:00
Xin LI b3b9c2bbcb Flatten all tags of the dist tree of netcat. 2008-09-27 00:53:34 +00:00
Antoine Brodin b6642dadae Document freebsd extensions to netcat a bit better:
- sort the options
- document -o and -O everywhere

Reviewed by:	delphij
Approved by:	rwatson (mentor)
2008-05-10 18:50:45 +00:00
Xin LI c784a71d0b Update instructions to match recent practices 2008-04-21 18:37:08 +00:00
Xin LI 0c2d6f72b7 Add vendor metadata 2008-04-21 18:36:52 +00:00
Xin LI 2308b50e15 Resolve conflicts. 2008-04-21 18:31:50 +00:00
Xin LI c7c53f7a03 Import netcat as of today's OPENBSD_4_3 snapshot. 2008-04-21 18:30:26 +00:00
Xin LI 0b96cd80df This commit was generated by cvs2svn to compensate for changes in r178382,
which included commits to RCS files with non-trunk default branches.
2008-04-21 18:30:26 +00:00
Bruce M Simpson bc38f653f1 Add an -O option to disable TCP options, for protocol testing purposes.
Do this for active and passive (-l switch) TCP sessions.

MFC after:	1 week
2008-04-01 13:54:24 +00:00
George V. Neville-Neil 8409aedfa6 Commit IPv6 support for FAST_IPSEC to the tree.
This commit includes all remaining changes for the time being including
user space updates.

Submitted by:    bz
Approved by:    re
2007-07-01 12:08:08 +00:00
Xin LI bdb0aaa123 Resolve conflicts. 2007-03-28 01:57:03 +00:00
Xin LI b2f6436d8f Import netcat as of today's OPENBSD_4_1 snapshot. 2007-03-28 01:55:49 +00:00
Xin LI c262af8430 This commit was generated by cvs2svn to compensate for changes in r167961,
which included commits to RCS files with non-trunk default branches.
2007-03-28 01:55:49 +00:00
Xin LI 2440a45859 Resolve conflicts. 2006-05-21 15:52:24 +00:00
Xin LI 7a997a696b Import netcat from OpenBSD 3.9-RELEASE. 2006-05-21 15:49:27 +00:00