summaryrefslogtreecommitdiff
path: root/contrib/netcat/netcat.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a --sctp flag to nc.Mark Johnston2020-07-101-2/+19
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=363084
* Add -M option to nc(1), which makes it print the TCP connectionEdward Tomasz Napierala2019-12-141-5/+99
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=355750
* Merge projects/ipsec into head/.Andrey V. Elsukov2017-02-061-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=313330
* MFV r288243: nc from OpenBSD 5.8.Xin LI2015-09-271-6/+8
|\ | | | | | | Notes: svn path=/head/; revision=288303
* | MFV r282611: netcat from OpenBSD 5.7.Xin LI2015-05-071-53/+227
|\| | | | | | | | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=282613
* | MFV r273617: netcat from OpenBSD 5.6.Xin LI2014-10-251-9/+7
|\| | | | | | | | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=273619
* | MFV r258194-264360: nc(1) from OpenBSD 5.5.Xin LI2014-04-111-20/+85
|\| | | | | | | | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=264361
* | MFV: netcat from OpenBSD 5.4.Xin LI2013-11-151-2/+2
|\| | | | | | | | | | | | | No functional change. Notes: svn path=/head/; revision=258195
* | MFV r249496,249498. The most visible change is that we no longer shutsXin LI2013-04-151-8/+15
|\| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=249499
* | MFV: netcat from OpenBSD 5.2.Xin LI2012-10-221-21/+50
|\| | | | | | | | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=241906
* | Merge from OpenBSD 5.1.Xin LI2012-05-041-24/+100
|\| | | | | | | | | | | | | MFC after: 3 weeks Notes: svn path=/head/; revision=235037
* | Switch from setfib(2) moving the process to a different FIB to setsockopt(2)Bjoern A. Zeeb2012-02-141-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/projects/multi-fibv6/head/; revision=231670
* | Merge from OpenBSD 5.0 (this is a dummy change, the vendor change does notXin LI2011-12-261-1/+1
|\| | | | | | | | | | | | | apply to us). Notes: svn path=/head/; revision=228896
* | MFV: nc(1) from OpenBSD 4.9.Xin LI2011-05-111-25/+69
|\| | | | | | | | | | | | | | | MFC after: 1 month Obtained from: OpenBSD Notes: svn path=/head/; revision=221793
* | MFV: nc(1) from OpenBSD 4.8.Xin LI2010-10-191-17/+15
|\| | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=214047
* | Utilize IP_BINDANY which provided the same semantics of OpenBSD'sXin LI2010-04-151-4/+2
| | | | | | | | | | | | | | SO_BINDANY. Notes: svn path=/head/; revision=206689
* | Diff reduction with OpenBSD:Xin LI2010-04-151-12/+6
| | | | | | | | | | | | | | | | | | | | - Remove unused locally added variable; - Deprecate -o: it's the default behavior on OpenBSD. X-MFC: along with nc 4.7. Notes: svn path=/head/; revision=206675
* | MFV: Update nc to the version from OpenBSD 4.7.Xin LI2010-03-231-15/+17
|\| | | | | | | | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=205561
* | Update to 4.6.Xin LI2010-01-191-4/+28
|\| | | | | | | | | | | | | | | | | Note: the -V option from OpenBSD is implemented using setfib(2) on FreeBSD. MFC after: 2 weeks Notes: svn path=/head/; revision=202640
* | Update netcat to the version carried with OpenBSD 4.5.Xin LI2009-05-281-6/+7
|\| | | | | | | Notes: svn path=/head/; revision=193008
* | Merge nc(1) from OpenBSD 4.4. While there, rename our '-O' (noXin LI2008-12-191-14/+52
|\| | | | | | | | | | | | | | | tcp options) to '--no-tcpopt' in order to resolve a comflicit with OpenBSD's -O semantics. Notes: svn path=/head/; revision=186343
| * Flatten all tags of the dist tree of netcat.Xin LI2008-09-271-843/+0
| | | | | | | | Notes: svn path=/vendor/netcat/dist/; revision=183393
| * Import netcat as of today's OPENBSD_4_1 snapshot.vendor/netcat/4.1Xin LI2007-03-281-25/+23
| | | | | | | | | | Notes: svn path=/vendor/netcat/dist/; revision=167961 svn path=/vendor/netcat/4.1/; revision=167963; tag=vendor/netcat/4.1
| * Import netcat from OpenBSD 3.9-RELEASE.vendor/netcat/3.9Xin LI2006-05-211-54/+97
| | | | | | | | | | Notes: svn path=/vendor/netcat/dist/; revision=158795 svn path=/vendor/netcat/3.9/; revision=158797; tag=vendor/netcat/3.9
* | Document freebsd extensions to netcat a bit better:Antoine Brodin2008-05-101-7/+8
| | | | | | | | | | | | | | | | | | | | | | - sort the options - document -o and -O everywhere Reviewed by: delphij Approved by: rwatson (mentor) Notes: svn path=/head/; revision=178927
* | Add an -O option to disable TCP options, for protocol testing purposes.Bruce M Simpson2008-04-011-3/+18
| | | | | | | | | | | | | | | | | | Do this for active and passive (-l switch) TCP sessions. MFC after: 1 week Notes: svn path=/head/; revision=177837
* | Commit IPv6 support for FAST_IPSEC to the tree.George V. Neville-Neil2007-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | This commit includes all remaining changes for the time being including user space updates. Submitted by: bz Approved by: re Notes: svn path=/head/; revision=171135
* | Resolve conflicts.Xin LI2007-03-281-27/+24
| | | | | | | | Notes: svn path=/head/; revision=167964
* | Resolve conflicts.Xin LI2006-05-211-54/+99
| | | | | | | | Notes: svn path=/head/; revision=158798
* | Undo the VCS tag move to reduce diff hunks.Xin LI2005-02-071-1/+1
| | | | | | | | | | | | | | Pointed out by: ru Notes: svn path=/head/; revision=141431
* | Finish the import of nc(1) from OpenBSD. This includes:Xin LI2005-02-061-6/+88
|/ | | | | | | | | | | | | | | | | | | | | - Bring IPsec support from the ports collection [1]. - Bring -o ("once only") option from the ports collection [2]. - Adopt the Makefile framework into usr.bin/nc/Makefile. - Add a knob to control whether to build nc(1), NO_NETCAT. - Bump __FreeBSD_version so ports collection can detect this change. Original patchset are contributed to the ports collection by: [1] nectar, [2] joerg. Note: WARNS?=6 patchset spined off in this commit, in order not to take too many files off the vendor branch. Notes: svn path=/head/; revision=141394
* Import a (stripped) snapshot of OpenBSD's nc(1) an excellentvendor/netcat/20050204Xin LI2005-02-041-0/+802
reimplementation of the famous tool that can do arbitrary TCP and UDP connections and listens. This gaves sysadm the same tool the crackers have, so that they may learn what the network is about and protect it better. For developers, this is an invaluable debugging tool, and a good build block of scripts. Discussed on: freebsd-hackers@ Notes: svn path=/vendor/netcat/dist/; revision=141261 svn path=/vendor/netcat/20050204/; revision=141263; tag=vendor/netcat/20050204