Commit Graph

158 Commits

Author SHA1 Message Date
whitequark 077513fda6 Add support for TCP MSS option in TCP representation. 2017-01-27 02:56:27 +00:00
whitequark 4c3f454902 Add support for TCP option parsing and emission. 2017-01-27 00:33:30 +00:00
whitequark 4267ad2635 Fix an inaccurate comment. 2017-01-26 22:04:05 +00:00
whitequark ca1146995f Remove TcpControl::len(). 2017-01-26 21:20:48 +00:00
whitequark a3c997f007 Also parse Ethernet addresses separated by dashes (-).
This is handy because we print them separated by dashes.
2017-01-26 17:28:07 +00:00
whitequark 22e5462936 Add Internet and Ethernet address parsing (from strings). 2017-01-25 19:41:02 +00:00
whitequark 9b8671ce15 Fix the TCP FIN emission with queued data rolling over TX buffer. 2017-01-25 06:20:57 +00:00
whitequark 9fbb5cfff1 Fix the TCP ACK handling in FIN-WAIT-1 state with queued data. 2017-01-25 06:01:58 +00:00
whitequark 68064c3725 Refactor the TCP ACK handling in ESTABLISHED/CLOSE-WAIT states. 2017-01-25 05:50:14 +00:00
whitequark 8b292c6dd8 Don't switch TCP state from FIN-WAIT-1 to FIN-WAIT-2 with queued data. 2017-01-25 05:36:42 +00:00
whitequark bef01740a7 If a TCP FIN|ACK also ACKs our FIN, transition to TIME-WAIT. 2017-01-25 03:58:03 +00:00
whitequark f6d542b739 Actually close TCP sockets with 0 references during pruning. 2017-01-25 02:45:17 +00:00
whitequark 5cb4e6f760 Trace pruning of sockets from a set. 2017-01-25 02:23:10 +00:00
whitequark 497aa5919a Correctly treat TCP ACKs that acknowledge both data and a FIN. 2017-01-23 22:17:04 +00:00
whitequark 92fde3d18b Don't send TCP FIN flag yet if next segment will also have data. 2017-01-23 12:07:07 +00:00
whitequark 507af2b0c3 Reset the TCP retransmit timer on valid ACK if transmit half is open. 2017-01-23 11:34:36 +00:00
whitequark 62f094d276 Fix build with no alloc or collections. 2017-01-22 20:29:45 +00:00
whitequark 34d32f67a2 Gate the really verbose log messages behind a feature.
Otherwise, trying to use the socket buffers instead of BufReader/
BufWriter is doomed to overwhelm the application logic.
2017-01-19 12:23:32 +00:00
whitequark 15a344f1d3 Don't respond with RST to ACKs in TCP LISTEN state.
These packets may have been destined for a different socket.
2017-01-17 04:43:51 +00:00
whitequark 591993014e Reject, not accept, TCP RST packets in LISTEN state.
These packets may have been destined for a different socket.
2017-01-17 04:33:37 +00:00
whitequark ac38ddd936 Add reference counting to SocketSet. 2017-01-17 02:47:14 +00:00
whitequark 74d1eb86b6 Add TcpSocket::abort(). 2017-01-17 01:24:51 +00:00
whitequark a75f7d4bf0 Reject all TCP packets in the CLOSED state. 2017-01-17 00:24:47 +00:00
whitequark 4da2598ea7 Properly document TCP state machine query methods. 2017-01-17 00:21:07 +00:00
whitequark f126eab193 Distinguish sockets by debug identifiers (socket set indexes). 2017-01-16 23:35:21 +00:00
whitequark 40716a348d Do not send RST in response to invalid SEQ or ACK. 2017-01-16 16:58:45 +00:00
whitequark bd01cdef78 Always display meaningful endpoint in trace messages. 2017-01-16 16:34:24 +00:00
whitequark 51d8afe579 Fix inverted meaning of TcpSocketBuffer::empty(). 2017-01-15 11:00:04 +00:00
whitequark c0697cf37d Add lots of sanity checking to TCP test helpers. 2017-01-14 12:56:58 +00:00
whitequark a864157feb Do not try to retransmit SYN as if it was in data stream. 2017-01-14 12:18:00 +00:00
whitequark 62883a6e0b Don't display IP packet error twice when pretty-printing. 2017-01-14 12:09:30 +00:00
whitequark 578d7bce5f Calculate IP payload length from the total length field.
Before this commit, IP payload length was calculated by subtracting
the IP header length from the total underlying buffer length, which
fails if the underlying buffer has padding, e.g. like Ethernet
does.
2017-01-14 11:07:06 +00:00
whitequark 9b24627d69 Pretty-print TCP and UDP representations, and verify checksums. 2017-01-14 10:08:08 +00:00
whitequark 8b04d8bebe Try to get TCP state query methods into a saner state. 2017-01-14 09:13:25 +00:00
whitequark f7bc7fe364 Do not use UTF-8 in net_trace!().
This may interact badly with other tooling.
2017-01-14 07:10:20 +00:00
whitequark dc8809288f Fix a bug that caused .send();.close(); to result in a lost FIN. 2017-01-14 06:59:58 +00:00
whitequark cca835a45a Update TcpSocket::{can,may}_{send,recv} APIs. 2017-01-14 06:59:58 +00:00
whitequark 9fb6d6f4b2 impl Debug for SocketSet. 2017-01-12 05:42:54 +00:00
whitequark 4b92c25fa3 Rework the user-facing error handling in UDP sockets. 2017-01-12 04:18:18 +00:00
whitequark 6ccc48d647 Allow copying socket set handles.
Trying to keep them unique was kind of a losing battle anyway.
2017-01-12 04:10:24 +00:00
whitequark 7f095f6429 Return the amount of bytes sent from UdpSocket::send_slice. 2017-01-11 06:39:27 +00:00
whitequark f01ce30466 Add functions to check if the UDP socket buffers are empty or not. 2017-01-11 06:34:12 +00:00
whitequark 3b18727032 Swap the data and endpoint in UdpSocket methods.
This is to match libstd.
2017-01-11 06:23:17 +00:00
whitequark 362c954624 Make interfaces not own the sockets. 2017-01-11 05:25:54 +00:00
whitequark 83b70b12af Make binding the UDP socket an explicit operation. 2017-01-11 04:44:42 +00:00
whitequark 234e5ef29e Implement socket sets. 2017-01-11 04:05:41 +00:00
whitequark 83bb8c6ae8 Update docs. 2017-01-10 12:29:24 +00:00
whitequark 1ea9a5125b Use ManagedSlice in SliceArpCache. 2017-01-10 11:57:14 +00:00
whitequark 0e006383f2 Use Managed/ManagedSlice for EthernetInterface. 2017-01-10 11:37:12 +00:00
whitequark 67430aa589 Use the managed crate. 2017-01-10 11:04:00 +00:00