#
4fec8175 |
|
29-Jan-2024 |
Augustin Cavalier <waddlesplash@gmail.com> |
TCP: Refactor sending logic. * Break segment setup out into its own method. * Break the actual sending logic out into its own method. - While at it, remove some old/obsolete comments and rearrange some of the logic to match. * Separate the send-pure-ACK and send-data methods. - This way, the "force" parameters will act differently, specifying "force" to SendAcknowledge() may generate a duplicate ACK, while to SendQueued() it will either send data smaller than a segment size, or do nothing. Functional changes should be minor, and the code meanwhile should be much easier to read. Change-Id: I1e14b9a1e3b7c8b2d3bf8ae30f1369d8c9f662a4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7361 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
141cc593 |
|
30-Dec-2023 |
Augustin Cavalier <waddlesplash@gmail.com> |
TCP: Actually invoke SendQueued when the window widens. IMMEDIATE_ACKNOWLEDGE invokes SendQueued ... but with a send window size forced to 0, so it just generates an ACK (or a duplicate ACK as the case may be), and doesn't actually trigger sending of data. So, adjust the check, introduce a new action flag, and invoke it properly. Fixes traffic stalls caused by waiting for the persist timeout to occur. This amends hrev51540 (yes, from 2017.) Change-Id: I6344463938cfaa0134bb8cf3e224789cded0987c Reviewed-on: https://review.haiku-os.org/c/haiku/+/7285 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
f1ec6962 |
|
11-May-2021 |
Jérôme Duval <jerome.duval@gmail.com> |
tcp: several fixes for SACK handling: * kMaxOptionSize: TCP header size is 60 bytes. process_options() would have accepted a longer header as permitted. add_options() would have possibly added more options or SACK entries as permitted. * tcp_segment: reserve memory for sack entries. * _SendQueued(): "fLastAcknowledgeSent <= fReceiveNext": also send SACK entries for received data when acknowledging a missing segment. * _SendQueue(): after acknowledging, cancel the delayed acknowledgment timer. * _Receive(): if calling Acknowledged() already triggered sending a segment including an acknowledgement (piggy-back), remove "immediate acknowledge" from the action. This helps to reduce empty ACKs for bidirectional streams. Change-Id: I32808fbe549be0f5b25bcf4be17cd91a640b8ec4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3906 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
745830a0 |
|
25-Aug-2017 |
A-star-ayush <myselfthebest@yahoo.com> |
tcp: rfc 2018: implemented SACK option Change-Id: I269ad2682446c4d37bae21dcf9f3036de964ff2c Reviewed-on: https://review.haiku-os.org/c/haiku/+/53 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
51dd385e |
|
23-May-2020 |
Kyle Ambroff-Kao <kyle@ambroffkao.com> |
tcp: Don't skip TIME_WAIT state for loopback sockets This fixes a SEGFAULT in the tcp add-on reported in issue #15952. See that issue for some analysis. The short version is that, when closing a session over the loopback interface, there is a special branch which skips the TIME_WAIT state and instead just releases the socket while handling a RST/ACK segment. If the timing is right this can lead to the reference counts becoming imbalanced, leading to the code in tcp_receive_data segfaulting when it tries to release the reference it acquired from EndpointManager::FindConnection. I can't find any other systems which skip the TIME_WAIT state with loopback sessions, and I'm not entirely certain that it's a totally safe thing to do anyway. This patch instead just treats local sessions the same way it does a remote session and uses the TIME_WAIT state. Any workload which creates and discards lots of ephemeral sockets can just use SO_REUSEADDR to handle this situation like any other system. To add a final bit of safety, the only place where a net_socket can be used after calling gSocketModule->release_socket(net_socket*) is in tcp_receive_data(). release_socket() returns true if the reference count falls to zero, deleting the socket. There was an unused segment action flag DELETE_ENDPOINT that I renamed to DELETED_ENDPOINT, which is used by tcp_receive_data to know whether its safe to release its reference to the socket after calling TCPEndpoint::SegmentReceived(). Change-Id: I2652fb225c3c8419234cfd627f74ff2de8402003 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2793 Reviewed-by: Axel Dörfler <axeld@pinc-software.de> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
86ec5e3b |
|
26-Mar-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
Convert some more endian conversions to Haiku-style.
|
#
272e1a2f |
|
09-Nov-2017 |
A-star-ayush <myselfthebest@yahoo.com> |
tcp: fixed no response from window update, removed ideal timer The reason for the erratic behavior was that the tcp implementation silently drops window update messages after noting the update but without triggering any data send event. Before the new TCP patches were applied, the implementation relied on a retransmission timeout to trigger a send event after a window update. One of the new patches dealing with the ideal timer changed the semantic of the restransmit function call and caused the behavior witnessed. But a retransmission timeout is not the correct solution to window update. In fact a retransmission is not a desired effect of window update. So in the patch attached, I have changed the behavior of the implementation to immediately acknowledge the window update (along with data from SendQueue) and thus solving the problem of complete halt in data transmission. The patch also has the changes re-implemented that were reverted back but had nothing to do with the issue at hand. For the time being, I have also removed the "ideal timer" part from the patch (although it wasn't creating any conflict). I initially decided to implement the ideal timer using the same timer used for retransmission to avoid adding an additional timer. But as I have seen, it can be problematic. So I will be re-implementing the ideal timer and thus it was not included in this patch. Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com> Fixes #13704.
|
#
d815bbcb |
|
04-Oct-2017 |
Jérôme Duval <jerome.duval@gmail.com> |
Revert "tcp: rfc 2018: implemented SACK option" This reverts commit 5c31f5a67a0aa37c8f2a1464252b2c5b0a959f33.
|
#
e736356c |
|
12-Sep-2017 |
Augustin Cavalier <waddlesplash@gmail.com> |
Revert "tcp: slow start@rfc5681 : updated rules for congestion window" This reverts commit 05743f6a13319a9dc332603eb5d98ba4c5374b25 (and the portions of following commits that were layered on top of it.)
|
#
5c31f5a6 |
|
25-Aug-2017 |
A-star-ayush <myselfthebest@yahoo.com> |
tcp: rfc 2018: implemented SACK option Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
|
#
05743f6a |
|
14-Aug-2017 |
A-star-ayush <myselfthebest@yahoo.com> |
tcp: slow start@rfc5681 : updated rules for congestion window Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
|
#
89822930 |
|
02-Aug-2015 |
Michael Lotz <mmlr@mlotz.ch> |
tcp: Whitespace cleanup, move a define to header and fix a typo.
|
#
01b0f935 |
|
02-Aug-2015 |
Michael Lotz <mmlr@mlotz.ch> |
tcp: Move persist timeout value to a define in the header.
|
#
5f774907 |
|
02-Aug-2015 |
Michael Lotz <mmlr@mlotz.ch> |
tcp: Fix retransmit logic to avoid lots of spurious retransmits. The retransmit timer was only stopped when all in flight data was acknowledged and never updated on individual acknowledgements. This caused a lot of erroneous retransmits whenever the buffer was filled fast enough so that the acknowledgements never caught up, i.e. whenever uploading or streaming data. Move setting of the initial retransmit timer inside the send loop so it is closer to the actual time the segment is sent out and simplify the logic a bit. Limit the minimal retransmit timeout to 200 msecs to avoid spurious retransmit in the face of delayed acknowledgements. This is lower than the 1 second minimum the RFCs suggest. Other stacks use various other sub-second timeouts, the 200 msecs follows what Linux does. Also add the exponential back off of the retransmit timeout when retransmits are triggered. This is bounded by a 60 seconds maximum according to RFC6298.
|
#
6235b496 |
|
12-Jan-2015 |
Adrien Destugues <pulkomandy@gmail.com> |
More useless inclusions of khash.h
|
#
20561036 |
|
01-Mar-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Added the standard names for the TCP states as comment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35701 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
965abdeb |
|
15-Feb-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* BufferQueue::Free() no longer will return negative values. As is, the max bytes restriction is only a soft limit. This fixes stalling TCP connections because everything received would be out of window once this happened. * Added a TODO to look into TCP's window management - it doesn't seem to be right. * Fixed build with tracing turned on. * Made the fNumber member of tcp_sequence private. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35468 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c21f81c1 |
|
04-Apr-2009 |
Axel Dörfler <axeld@pinc-software.de> |
bonefish + axeld: * There was one incorrect check in BufferQueue::Get() that happened because the wrong operator was used due to the uint32 cast operator. * Consequently, we removed the uint32 cast operator, and changed the code to deal with this. Fortunately, no other bugs were observed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29928 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
30a396ab |
|
19-May-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Made the endpoint manager wait on bind() if the existing connection is local, and is about to close. * This fixes several race conditions with the neon test suite that relied on TCP sockets being gone after close, and their port being available again (note, that is not what the TCP spec says, anyway, but it makes sense to do so, since we already removed the time wait state for local connections). * The endpoint manager is now using a mutex instead of a semaphore. * TCPEndpoint::_Close() now notifies the senders/receivers instead of _HandleReset(). * Besides ssl_closure(), all tests of the neon test suite seem to pass now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25564 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
db4b6bc4 |
|
28-Apr-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Merged _Receive() and _SegmentReceived(). * Cleanup, shuffled methods around, renamed methods, etc. - no functional changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25223 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
15ab0bcf |
|
21-Oct-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* int32_t, uint32_t are now of type "int", and no longer of type "long". This should help to reduce the number of warnings imported code will throw during compilation (helps a lot with tcpdump, for example). * Since long is 64 bit on 64 bit platforms, we might want to think about doing that change for the Haiku types int32 and uint32 as well. * Fixed several occurences of hidden type problems. * Fixed build of the stack and TCP under BeOS. * Fixed incorrect typedef in socket_interface.h. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22643 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c5520d6 |
|
03-May-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
use a appropriate naming for structure fields. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21016 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
785e7ef7 |
|
04-May-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
renamed TCP's TSval/TSecr git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21014 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
739e9942 |
|
20-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
TCP: added SACK definitions and option processing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20775 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1d63ea33 |
|
18-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
some TCP performance improvements. - support TCP fast retransmit/fast recovery. - maintain the RTT average time and update the retransmit timeout accordingly. - improvements to TCP Slow start / congestion avoidance. - better handling of the retransmission timer. - properly size segments taking the TCP options length into consideration. - as an interim fix, update the SendQ/RecvQ sizes on Connect(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20748 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4ee08841 |
|
16-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
assorted TCP fixes. - fixed the locking for spawned connections and accept()s. - return EMSGSIZE if the user is trying to write more data than the send buffer can hold. - fixed a crash when receiving a RST while the connection is being closed. - don't wake up readers when the connection gets established. - endpoint managers lock must be recursive to properly work with spawn'ed sockets. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20727 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ca1b900b |
|
15-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
support RFC 1323's TCP Timestamps (we are still not updating our estimator though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20719 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
03d7f17e |
|
15-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
made TCP handle multiple domains. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20718 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a7edede4 |
|
09-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
fixed multiple TCP issues. - Moved FIN handling to after Segment Text handling, it matches the RFC and fixes a possible issue with a user missing some final segment data when receiving a FIN. - Fixed the FIN handling to better terminate connections (no more senseless chatter in the end with RSTs etc). - When Bind()ing, set the socket address so a call to getsockname() gets the allocated port correctly. - After reaching the ESTABLISHED state, try to wake all pending threads (still needs work). - Corrected the maximum amount of time we wait in SendData() to respect socket->send.timeout. - Now ReadData() behaves correctly in all possible states. - There was a missing handling of MSG_DONTWAIT, fixed. - Better internal handling of PSH. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20624 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f2893088 |
|
05-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
fixed another TCP issue: if we were in TIME_WAIT and we received a retransmission or delayed ack, TCP would wrongly bindly immediatly acknowledge. * Moved TIME_WAIT and CLOSED handling to common Receive() path that does Sequence checking and further tests. * Moved setting FLAG_NO_RECEIVE to the end of Receive() when FIN is set so we can check for NO_RECEIVE before processing the segment text just after processing FIN. * Added a new action DELETE to be used when in TIME_WAIT and we receive a good RST git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20572 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
10fdb28c |
|
04-Dec-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Some minor work on TIME_WAIT state, and its timer. * endpoints are no longer deleted without unbinding them. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19417 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9cbe6ce2 |
|
04-Dec-2006 |
Axel Dörfler <axeld@pinc-software.de> |
Rewrote how bind() works: * there are now two hash tables: one for connections, and one for ports * the first one is used to find the endpoint for incoming connections * the latter is used to check if the address to bind() to is still available (incl. support for SO_REUSEADDR, and SO_REUSEPORT). Specialising an existing socket is not allowed, though; wildcard sockets need to be started last. * the TCPConnection class now has a pointer to the next endpoint with the same port number - this list is scanned for the existing bound sockets on that port. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19416 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
78e96e0c |
|
01-Dec-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* If you send more than the maximum buffer size at once, TCP will now block until it could send all the data. * The window shift option can now also be send if the actual option is zero to indicate we support this option. * If the window shift is not specified, we'll fall back to 0 for our receive window as well now. * _SendQueued() now resets the segment options after SYN. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19407 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
26417177 |
|
29-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
More work-in-progress: * Added some timer methods * Fixed removing the connection too early (and thus replying with a RST instead of nothing when the peer acknowledged our FIN). * BufferQueue::RemoveUntil() did not bump the buffer's sequence * Delayed acknowledge, and retransmitting should work now (the latter is *very* basic right now) * Completed TCPConnection::_ShouldSendSegment() * fReceiveNext was always updated on a received buffer, even if there was a buffer missing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19396 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
75dc7cb5 |
|
28-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed _SendQueuedData() to _SendQueued(), and made it independent from the "flags" parameter - this can't be used with retransmitting anyway, and since the flags are actually fixed per state, the previous solution didn't really make much sense. * Made _SendQueued() work a lot more like BSD's tcp_output(). * We can now send even large buffers that need more than one segment at once. * Added a simple recursive locking mechanism for now - this should be done differently, though, as we want to have good performance in full duplex mode. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19384 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
85359054 |
|
27-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
Some more work-in-progress: * the TCPConnection::Receive() method is now more or less working as it should; of course, there are a number of missing things (like round-trip time estimation, retransmit timers, receive window update, ...). * reply_with_reset() was broken, and accidently always send the segment it should answer with reset... (causing an endless loop during connect) * BufferQueue::RemoveUntil() must always set the fFirstSequence member to the new sequence, or you will never be able to send anything with that queue (as the data in it would be no longer contiguous). * connects, sendings (only single segments), and receiving data is working now basically (but very incomplete); retransmits or even subsequent transmits (if the data to be sent doesn't fit in one segment) doesn't work yet, so you better don't lose any segments :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19378 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1166a4f9 |
|
26-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
Work-in-progress on TCP: * Changed the implementation to be more BSD like; state variables are now the same set as usual. * The BufferQueue didn't use the initial sequence correctly (problems with SYN sequence). * It now also removes data out of the current data set (ie. data that was already read by the application). * BufferQueue::Get() also didn't work correctly (the version used by sending data). * Fixed various issues around the code like incorrect handling of unexpected data. * TCP options don't need the end-of-options marker in case they fill up the data already, also, the end-of-options marker doesn't need to be padded. * Options are now only processed during SYN - other options may come later (timestamps are candidate number one). * Also broke what was working before: connections do no longer work! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19376 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5fcf0448 |
|
25-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Added a helper class tcp_sequence which hides the semantics of comparing sequences (this was completely broken in the code before). * Wrote a buffer queue class to replace the previous algorithm - instead of merging all buffers together, they're kept in a list, so that the most work will be done in the application's thread and only very little when the data is received; maybe we should add an append_move() function to net_buffer, and use that instead, though, to keep the number of fragments small. * The advertised receive window is now bound to 65535, the receive window shift is correctly computed, but not yet used. * The new buffer queue is now also responsible for the send buffer. * TCPConnection::ListenReceive() used the wrong address to retrieve the target route. * Fixed TCPConnection::ReadData() to also return data when the connection is already closed, and to wait if the connection is not yet established (in SO_NONBLOCK mode); it still doesn't wait until data is available, though... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19372 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
75743fcd |
|
20-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented adding/processing TCP options; so far only "max segment size" (MSS) is really supported. * Added TCP option fields to the tcp_segment_header structure - they are filled in on receive, and add_tcp_header() now gets a tcp_segment_header as well, and will add any options automatically. * Fixed some minor bugs (connection with passive open had wrong state after connect). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19333 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
30ea523a |
|
19-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Big rework of TCP - doesn't have any additional features yet, though, even though it can now connect to itself (and should, in theory, also be able to connect to other TCP implemenations). * Separated the big state machine from ReceiveData() into several smaller sized methods. * Moved reset and acknowledgement handling for all kind of receives to a common place in tcp_receive_data(). * Removed locking for now - the previous locking approach was wrong due to a number of reasons: the previous version deadlocked when it had to connect locally, and it also didn't take into account that TCP is a full-duplex protocol; it's not wise to only be able to manage one direction at a time if that's not really needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19329 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
31d3ef17 |
|
06-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Some cleanup, renamed some flags/constants to be a bit clearer (even though the states now deviate from what other use to have, ie. FreeBSD). * Replaced macros with inline methods. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19215 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c35b04de |
|
02-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Moved the TCPConnection class into its own file. * Added some missing result checks, mostly for allocations. * Fixed a wrong precendence with the ?: operator * Some minor cleanup. * Renamed sBufferModule to gBufferModule - the header expects it to be a global, so it should be named like one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19178 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7bfdb02e |
|
31-Aug-2006 |
Andrew Galante <agalante@nowhere.fake> |
The full TCP state machine should be working now, with the exception of the LISTEN state. It cannot yet transfer data though - that will be implemented next. Connections are only made from port 40000 though, ephemeral ports are not yet implemented. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18729 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c22d69bf |
|
08-Aug-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Completed the previous commit and merger of the team/network/new_stack branch. * Removed ppp_up and pppcontrol from the image for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18457 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8982293017b132c73aff734fa8baa7afd261e125 |
|
02-Aug-2015 |
Michael Lotz <mmlr@mlotz.ch> |
tcp: Whitespace cleanup, move a define to header and fix a typo.
|
#
01b0f935ec6177b7f20eeaf0955df0600ced66c3 |
|
02-Aug-2015 |
Michael Lotz <mmlr@mlotz.ch> |
tcp: Move persist timeout value to a define in the header.
|
#
5f7749078e1cf1c7ea9fa091a1c1f1d94ec37ce2 |
|
02-Aug-2015 |
Michael Lotz <mmlr@mlotz.ch> |
tcp: Fix retransmit logic to avoid lots of spurious retransmits. The retransmit timer was only stopped when all in flight data was acknowledged and never updated on individual acknowledgements. This caused a lot of erroneous retransmits whenever the buffer was filled fast enough so that the acknowledgements never caught up, i.e. whenever uploading or streaming data. Move setting of the initial retransmit timer inside the send loop so it is closer to the actual time the segment is sent out and simplify the logic a bit. Limit the minimal retransmit timeout to 200 msecs to avoid spurious retransmit in the face of delayed acknowledgements. This is lower than the 1 second minimum the RFCs suggest. Other stacks use various other sub-second timeouts, the 200 msecs follows what Linux does. Also add the exponential back off of the retransmit timeout when retransmits are triggered. This is bounded by a 60 seconds maximum according to RFC6298.
|
#
6235b4967bb0a99752efd18eee62a47834c79946 |
|
12-Jan-2015 |
Adrien Destugues <pulkomandy@gmail.com> |
More useless inclusions of khash.h
|
#
2056103694edd3c76d39584241fcf58126b38565 |
|
01-Mar-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Added the standard names for the TCP states as comment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35701 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
965abdebd5f3175836079520f618977d2c889407 |
|
15-Feb-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* BufferQueue::Free() no longer will return negative values. As is, the max bytes restriction is only a soft limit. This fixes stalling TCP connections because everything received would be out of window once this happened. * Added a TODO to look into TCP's window management - it doesn't seem to be right. * Fixed build with tracing turned on. * Made the fNumber member of tcp_sequence private. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35468 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c21f81c11af8beacf5804d26d62bde44bf2927fe |
|
04-Apr-2009 |
Axel Dörfler <axeld@pinc-software.de> |
bonefish + axeld: * There was one incorrect check in BufferQueue::Get() that happened because the wrong operator was used due to the uint32 cast operator. * Consequently, we removed the uint32 cast operator, and changed the code to deal with this. Fortunately, no other bugs were observed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29928 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
30a396ab4211fe07b7d90e6c48a3eadd301a78db |
|
19-May-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Made the endpoint manager wait on bind() if the existing connection is local, and is about to close. * This fixes several race conditions with the neon test suite that relied on TCP sockets being gone after close, and their port being available again (note, that is not what the TCP spec says, anyway, but it makes sense to do so, since we already removed the time wait state for local connections). * The endpoint manager is now using a mutex instead of a semaphore. * TCPEndpoint::_Close() now notifies the senders/receivers instead of _HandleReset(). * Besides ssl_closure(), all tests of the neon test suite seem to pass now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25564 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
db4b6bc46caaeb073a5e176a89ea695c0b52b70e |
|
28-Apr-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Merged _Receive() and _SegmentReceived(). * Cleanup, shuffled methods around, renamed methods, etc. - no functional changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25223 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
15ab0bcf01ef7bd7323d9b2da55906bafbb40fd3 |
|
21-Oct-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* int32_t, uint32_t are now of type "int", and no longer of type "long". This should help to reduce the number of warnings imported code will throw during compilation (helps a lot with tcpdump, for example). * Since long is 64 bit on 64 bit platforms, we might want to think about doing that change for the Haiku types int32 and uint32 as well. * Fixed several occurences of hidden type problems. * Fixed build of the stack and TCP under BeOS. * Fixed incorrect typedef in socket_interface.h. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22643 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c5520d67a885acaff48203692b88f0707c88ff4 |
|
03-May-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
use a appropriate naming for structure fields. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21016 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
785e7ef7dd751385821998a5cf513d14f2456b3e |
|
04-May-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
renamed TCP's TSval/TSecr git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21014 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
739e99427818f50d79c5de012db1d4c53727dcbc |
|
20-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
TCP: added SACK definitions and option processing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20775 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1d63ea33723fa8f3afac5a98fdb36b5bfe6839ee |
|
18-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
some TCP performance improvements. - support TCP fast retransmit/fast recovery. - maintain the RTT average time and update the retransmit timeout accordingly. - improvements to TCP Slow start / congestion avoidance. - better handling of the retransmission timer. - properly size segments taking the TCP options length into consideration. - as an interim fix, update the SendQ/RecvQ sizes on Connect(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20748 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4ee088419f8fdc733b6cb0606e2556b176316788 |
|
16-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
assorted TCP fixes. - fixed the locking for spawned connections and accept()s. - return EMSGSIZE if the user is trying to write more data than the send buffer can hold. - fixed a crash when receiving a RST while the connection is being closed. - don't wake up readers when the connection gets established. - endpoint managers lock must be recursive to properly work with spawn'ed sockets. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20727 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ca1b900bdb8cd280418ade417a2f81b5b4b50a91 |
|
15-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
support RFC 1323's TCP Timestamps (we are still not updating our estimator though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20719 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
03d7f17e07da19253587845073315010febc031a |
|
15-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
made TCP handle multiple domains. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20718 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a7edede46f377bf9b0f2710079a09f22df2771ca |
|
09-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
fixed multiple TCP issues. - Moved FIN handling to after Segment Text handling, it matches the RFC and fixes a possible issue with a user missing some final segment data when receiving a FIN. - Fixed the FIN handling to better terminate connections (no more senseless chatter in the end with RSTs etc). - When Bind()ing, set the socket address so a call to getsockname() gets the allocated port correctly. - After reaching the ESTABLISHED state, try to wake all pending threads (still needs work). - Corrected the maximum amount of time we wait in SendData() to respect socket->send.timeout. - Now ReadData() behaves correctly in all possible states. - There was a missing handling of MSG_DONTWAIT, fixed. - Better internal handling of PSH. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20624 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f2893088ba25b514acf67d0fdf0d965d6aa4b317 |
|
05-Apr-2007 |
Hugo Santos <hugosantos@nowhere.fake> |
fixed another TCP issue: if we were in TIME_WAIT and we received a retransmission or delayed ack, TCP would wrongly bindly immediatly acknowledge. * Moved TIME_WAIT and CLOSED handling to common Receive() path that does Sequence checking and further tests. * Moved setting FLAG_NO_RECEIVE to the end of Receive() when FIN is set so we can check for NO_RECEIVE before processing the segment text just after processing FIN. * Added a new action DELETE to be used when in TIME_WAIT and we receive a good RST git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20572 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
10fdb28c47d85f624881000c9687592df8e5fe0a |
|
04-Dec-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Some minor work on TIME_WAIT state, and its timer. * endpoints are no longer deleted without unbinding them. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19417 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9cbe6ce20025d6de096cbd167bb1f83669d1032a |
|
04-Dec-2006 |
Axel Dörfler <axeld@pinc-software.de> |
Rewrote how bind() works: * there are now two hash tables: one for connections, and one for ports * the first one is used to find the endpoint for incoming connections * the latter is used to check if the address to bind() to is still available (incl. support for SO_REUSEADDR, and SO_REUSEPORT). Specialising an existing socket is not allowed, though; wildcard sockets need to be started last. * the TCPConnection class now has a pointer to the next endpoint with the same port number - this list is scanned for the existing bound sockets on that port. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19416 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
78e96e0cfef40fd01d5ca4663c8e1cebba82ba5c |
|
01-Dec-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* If you send more than the maximum buffer size at once, TCP will now block until it could send all the data. * The window shift option can now also be send if the actual option is zero to indicate we support this option. * If the window shift is not specified, we'll fall back to 0 for our receive window as well now. * _SendQueued() now resets the segment options after SYN. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19407 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
26417177e74510783b4a6f48670c62e96cde0ee2 |
|
29-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
More work-in-progress: * Added some timer methods * Fixed removing the connection too early (and thus replying with a RST instead of nothing when the peer acknowledged our FIN). * BufferQueue::RemoveUntil() did not bump the buffer's sequence * Delayed acknowledge, and retransmitting should work now (the latter is *very* basic right now) * Completed TCPConnection::_ShouldSendSegment() * fReceiveNext was always updated on a received buffer, even if there was a buffer missing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19396 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
75dc7cb58a6c6210dd12c07cdad7ba961fb19cd8 |
|
28-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed _SendQueuedData() to _SendQueued(), and made it independent from the "flags" parameter - this can't be used with retransmitting anyway, and since the flags are actually fixed per state, the previous solution didn't really make much sense. * Made _SendQueued() work a lot more like BSD's tcp_output(). * We can now send even large buffers that need more than one segment at once. * Added a simple recursive locking mechanism for now - this should be done differently, though, as we want to have good performance in full duplex mode. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19384 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8535905415b70f3516daef470a219d38eafd9097 |
|
27-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
Some more work-in-progress: * the TCPConnection::Receive() method is now more or less working as it should; of course, there are a number of missing things (like round-trip time estimation, retransmit timers, receive window update, ...). * reply_with_reset() was broken, and accidently always send the segment it should answer with reset... (causing an endless loop during connect) * BufferQueue::RemoveUntil() must always set the fFirstSequence member to the new sequence, or you will never be able to send anything with that queue (as the data in it would be no longer contiguous). * connects, sendings (only single segments), and receiving data is working now basically (but very incomplete); retransmits or even subsequent transmits (if the data to be sent doesn't fit in one segment) doesn't work yet, so you better don't lose any segments :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19378 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1166a4f9b5ac1afc8c89751b2f5158624173cacf |
|
26-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
Work-in-progress on TCP: * Changed the implementation to be more BSD like; state variables are now the same set as usual. * The BufferQueue didn't use the initial sequence correctly (problems with SYN sequence). * It now also removes data out of the current data set (ie. data that was already read by the application). * BufferQueue::Get() also didn't work correctly (the version used by sending data). * Fixed various issues around the code like incorrect handling of unexpected data. * TCP options don't need the end-of-options marker in case they fill up the data already, also, the end-of-options marker doesn't need to be padded. * Options are now only processed during SYN - other options may come later (timestamps are candidate number one). * Also broke what was working before: connections do no longer work! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19376 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5fcf044823d5325bd1b6de7c82ef170aaa86439b |
|
25-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Added a helper class tcp_sequence which hides the semantics of comparing sequences (this was completely broken in the code before). * Wrote a buffer queue class to replace the previous algorithm - instead of merging all buffers together, they're kept in a list, so that the most work will be done in the application's thread and only very little when the data is received; maybe we should add an append_move() function to net_buffer, and use that instead, though, to keep the number of fragments small. * The advertised receive window is now bound to 65535, the receive window shift is correctly computed, but not yet used. * The new buffer queue is now also responsible for the send buffer. * TCPConnection::ListenReceive() used the wrong address to retrieve the target route. * Fixed TCPConnection::ReadData() to also return data when the connection is already closed, and to wait if the connection is not yet established (in SO_NONBLOCK mode); it still doesn't wait until data is available, though... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19372 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
75743fcd65f5fbef6d19fcbff98b16b681036132 |
|
20-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented adding/processing TCP options; so far only "max segment size" (MSS) is really supported. * Added TCP option fields to the tcp_segment_header structure - they are filled in on receive, and add_tcp_header() now gets a tcp_segment_header as well, and will add any options automatically. * Fixed some minor bugs (connection with passive open had wrong state after connect). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19333 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
30ea523ad10945ebf4562595952e78f9ae95878d |
|
19-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Big rework of TCP - doesn't have any additional features yet, though, even though it can now connect to itself (and should, in theory, also be able to connect to other TCP implemenations). * Separated the big state machine from ReceiveData() into several smaller sized methods. * Moved reset and acknowledgement handling for all kind of receives to a common place in tcp_receive_data(). * Removed locking for now - the previous locking approach was wrong due to a number of reasons: the previous version deadlocked when it had to connect locally, and it also didn't take into account that TCP is a full-duplex protocol; it's not wise to only be able to manage one direction at a time if that's not really needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19329 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
31d3ef17d8bc8425cb15b76b9dc48547533d1499 |
|
06-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Some cleanup, renamed some flags/constants to be a bit clearer (even though the states now deviate from what other use to have, ie. FreeBSD). * Replaced macros with inline methods. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19215 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c35b04de314ab7f18763546366ea30eb8ae53997 |
|
02-Nov-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Moved the TCPConnection class into its own file. * Added some missing result checks, mostly for allocations. * Fixed a wrong precendence with the ?: operator * Some minor cleanup. * Renamed sBufferModule to gBufferModule - the header expects it to be a global, so it should be named like one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19178 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7bfdb02ea8a995d84262d444f52bb1f2d829f7bb |
|
31-Aug-2006 |
Andrew Galante <agalante@nowhere.fake> |
The full TCP state machine should be working now, with the exception of the LISTEN state. It cannot yet transfer data though - that will be implemented next. Connections are only made from port 40000 though, ephemeral ports are not yet implemented. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18729 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c22d69bf1f5f60f7ebddd79108a53c8f97f300fe |
|
08-Aug-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Completed the previous commit and merger of the team/network/new_stack branch. * Removed ppp_up and pppcontrol from the image for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18457 a95241bf-73f2-0310-859d-f6bbb57e9c96
|