Commit Graph

32 Commits

Author SHA1 Message Date
Avi Kivity
03c532eb03 net: tcp: only emit packet when needed 2014-09-04 09:21:18 +03:00
Avi Kivity
21d79c6a57 net: tcp: transmit data in outgoing packets 2014-09-04 09:20:44 +03:00
Avi Kivity
6e37ef5a6c net: tcp: advance sequence number after our SYN is acked 2014-09-04 09:16:46 +03:00
Avi Kivity
e16ccd5fc5 net: tcp: keep track of whether our SYN was sent 2014-09-04 09:16:46 +03:00
Avi Kivity
f81450c1de net: add iostream support to tcp_seq 2014-09-04 09:14:02 +03:00
Avi Kivity
8c5ce8c63f net: add iostream support to packed<> 2014-09-04 09:13:42 +03:00
Avi Kivity
6a53e41053 net: packet sharing support
Add a share() method that enables reference counting for the packet and
returns a clone.  The packet's deleter will only be invoked after all clones
are destroyed.

This is useful for tcp, which keeps a packet in the unacknowledged transmit
queue while sending it lower down the stack.
2014-09-04 09:13:00 +03:00
Avi Kivity
7739e5a85e net: tcp: handle trivial case of merge_out_of_order() 2014-09-03 11:59:46 +03:00
Avi Kivity
99e0d27b7c net: tcp: do not add empty packet to receive queue 2014-09-03 11:59:26 +03:00
Avi Kivity
1bf1212306 net: tcp: insert newly created tcb into hash table 2014-09-03 11:59:05 +03:00
Avi Kivity
f8132a8180 net: tcp: change receive() interface
Instead of returning a future<packet>, return a future<> (signifying data
is available) and provide a read() method.

This is useful in case the user wants to consume more or less than exactly
one packet.
2014-09-03 11:57:44 +03:00
Avi Kivity
d74b732396 net: tcp: set up initial receive window 2014-09-03 11:56:42 +03:00
Avi Kivity
ee3c7a0c1d net: add packet::append(packet&&)
Allows constructing a mega-packet out of several input packets.
2014-09-03 11:55:07 +03:00
Avi Kivity
c70ab64e1a net: tcp: rename tcb::received() to tcb::input() 2014-09-03 10:30:25 +03:00
Avi Kivity
3d6a7bfdc6 net: tcp: drop non-SYN packets that do not map to an existing tcb 2014-09-03 09:58:32 +03:00
Avi Kivity
47a473b3f2 net: split tcp processing into input and output 2014-09-03 09:57:41 +03:00
Avi Kivity
b65e054604 net: optimize prepending headers to empty packets 2014-09-03 09:56:56 +03:00
Avi Kivity
602eaeded7 net: fix printing ethernet addresses 2014-09-02 23:32:15 +03:00
Avi Kivity
1fbe325f63 net: add a helper to allocate a header in an existing packet
Use in IP and ethernet layers.
2014-09-02 23:29:43 +03:00
Avi Kivity
1396459085 net: integrate tcp into ipv4
Define the traits class used to communicate address types and pseudo header
to tcp, and a few glue classes.
2014-09-02 20:39:12 +03:00
Avi Kivity
a5812f2495 net: tcp
Rudimentary TCP support (establishes a connection then falls over, lots of
things missing).

In a departure from tradition, we don't have a state enum with all the
traditional LISTENING states etc.  Instead we have boolean values
indicating whether an event (like a remote SYN received, or our SYN
acknowledged) has happened.  This simplifies things, because in TCP
the sending side and the receiving side are mostly orthogonal, while the
TCP state mixes the two.

TCP is implemented as a template, in order to tune it for the differences
in TCP/IPv4 vs. TCP/IPv6 (mostly address size and pseudo header).
2014-09-02 20:35:49 +03:00
Avi Kivity
673dd21c8b net: fix ip tx
- checksum
- total length
- endianness

were all wrong.
2014-09-02 20:34:19 +03:00
Avi Kivity
c6412f23fc net: fix ip netmask checks 2014-09-02 20:33:49 +03:00
Avi Kivity
9a731c9a56 net: make packed<> friendly to ntoh()/hton() 2014-09-02 20:33:13 +03:00
Avi Kivity
577ac850c8 inet: move ip_checksum into a separate header
Thus it can be used by tcp.
2014-09-02 20:32:03 +03:00
Avi Kivity
7473b13275 net: fix packet::trim_front() when trimming entire packet
When trimming the tcp header from a tcp packet without any data (such
as a SYN), nothing remains.  trim_front() did not account for this,
and crashed.

Fix by checking for the condition.
2014-09-02 18:24:34 +03:00
Avi Kivity
0a45d4d73b net: implement IPv4 L3->l4 dispatching 2014-09-01 15:19:17 +03:00
Avi Kivity
b2b24031e9 net: generalize IP checksummer
Allow it to checksum packets and fragments.
2014-09-01 15:17:27 +03:00
Avi Kivity
001616f7e4 arp: fix build error 2014-09-01 15:16:53 +03:00
Avi Kivity
0fbda7c1ec Fix IP checksum for off lengths
Since the data is in network byte order, we must pad the last word to the right.
2014-08-31 23:37:34 +03:00
Avi Kivity
3a75cf1d55 virtio: clear entire virtio net header
Linux looks at the gso hdr_len field even if gso is not used, and refuses
to send the packet if it isn't reasonable.  mode=debug poisons memory,
causing the value to be unreasonable.

Fix by clearing the entire header.
2014-08-31 22:46:27 +03:00
Avi Kivity
c77f77ee3f build: organize files into a directory structure 2014-08-31 21:29:13 +03:00