summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_output.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert tcp_fillheaders(tp, ...) -> tcpip_fillheaders(inp, ...) so theJonathan Lemon2003-02-191-9/+4
| | | | | | | | | | | routine does not require a tcpcb to operate. Since we no longer keep template mbufs around, move pseudo checksum out of this routine, and merge it with the length update. Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=111144
* Clean up delayed acks and T/TCP interactions:Jonathan Lemon2003-02-191-3/+4
| | | | | | | | | | | - 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 Notes: svn path=/head/; revision=111139
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-3/+3
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-3/+3
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Optimize away call to bzero() in the common case by directly checkingJeffrey Hsu2003-01-181-6/+3
| | | | | | | if a connection has any cached TAO information. Notes: svn path=/head/; revision=109492
* Fix oops in my last commit, I was calculating a new length but then notMatthew Dillon2002-10-161-1/+1
| | | | | | | | | using it. (The code is already correct in -stable). Found by: silby Notes: svn path=/head/; revision=105291
* Tie new "Fast IPsec" code into the build. This involves the usualSam Leffler2002-10-161-0/+5
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=105199
* Replace aux mbufs with packet tags:Sam Leffler2002-10-161-12/+3
| | | | | | | | | | | | | | | | | | | | | | o instead of a list of mbufs use a list of m_tag structures a la openbsd o for netgraph et. al. extend the stock openbsd m_tag to include a 32-bit ABI/module number cookie o for openbsd compatibility define a well-known cookie MTAG_ABI_COMPAT and use this in defining openbsd-compatible m_tag_find and m_tag_get routines o rewrite KAME use of aux mbufs in terms of packet tags o eliminate the most heavily used aux mbufs by adding an additional struct inpcb parameter to ip_output and ip6_output to allow the IPsec code to locate the security policy to apply to outbound packets o bump __FreeBSD_version so code can be conditionalized o fixup ipfilter's call to ip_output based on __FreeBSD_version Reviewed by: julian, luigi (silent), -arch, -net, darren Approved by: julian, silence from everyone else Obtained from: openbsd (mostly) MFC after: 1 month Notes: svn path=/head/; revision=105194
* Update various comments mainly related to retransmit/FIN that IMatthew Dillon2002-10-101-6/+36
| | | | | | | | | | | documented while working on a previous bug. Fix a PERSIST bug. Properly account for a FIN sent during a PERSIST. MFC after: 7 days Notes: svn path=/head/; revision=104815
* Tempary fix for inet6. The final fix is to change in6_pcbnotify to take ↵Jennifer Yang2002-09-171-0/+2
| | | | | | | | | pcbinfo instead of pcbhead. It is on the way. Notes: svn path=/head/; revision=103444
* Implement TCP bandwidth delay product window limiting, similar to (butMatthew Dillon2002-08-171-0/+1
| | | | | | | | | | | | | | | not meant to duplicate) TCP/Vegas. Add four sysctls and default the implementation to 'off'. net.inet.tcp.inflight_enable enable algorithm (defaults to 0=off) net.inet.tcp.inflight_debug debugging (defaults to 1=on) net.inet.tcp.inflight_min minimum window limit net.inet.tcp.inflight_max maximum window limit MFC after: 1 week Notes: svn path=/head/; revision=102017
* Assert that the inpcb lock is held when calling tcp_output().Jennifer Yang2002-08-121-0/+2
| | | | | | | Approved by: hsu Notes: svn path=/head/; revision=101713
* Introduce support for Mandatory Access Control and extensibleRobert Watson2002-07-311-0/+5
| | | | | | | | | | | | | | | | | | | | | kernel access control. Instrument the TCP socket code for packet generation and delivery: label outgoing mbufs with the label of the socket, and check socket and mbuf labels before permitting delivery to a socket. Assign labels to newly accepted connections when the syncache/cookie code has done its business. Also set peer labels as convenient. Currently, MAC policies cannot influence the PCB matching algorithm, so cannot implement polyinstantiation. Note that there is at least one case where a PCB is not available due to the TCP packet not being associated with any socket, so we don't label in that case, but need to handle it in a special manner. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=101106
* Slightly restructure the #ifdef INET6 sections to make the codeLuigi Rizzo2002-06-231-31/+19
| | | | | | | | | | more readable. Remove the six "register" attributes from variables tcp_output(), the compiler surely knows well how to allocate them. Notes: svn path=/head/; revision=98704
* Re-commit w/fix:Mike Silbersack2002-06-141-1/+1
| | | | | | | | | | | | | | Ensure that the syn cache's syn-ack packets contain the same ip_tos, ip_ttl, and DF bits as all other tcp packets. PR: 39141 MFC after: 2 weeks This time, make sure that ipv4 specific code (aka all of the above) is only run in the ipv4 case. Notes: svn path=/head/; revision=98204
* Back out ip_tos/ip_ttl/DF "fix", it just panic'd my box. :)Mike Silbersack2002-06-141-1/+1
| | | | | | | Pointy-hat to: silby Notes: svn path=/head/; revision=98203
* Ensure that the syn cache's syn-ack packets contain the sameMike Silbersack2002-06-141-1/+1
| | | | | | | | | | ip_tos, ip_ttl, and DF bits as all other tcp packets. PR: 39141 MFC after: 2 weeks Notes: svn path=/head/; revision=98202
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.Seigo Tanimura2002-05-311-14/+3
| | | | | | | Requested by: hsu Notes: svn path=/head/; revision=97658
* Lock down a socket, milestone 1.Seigo Tanimura2002-05-201-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred Notes: svn path=/head/; revision=96972
* Reduce the local network slowstart flightsize from infinity to 4 packets.Mike Silbersack2001-12-141-1/+1
| | | | | | | | | | | | | Now that we've increased the size of our send / receive buffers, bursting an entire window onto the network may cause congestion. As a result, we will slow start beginning with a flightsize of 4 packets. Problem reported by: Thomas Zenker <thz@Lennartz-electronic.de> MFC after: 3 days Notes: svn path=/head/; revision=87903
* Fix up tabs from cut&n&paste.Jonathan Lemon2001-12-131-8/+8
| | | | Notes: svn path=/head/; revision=87779
* Update to C99, s/__FUNCTION__/__func__/,David E. O'Brien2001-12-101-1/+1
| | | | | | | also don't use ANSI string concatenation. Notes: svn path=/head/; revision=87599
* Fix a bug with transmitter restart after receiving a 0 window. TheMatthew Dillon2001-12-021-14/+40
| | | | | | | | | | | | | | | | receiver was not sending an immediate ack with delayed acks turned on when the input buffer is drained, preventing the transmitter from restarting immediately. Propogate the TCP_NODELAY option to accept()ed sockets. (Helps tbench and is a good idea anyway). Some cleanup. Identify additonal issues in comments. MFC after: 1 day Notes: svn path=/head/; revision=87193
* The transmit burst limit for newreno completely breaks TCP's performanceMatthew Dillon2001-11-301-0/+10
| | | | | | | | | if the receive side is using delayed acks. Temporarily remove it. MFC after: 0 days Notes: svn path=/head/; revision=87145
* Introduce a syncache, which enables FreeBSD to withstand a SYN floodJonathan Lemon2001-11-221-1/+1
| | | | | | | | | | DoS in an improved fashion over the existing code. Reviewed by: silby (in a previous iteration) Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=86764
* Add a flag TF_LASTIDLE, that forces a previously idle connectionJayanth Vijayaraghavan2001-10-051-1/+8
| | | | | | | | | | | | | | to send all its data, especially when the data is less than one MSS. This fixes an issue where the stack was delaying the sending of data, eventhough there was enough window to send all the data and the sending of data was emptying the socket buffer. Problem found by Yoshihiro Tsuchiya (tsuchiya@flab.fujitsu.co.jp) Submitted by: Jayanth Vijayaraghavan Notes: svn path=/head/; revision=84564
* Eliminate the allocation of a tcp template structure for eachMike Silbersack2001-06-231-10/+2
| | | | | | | | | | | | | | | connection. The information contained in a tcptemp can be reconstructed from a tcpcb when needed. Previously, tcp templates required the allocation of one mbuf per connection. On large systems, this change should free up a large number of mbufs. Reviewed by: bmilekic, jlemon, ru MFC after: 2 weeks Notes: svn path=/head/; revision=78642
* Sync with recent KAME.Hajimu UMEMOTO2001-06-111-2/+6
| | | | | | | | | | | | | | | | | | | | | This work was based on kame-20010528-freebsd43-snap.tgz and some critical problem after the snap was out were fixed. There are many many changes since last KAME merge. TODO: - The definitions of SADB_* in sys/net/pfkeyv2.h are still different from RFC2407/IANA assignment because of binary compatibility issue. It should be fixed under 5-CURRENT. - ip6po_m member of struct ip6_pktopts is no longer used. But, it is still there because of binary compatibility issue. It should be removed under 5-CURRENT. Reviewed by: itojun Obtained from: KAME MFC after: 3 weeks Notes: svn path=/head/; revision=78064
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-011-2/+4
| | | | | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations) Notes: svn path=/head/; revision=76166
* Convert all users of fldoff() to offsetof(). fldoff() is badPoul-Henning Kamp2000-10-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | because it only takes a struct tag which makes it impossible to use unions, typedefs etc. Define __offsetof() in <machine/ansi.h> Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h> Remove myriad of local offsetof() definitions. Remove includes of <stddef.h> in kernel code. NB: Kernelcode should *never* include from /usr/include ! Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API. Deprecate <struct.h> with a warning. The warning turns into an error on 01-12-2000 and the file gets removed entirely on 01-01-2001. Paritials reviews by: various. Significant brucifications by: bde Notes: svn path=/head/; revision=67708
* Don't do snd_nxt rollback optimization (rev. 1.46) for SYN packets.Archie Cobbs2000-09-111-3/+2
| | | | | | | | | | | It causes a panic when/if snd_una is incremented elsewhere (this is a conservative change, because originally no rollback occurred for any packets at all). Submitted by: Vivek Sadananda Pai <vivek@imimic.com> Notes: svn path=/head/; revision=65751
* Improve performance in the case where ip_output() returns an error.Archie Cobbs2000-08-031-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When this happens, we know for sure that the packet data was not received by the peer. Therefore, back out any advancing of the transmit sequence number so that we send the same data the next time we transmit a packet, avoiding a guaranteed missed packet and its resulting TCP transmit slowdown. In most systems ip_output() probably never returns an error, and so this problem is never seen. However, it is more likely to occur with device drivers having short output queues (causing ENOBUFS to be returned when they are full), not to mention low memory situations. Moreover, because of this problem writers of slow devices were required to make an unfortunate choice between (a) having a relatively short output queue (with low latency but low TCP bandwidth because of this problem) or (b) a long output queue (with high latency and high TCP bandwidth). In my particular application (ISDN) it took an output queue equal to ~5 seconds of transmission to avoid ENOBUFS. A more reasonable output queue of 0.5 seconds resulted in only about 50% TCP throughput. With this patch full throughput was restored in the latter case. Reviewed by: freebsd-net Notes: svn path=/head/; revision=64213
* re-enable the tcp newreno code.Jayanth Vijayaraghavan2000-07-121-1/+1
| | | | Notes: svn path=/head/; revision=63048
* sync with kame tree as of july00. tons of bug fixes/improvements.Jun-ichiro itojun Hagino2000-07-041-17/+24
| | | | | | | | | | API changes: - additional IPv6 ioctls - IPsec PF_KEY API was changed, it is mandatory to upgrade setkey(8). (also syntax change) Notes: svn path=/head/; revision=62587
* When attempting to transmit a packet, if the system fails to allocateJonathan Lemon2000-06-021-0/+4
| | | | | | | | | | | | | | | | a mbuf, it may return without setting any timers. If no more data is scheduled to be transmitted (this was a FIN) the system will sit in LAST_ACK state forever. Thus, when mbuf allocation fails, set the retransmit timer if neither the retransmit or persist timer is already pending. Problem discovered by: Mike Silbersack (silby@silby.com) Pushed for a fix by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: jayanth Notes: svn path=/head/; revision=61179
* Temporarily turn off the newreno flag until we can track down the knownJayanth Vijayaraghavan2000-05-111-1/+1
| | | | | | | data corruption problem. Notes: svn path=/head/; revision=60408
* Implement TCP NewReno, as documented in RFC 2582. This allowsJonathan Lemon2000-05-061-3/+7
| | | | | | | | | | | better recovery for multiple packet losses in a single window. The algorithm can be toggled via the sysctl net.inet.tcp.newreno, which defaults to "on". Submitted by: Jayanth Vijayaraghavan <jayanth@yahoo-inc.com> Notes: svn path=/head/; revision=60067
* Add support for offloading IP/TCP/UDP checksums to NIC hardware whichJonathan Lemon2000-03-271-8/+11
| | | | | | | supports them. Notes: svn path=/head/; revision=58698
* Avoid kernel panic when tcp rfc1323 and rfc1644 options are enabledYoshinobu Inoue2000-02-091-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | at the same time. When rfc1323 and rfc1644 option are enabled by sysctl, and tcp over IPv6 is tried, kernel panic happens by the following check in tcp_output(), because now hdrlen is bigger in such case than before. /*#ifdef DIAGNOSTIC*/ if (max_linkhdr + hdrlen > MHLEN) panic("tcphdr too big"); /*#endif*/ So change the above check to compare with MCLBYTES in #ifdef INET6 case. Also, allocate a mbuf cluster for the header mbuf, in that case. Bug reported at KAME environment. Approved by: jkh Reviewed by: sumikawa Obtained from: KAME project Notes: svn path=/head/; revision=57068
* Fixed the problem that IPsec connection hangs when bigger data is sent.Yoshinobu Inoue2000-01-151-0/+5
| | | | | | | | | | -opt_ipsec.h was missing on some tcp files (sorry for basic mistake) -made buildable as above fix -also added some missing IPv4 mapped IPv6 addr consideration into ipsec4_getpolicybysock Notes: svn path=/head/; revision=56041
* tcp updates to support IPv6.Yoshinobu Inoue2000-01-091-22/+142
| | | | | | | | | | also a small patch to sys/nfs/nfs_socket.c, as max_hdr size change. Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project Notes: svn path=/head/; revision=55679
* Restructure TCP timeout handling:Jonathan Lemon1999-08-301-27/+46
| | | | | | | | | | | | | - eliminate the fast/slow timeout lists for TCP and instead use a callout entry for each timer. - increase the TCP timer granularity to HZ - implement "bad retransmit" recovery, as presented in "On Estimating End-to-End Network Path Properties", by Allman and Paxson. Submitted by: jlemon, wollmann Notes: svn path=/head/; revision=50673
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Added net.inet.tcp.path_mtu_discovery variable which when set to 0David Greenman1999-05-271-8/+9
| | | | | | | | | | (default 1) disables PMTUD globally. Although PMTUD can be disabled in the standard case by locking the MTU on a static route (including the default route), this method doesn't work in the face of dynamic routing protocols like gated. Notes: svn path=/head/; revision=47547
* Two cosmetic changes, one a typo and the other, a clarification.Julian Elischer1999-04-071-2/+2
| | | | Notes: svn path=/head/; revision=45439
* Add a flag, passed to pru_send routines, PRUS_MORETOCOME. ThisBill Fenner1999-01-201-2/+3
| | | | | | | | | | | | flag means that there is more data to be put into the socket buffer. Use it in TCP to reduce the interaction between mbuf sizes and the Nagle algorithm. Based on: "Justin C. Walker" <justin@apple.com>'s description of Apple's fix for this problem. Notes: svn path=/head/; revision=42902
* Fixed overflow and sign extension bugs inBruce Evans1998-07-131-4/+4
| | | | | | | | | | | | | | `len = min(so->so_snd.sb_cc, win) - off;'. min() has type u_int and `off' has type int, so when min() is 0 and `off' is 1, the RHS overflows to 0U - 1 = UINT_MAX. `len' has type long, so when sizeof(long) == sizeof(int), the LHS normally overflows to to the correct value of -1, but when sizeof(long) > sizeof(int), the LHS is UINT_MAX. Fixed some u_long's that should have been fixed-sized types. Notes: svn path=/head/; revision=37623
* Take IP options into account when calculating the allowable lengthBill Fenner1998-05-241-4/+13
| | | | | | | | | | of the TCP payload. See RFC1122 section 4.2.2.6 . This allows Path MTU discovery to be used along with IP options. PR: problem discovered by Kevin Lahey <kml@nas.nasa.gov> Notes: svn path=/head/; revision=36335
* Remove the last traces of TUBA.Poul-Henning Kamp1998-04-061-6/+1
| | | | | | | Inspired by: PR kern/3317 Notes: svn path=/head/; revision=35056
* Don't depend on "implicit int".Bruce Evans1998-02-201-2/+2
| | | | Notes: svn path=/head/; revision=33678