summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_reass.c
Commit message (Collapse)AuthorAgeFilesLines
* Backout MT_TAG removal (i.e. bring back MT_TAGs) for now, as dummynet ismlaier2004-02-181-2/+6
| | | | | | not working properly with the patch in place. Approved by: bms(mentor)
* IPSEC and FAST_IPSEC have the same internal API now;ume2004-02-171-16/+8
| | | | | | so merge these (IPSEC has an extra ipsecstat) Submitted by: "Bjoern A. Zeeb" <bzeeb+freebsd@zabbadoz.net>
* This set of changes eliminates the use of MT_TAG "pseudo mbufs", replacingmlaier2004-02-131-6/+2
| | | | | | | | | | | them mostly with packet tags (one case is handled by using an mbuf flag since the linkage between "caller" and "callee" is direct and there's no need to incur the overhead of a packet tag). This is (mostly) work from: sam Silence from: -arch Approved by: bms(mentor), sam, rwatson
* Brucification.bms2004-02-131-1/+1
| | | | Submitted by: bde
* Remove an unnecessary initialization that crept in from the code whichbms2004-02-121-2/+1
| | | | | | verifies TCP-MD5 digests. Noticed by: njl
* Initial import of RFC 2385 (TCP-MD5) digest support.bms2004-02-111-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first of two commits; bringing in the kernel support first. This can be enabled by compiling a kernel with options TCP_SIGNATURE and FAST_IPSEC. For the uninitiated, this is a TCP option which provides for a means of authenticating TCP sessions which came into being before IPSEC. It is still relevant today, however, as it is used by many commercial router vendors, particularly with BGP, and as such has become a requirement for interconnect at many major Internet points of presence. Several parts of the TCP and IP headers, including the segment payload, are digested with MD5, including a shared secret. The PF_KEY interface is used to manage the secrets using security associations in the SADB. There is a limitation here in that as there is no way to map a TCP flow per-port back to an SPI without polluting tcpcb or using the SPD; the code to do the latter is unstable at this time. Therefore this code only supports per-host keying granularity. Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6), TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective users of this feature, this will not pose any problem. This implementation is output-only; that is, the option is honoured when responding to a host initiating a TCP session, but no effort is made [yet] to authenticate inbound traffic. This is, however, sufficient to interwork with Cisco equipment. Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with local patches. Patches for tcpdump to validate TCP-MD5 sessions are also available from me upon request. Sponsored by: sentex.net
* pass pcb rather than so. it is expected that per socket policyume2004-02-031-2/+2
| | | | works again.
* Merge from DragonFlyBSD rev 1.10:hsu2004-01-201-6/+5
| | | | | | | date: 2003/09/02 10:04:47; author: hsu; state: Exp; lines: +5 -6 Account for when Limited Transmit is not congestion window limited. Obtained from: DragonFlyBSD
* Limiters and sanity checks for TCP MSS (maximum segement size)andre2004-01-081-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | resource exhaustion attacks. For network link optimization TCP can adjust its MSS and thus packet size according to the observed path MTU. This is done dynamically based on feedback from the remote host and network components along the packet path. This information can be abused to pretend an extremely low path MTU. The resource exhaustion works in two ways: o during tcp connection setup the advertized local MSS is exchanged between the endpoints. The remote endpoint can set this arbitrarily low (except for a minimum MTU of 64 octets enforced in the BSD code). When the local host is sending data it is forced to send many small IP packets instead of a large one. For example instead of the normal TCP payload size of 1448 it forces TCP payload size of 12 (MTU 64) and thus we have a 120 times increase in workload and packets. On fast links this quickly saturates the local CPU and may also hit pps processing limites of network components along the path. This type of attack is particularly effective for servers where the attacker can download large files (WWW and FTP). We mitigate it by enforcing a minimum MTU settable by sysctl net.inet.tcp.minmss defaulting to 256 octets. o the local host is reveiving data on a TCP connection from the remote host. The local host has no control over the packet size the remote host is sending. The remote host may chose to do what is described in the first attack and send the data in packets with an TCP payload of at least one byte. For each packet the tcp_input() function will be entered, the packet is processed and a sowakeup() is signalled to the connected process. For example an attack with 2 Mbit/s gives 4716 packets per second and the same amount of sowakeup()s to the process (and context switches). This type of attack is particularly effective for servers where the attacker can upload large amounts of data. Normally this is the case with WWW server where large POSTs can be made. We mitigate this by calculating the average MSS payload per second. If it goes below 'net.inet.tcp.minmss' and the pps rate is above 'net.inet.tcp.minmssoverload' defaulting to 1000 this particular TCP connection is resetted and dropped. MITRE CVE: CAN-2004-0002 Reviewed by: sam (mentor) MFC after: 1 day
* Enable the following TCP options by default to give it more exposure:andre2004-01-061-2/+2
| | | | | | | | | | | | rfc3042 Limited retransmit rfc3390 Increasing TCP's initial congestion Window inflight TCP inflight bandwidth limiting All my production server have it enabled and there have been no issues. I am confident about having them on by default and it gives us better overall TCP performance. Reviewed by: sam (mentor)
* Restructure a too broad ifdef which was disabling the setting of theandre2003-11-251-2/+4
| | | | | | tcp flightsize sysctl value for local networks in the !INET6 case. Approved by: re (scottl)
* Introduce tcp_hostcache and remove the tcp specific metrics fromandre2003-11-201-144/+200
| | | | | | | | | | | | | | | | | | | | | | | the routing table. Move all usage and references in the tcp stack from the routing table metrics to the tcp hostcache. It caches measured parameters of past tcp sessions to provide better initial start values for following connections from or to the same source or destination. Depending on the network parameters to/from the remote host this can lead to significant speedups for new tcp connections after the first one because they inherit and shortcut the learning curve. tcp_hostcache is designed for multiple concurrent access in SMP environments with high contention and is hash indexed by remote ip address. It removes significant locking requirements from the tcp stack with regard to the routing table. Reviewed by: sam (mentor), bms Reviewed by: -net, -current, core@kame.net (IPv6 parts) Approved by: re (scottl)
* Introduce a MAC label reference in 'struct inpcb', which cachesrwatson2003-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the MAC label referenced from 'struct socket' in the IPv4 and IPv6-based protocols. This permits MAC labels to be checked during network delivery operations without dereferencing inp->inp_socket to get to so->so_label, which will eventually avoid our having to grab the socket lock during delivery at the network layer. This change introduces 'struct inpcb' as a labeled object to the MAC Framework, along with the normal circus of entry points: initialization, creation from socket, destruction, as well as a delivery access control check. For most policies, the inpcb label will simply be a cache of the socket label, so a new protocol switch method is introduced, pr_sosetlabel() to notify protocols that the socket layer label has been updated so that the cache can be updated while holding appropriate locks. Most protocols implement this using pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use the the worker function in_pcbsosetlabel(), which calls into the MAC Framework to perform a cache update. Biba, LOMAC, and MLS implement these entry points, as do the stub policy, and test policy. Reviewed by: sam, bms Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* dropwithreset is not needed in this case as tcp_drop() is already notifyingandre2003-11-121-1/+1
| | | | the other side. Before we were sending two RST packets.
* o correct locking problem: the inpcb must be held across tcp_respondsam2003-11-081-3/+3
| | | | | | | o add assertions in tcp_respond to validate inpcb locking assumptions o use local variable instead of chasing pointers in tcp_respond Supported by: FreeBSD Foundation
* speedup stream socket recv handling by tracking the tail ofsam2003-10-281-3/+3
| | | | | | | the mbuf chain instead of walking the list for each append Submitted by: ps/jayanth Obtained from: netbsd (jason thorpe)
* enclose IPv6 part with ifdef INET6.ume2003-10-201-2/+3
| | | | Obtained from: KAME
* correct linkmtu handling.ume2003-10-201-2/+11
| | | | Obtained from: KAME
* - add dom_if{attach,detach} framework.ume2003-10-171-2/+1
| | | | | | - transition to use ifp->if_afdata. Obtained from: KAME
* A number of patches in the last years have created new return pathsharti2003-08-131-0/+21
| | | | | | | | | | in tcp_input that leave the function before hitting the tcp_trace function call for the TCPDEBUG option. This has made TCPDEBUG mostly useless (and tools like ports/benchmarks/dbs not working). Add tcp_trace calls to the return paths that could be identified in this maze. This is a NOP unless you compile with TCPDEBUG.
* Unify the "send high" and "recover" variables as specified in thehsu2003-07-151-19/+24
| | | | | | | | | | | | lastest rev of the spec. Use an explicit flag for Fast Recovery. [1] Fix bug with exiting Fast Recovery on a retransmit timeout diagnosed by Lu Guohan. [2] Reviewed by: Thomas Henderson <thomas.r.henderson@boeing.com> Reported and tested by: Lu Guohan <lguohan00@mails.tsinghua.edu.cn> [2] Approved by: Thomas Henderson <thomas.r.henderson@boeing.com>, Sally Floyd <floyd@acm.org> [1]
* Add /* FALLTHROUGH */phk2003-05-311-0/+1
| | | | Found by: FlexeLint
* Correct a bug introduced with reduced TCP state handling; makerwatson2003-05-071-1/+1
| | | | | | | | | | | | | | | | | | | sure that the MAC label on TCP responses during TIMEWAIT is properly set from either the socket (if available), or the mbuf that it's responding to. Unfortunately, this is made somewhat difficult by the TCP code, as tcp_twstart() calls tcp_twrespond() after discarding the socket but without a reference to the mbuf that causes the "response". Passing both the socket and the mbuf works arounds this--eventually it might be good to make sure the mbuf always gets passed in in "response" scenarios but working through this provided to complicate things too much. Approved by: re (scottl) Reviewed by: hsu Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Explicitly declare 'int' parameters.obrien2003-04-211-0/+1
|
* Observe conservation of packets when entering Fast Recovery whilehsu2003-04-011-3/+21
| | | | | | | | | doing Limited Transmit. Only artificially inflate the congestion window by 1 segment instead of the usual 3 to take into account the 2 already sent by Limited Transmit. Approved in principle by: Mark Allman <mallman@grc.nasa.gov>, Hari Balakrishnan <hari@nms.lcs.mit.edu>, Sally Floyd <floyd@icir.org>
* Greatly simplify the unlocking logic by holding the TCP protocol lock untilhsu2003-03-131-8/+2
| | | | | | after FIN_WAIT_2 processing. Helped with debugging: Doug Barton
* Add support for RFC 3390, which allows for a variable-sizedhsu2003-03-131-2/+9
| | | | initial congestion window.
* Implement the Limited Transmit algorithm (RFC 3042).hsu2003-03-121-0/+14
|
* Remove a panic(); if the zone allocator can't provide more timewaitjlemon2003-03-081-4/+3
| | | | | | | structures, reuse the oldest one. Also move the expiry timer from a per-structure callout to the tcp slow timer. Sponsored by: DARPA, NAI Labs
* In timewait state, if the incoming segment is a pure in-sequence ackjlemon2003-02-261-2/+4
| | | | | | | | | that matches snd_max, then do not respond with an ack, just drop the segment. This fixes a problem where a simultaneous close results in an ack loop between two time-wait states. Test case supplied by: Tim Robbins <tjr@FreeBSD.ORG> Sponsored by: DARPA, NAI Labs
* The TCP protocol lock may still be held if the reassembly queue dropped FIN.jlemon2003-02-261-1/+2
| | | | | | Detect this case and drop the lock accordingly. Sponsored by: DARPA, NAI Labs
* tcp_twstart() need to be called with the TCP protocol lock held to avoidhsu2003-02-241-6/+8
| | | | a race condition with the TCP timer routines.
* Pass the right function to callout_reset() for a compressedhsu2003-02-241-1/+1
| | | | TIME-WAIT control block.
* Yesterday just wasn't my day. Remove testing delta that crept into the diff.jlemon2003-02-231-1/+1
| | | | Pointy hat provided by: sam
* Check to see if the TF_DELACK flag is set before returning fromjlemon2003-02-221-8/+7
| | | | | | | | tcp_input(). This unbreaks delack handling, while still preserving correct T/TCP behavior Tested by: maxim Sponsored by: DARPA, NAI Labs
* Add a TCP TIMEWAIT state which uses less space than a fullblown TCPjlemon2003-02-191-30/+186
| | | | | | | | control block. Allow the socket and tcpcb structures to be freed earlier than inpcb. Update code to understand an inp w/o a socket. Reviewed by: hsu, silby, jayanth Sponsored by: DARPA, NAI Labs
* Correct comments.jlemon2003-02-191-7/+4
|
* Clean up delayed acks and T/TCP interactions:jlemon2003-02-191-28/+27
| | | | | | | | - delay acks for T/TCP regardless of delack setting - fix bug where a single pass through tcp_input might not delay acks - use callout_active() instead of callout_pending() Sponsored by: DARPA, NAI Labs
* The protocol lock is always held in the dropafterack case, so we don'thsu2003-02-131-2/+2
| | | | need to check for it at runtime.
* Add the TCP flags to the log message whenever log_in_vain is 1, notcjc2003-02-021-8/+3
| | | | | | | just when set to 2. PR: kern/43348 MFC after: 5 days
* Fix NewReno.hsu2003-01-131-41/+44
| | | | Reviewed by: Tom Henderson <thomas.r.henderson@boeing.com>
* Remove the PAWS ack-on-ack debugging printf().dillon2002-12-301-5/+2
| | | | | | | | | | Note that the original RFC 1323 (PAWS) says in 4.2.1 that the out of order / reverse-time-indexed packet should be acknowledged as specified in RFC-793 page 69 then dropped. The original PAWS code in FreeBSD (1994) simply acknowledged the segment unconditionally, which is incorrect, and was fixed in 1.183 (2002). At the moment we do not do checks for SYN or FIN in addition to (tlen != 0), which may or may not be correct, but the worst that ought to happen should be a retry by the sender.
* Unravel a nested conditional.hsu2002-12-201-21/+12
| | | | Remove an unneeded local variable.
* Fix syntax in last commit.dillon2002-12-171-3/+3
|
* Bruce forwarded this tidbit from an analysis Van Jacobson did on andillon2002-12-141-1/+6
| | | | | | | | | | apparent ack-on-ack problem with FreeBSD. Prof. Jacobson noticed a case in our TCP stack which would acknowledge a received ack-only packet, which is not legal in TCP. Submitted by: Van Jacobson <van@packetdesign.com>, bmah@packetdesign.com (Bruce A. Mah) MFC after: 7 days
* a better solution to building FAST_IPSEC w/o INET6sam2002-11-101-4/+0
| | | | Submitted by: Jeffrey Hsu <hsu@FreeBSD.org>
* fixup FAST_IPSEC build w/o INET6sam2002-11-081-1/+4
|
* - Consistently update snd_wl1, snd_wl2, and rcv_up in the headerjeff2002-10-311-1/+15
| | | | | | | | | | | prediction code. Previously, 2GB worth of header predicted data could leave these variables too far out of sequence which would cause problems after receiving a packet that did not match the header prediction. Submitted by: Bill Baumann <bbaumann@isilon.com> Sponsored by: Isilon Systems, Inc. Reviewed by: hsu, pete@isilon.com, neal@isilon.com, aaronp@isilon.com
* Don't need to check if SO_OOBINLINE is defined.hsu2002-10-301-13/+8
| | | | | Don't need to protect isipv6 conditional with INET6. Fix leading indentation in 2 lines.
* Tie new "Fast IPsec" code into the build. This involves the usualsam2002-10-161-0/+19
| | | | | | | | | | | | configuration stuff as well as conditional code in the IPv4 and IPv6 areas. Everything is conditional on FAST_IPSEC which is mutually exclusive with IPSEC (KAME IPsec implmentation). As noted previously, don't use FAST_IPSEC with INET6 at the moment. Reviewed by: KAME, rwatson Approved by: silence Supported by: Vernier Networks
OpenPOWER on IntegriCloud