Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retransmissions and duplicate acks #140

Closed
talex5 opened this issue May 24, 2015 · 17 comments
Closed

Retransmissions and duplicate acks #140

talex5 opened this issue May 24, 2015 · 17 comments

Comments

@talex5
Copy link
Contributor

talex5 commented May 24, 2015

Testing from my cubieboard2, I'm getting a lot of TCP retransmissions and duplicate acks. It happens frequently when using TLS, but I have seen it even just streaming plain TCP (without even HTTP), though it took many tries before I saw it.

Here are some pcap files in case someone more knowledgable wants to take a look:

  • http://test.roscidus.com/static/cuekeeper-tls-fail-fast.pcap : a trace showing Mirage ignoring the first client hello, then sending a server hello on the retransmit, getting an ack for it and immediately sending two duplicate acks, followed by lots more strangeness later. The client is Firefox trying to load CueKeeper.
  • http://test.roscidus.com/static/plain-tcp.pcap : a trace from mirage-skeleton/network modified to send a fixed buffer over and over again after reading the client data. There's a dup ack near the start, then things are good for a while, then at 0.9083s it suddenly sends a TCP segment with a much higher sequence number and things go badly for a while, until it eventually recovers at around 4s (I removed the rest of the trace after that). The client is a simple nc invocation.

Could someone who understands TCP and/or Mirage's implementation suggest what could be going on here?

@balrajsingh
Copy link
Member

Trying to understand the trace - for now just looking at plain-tcp.pcap.
Would it be possible for you to create a trace from both sides for the same
connection. This one appears to be from the side saying 'hi!', so a trace
from this side as well as from the sender for the same connection.

As you say there is a dup-ack near the beginning but that's from the
"server" and it's acking the FIN that was send from the client, after it
half-closed the connection. This particular ack is redundant and shouldn't
be there, but it really is quite harmless and doesn't have any effect on
the connection. I think it's because when a FIN is received an ACK is sent
back immediately, but the delayed-ACK timer thinks the ACK wasn't sent.
The cause of the confusion is probably because the seq number that was
advanced for ACK-ing the FIN was just done adhoc in that packet - the
delayed-ACK timer is looking at the overall connection's seq number. It
should be fixed, but this one is harmless.

The real problem is later in the trace. It looks like 1 packet gets lost -
this would be a non event. Oddly instead of that lost packet a packet
about 32 packets ahead (about 46k ahead in the seq nums) arrives - by
itself again this is not serious. All the correct signalling seems to be
happening to recover from the loss/out-of-orderness and little loss of
transfer speed is seen. But during that recovery process many other
packets arrive out of order or are lost. Again the signalling works to
recover from the chaos till there is one lost packet for which TCP is
unable to signal the loss. Usually this is a lost packet that when
received would make the flow whole again (ie the last lost packet) - if the
fast retransmit of this packet is also lost then both sides have no means
left to signal it and get stuck. This now means waiting for the re-xmit
timer to kick in and send out the critical last packet yet again. But by
this stage it looks like the retransmit timeout has backed off so much
because of the chaos, that it kicks in only after about 3 seconds. When
the missing packet is finally received all becomes well again and it's off
and running again.

If you could get a trace from both ends (and from the network as well if
possible) we can try to figure out where the out-of-orderness and loss is
happening. This is not the kind of chaos that networks usually produce
(which is what TCP is tuned to address) - it has the fingerprints of a
problem in stack -> driver -> network interface.

Looking at the other trace now...

On Sun, May 24, 2015 at 12:06 PM, Thomas Leonard notifications@github.com
wrote:

Testing from my cubieboard2, I'm getting a lot of TCP retransmissions and
duplicate acks. It happens frequently when using TLS, but I have seen it
even just streaming plain TCP (without even HTTP), though it took many
tries before I saw it.

Here are some pcap files in case someone more knowledgable wants to take a
look:

http://test.roscidus.com/static/cuekeeper-tls-fail-fast.pcap : a trace
showing Mirage ignoring the first client hello, then sending a server hello
on the retransmit, getting an ack for it and immediately sending two
duplicate acks, followed by lots more strangeness later. The client is
Firefox trying to load CueKeeper.

http://test.roscidus.com/static/plain-tcp.pcap : a trace from
mirage-skeleton/network modified to send a fixed buffer over and over again
after reading the client data. There's a dup ack near the start, then
things are good for a while, then at 0.9083s it suddenly sends a TCP
segment with a much higher sequence number and things go badly for a while,
until it eventually recovers at around 4s (I removed the rest of the trace
after that). The client is a simple nc invocation.

Could someone who understands TCP and/or Mirage's implementation suggest
what could be going on here?


Reply to this email directly or view it on GitHub
#140.

@balrajsingh
Copy link
Member

looking at cuekeeper-..pcap:

The first 'client hello' seems to have gotten lost along the way - it's
present in this trace but since there is no response the assumption is that
it's lost. Again with more traces along the path we can try to figure out
where this loss occurred. Further along this pattern is repeated several
times. Odd that the client-hello pkt is dropped every time.

On Sun, May 24, 2015 at 2:39 PM, Balraj Singh balrajsingh@ieee.org wrote:

Trying to understand the trace - for now just looking at plain-tcp.pcap.
Would it be possible for you to create a trace from both sides for the same
connection. This one appears to be from the side saying 'hi!', so a trace
from this side as well as from the sender for the same connection.

As you say there is a dup-ack near the beginning but that's from the
"server" and it's acking the FIN that was send from the client, after it
half-closed the connection. This particular ack is redundant and shouldn't
be there, but it really is quite harmless and doesn't have any effect on
the connection. I think it's because when a FIN is received an ACK is sent
back immediately, but the delayed-ACK timer thinks the ACK wasn't sent.
The cause of the confusion is probably because the seq number that was
advanced for ACK-ing the FIN was just done adhoc in that packet - the
delayed-ACK timer is looking at the overall connection's seq number. It
should be fixed, but this one is harmless.

The real problem is later in the trace. It looks like 1 packet gets lost

  • this would be a non event. Oddly instead of that lost packet a packet
    about 32 packets ahead (about 46k ahead in the seq nums) arrives - by
    itself again this is not serious. All the correct signalling seems to be
    happening to recover from the loss/out-of-orderness and little loss of
    transfer speed is seen. But during that recovery process many other
    packets arrive out of order or are lost. Again the signalling works to
    recover from the chaos till there is one lost packet for which TCP is
    unable to signal the loss. Usually this is a lost packet that when
    received would make the flow whole again (ie the last lost packet) - if the
    fast retransmit of this packet is also lost then both sides have no means
    left to signal it and get stuck. This now means waiting for the re-xmit
    timer to kick in and send out the critical last packet yet again. But by
    this stage it looks like the retransmit timeout has backed off so much
    because of the chaos, that it kicks in only after about 3 seconds. When
    the missing packet is finally received all becomes well again and it's off
    and running again.

If you could get a trace from both ends (and from the network as well if
possible) we can try to figure out where the out-of-orderness and loss is
happening. This is not the kind of chaos that networks usually produce
(which is what TCP is tuned to address) - it has the fingerprints of a
problem in stack -> driver -> network interface.

Looking at the other trace now...

On Sun, May 24, 2015 at 12:06 PM, Thomas Leonard <notifications@github.com

wrote:

Testing from my cubieboard2, I'm getting a lot of TCP retransmissions and
duplicate acks. It happens frequently when using TLS, but I have seen it
even just streaming plain TCP (without even HTTP), though it took many
tries before I saw it.

Here are some pcap files in case someone more knowledgable wants to take
a look:

http://test.roscidus.com/static/cuekeeper-tls-fail-fast.pcap : a
trace showing Mirage ignoring the first client hello, then sending a server
hello on the retransmit, getting an ack for it and immediately sending two
duplicate acks, followed by lots more strangeness later. The client is
Firefox trying to load CueKeeper.

http://test.roscidus.com/static/plain-tcp.pcap : a trace from
mirage-skeleton/network modified to send a fixed buffer over and over again
after reading the client data. There's a dup ack near the start, then
things are good for a while, then at 0.9083s it suddenly sends a TCP
segment with a much higher sequence number and things go badly for a while,
until it eventually recovers at around 4s (I removed the rest of the trace
after that). The client is a simple nc invocation.

Could someone who understands TCP and/or Mirage's implementation suggest
what could be going on here?


Reply to this email directly or view it on GitHub
#140.

@talex5
Copy link
Contributor Author

talex5 commented May 24, 2015

Thanks! Here's a pair of traces, one from my laptop and one from the cubieboard's dom0 (they're connected only by my home router):

http://test.roscidus.com/static/ck-from-cb2.pcap
http://test.roscidus.com/static/ck-from-laptop.pcap

They look pretty similar to me. The requests were triggered by refreshing Firefox, and it never got the pages (just kept spinning) in this case.

(note: the version of tcpip I'm using is https://github.com/talex5/mirage-tcpip/commits/ignore-trailing-bytes which is master plus the fix for the trailing bytes bug, but I don't think that should be causing these problems)

@balrajsingh
Copy link
Member

There's no real difference between the two - all the packets are in both
and in the same order. So the problem is further up in the mirage stack.
Do you think ocaml-pcap can be used to grab a trace from within the stack.

The trailing bytes fix should not affect this.

The trace doesn't look good. It may be that when mirage has to deal with
the client-hello data it somehow gets so busy that nothing gets sent out,
not even a TCP ack. The laptop retransmits client-hello pkts a couple of
times, but from the timing of the response when it finally appears, it look
like it is not a response to the retransmitted pkts but original hello.
There is more similar behaviour later.

A trace from inside ethif could be very helpful.

Thanks.

On Sun, May 24, 2015 at 3:15 PM, Thomas Leonard notifications@github.com
wrote:

Thanks! Here's a pair of traces, one from my laptop and one from the
cubieboard's dom0 (they're connected only by my home router):

http://test.roscidus.com/static/ck-from-cb2.pcap
http://test.roscidus.com/static/ck-from-laptop.pcap

They look pretty similar to me. The requests were triggered by refreshing
Firefox, and it never got the pages (just kept spinning) in this case.

(note: the version of tcpip I'm using is
https://github.com/talex5/mirage-tcpip/commits/ignore-trailing-bytes
which is master plus the fix for the trailing bytes bug, but I don't think
that should be causing these problems)


Reply to this email directly or view it on GitHub
#140 (comment)
.

talex5 added a commit to talex5/cuekeeper that referenced this issue Jun 1, 2015
@talex5
Copy link
Contributor Author

talex5 commented Jun 2, 2015

I got a trace with mirage-profile:

http://test.roscidus.com/traces/ck-tcp/

At the far right, there are several red "should-resolve" threads. These correspond to unikernel threads for handling HTTP requests (the application flags them as should-resolve and they get highlighted because they don't).

Double-clicking on the highest one (to highlight it) and zooming in on the start, it's waiting for thread 5587 (waiting-for is indicated by the yellow arrow; this is new). Following that right, it ends with thread 5690, which is waiting for User_buffer.take_l. I guess this means it's waiting for data from the network.

Most of the other red threads look similar, but the second to bottom one is waiting on 5431, which ends up waiting for User_buffer.wait_for ("Wait until at least sz bytes are available in the window").

It's quite possible (probable even) that the tracing system is buggy and wrong, but this might be a useful lead...

@talex5
Copy link
Contributor Author

talex5 commented Jun 3, 2015

Here's a better trace, with the corresponding pcap:

It defaults to showing the region where the TCP thread for client port 40312 added some data to its User_buffer.Tx. The interesting thread is near the bottom; you'll need to drag upwards to see it (it's white, so easy to spot).

  1. It adds 1460 bytes to the buffer.
  2. It then adds a further 700 bytes.
  3. clear_buffer gets called to flush it, but get_pkt_to_send returns without doing anything because tx_wnd is zero.
  4. It seems that nothing ever flushes the buffer after that: the User_buffer.Tx.bufbytes#40312 metric is still at its maximum at the end of the trace (I've hidden the other metrics; the HTML GUI doesn't let you toggle them yet).

Looking at the pcap trace in wireshark with the filter tcp.port eq 40312, this connection was very simple:

  1. The TCP handshake completed.
  2. The client sent an SSL Client Hello.
  3. Shortly afterwards, it retransmitted it.
  4. It got an ack, then a duplicate ack.
  5. Later, there was a TCP Keep-Alice and ack.

Is tx_wnd supposed to be zero here?

@talex5
Copy link
Contributor Author

talex5 commented Jun 4, 2015

This looks suspicious:

https://github.com/mirage/mirage-tcpip/blob/master/tcp/segment.ml#L102

(* Determine the transmit window, from the last segment *)
let window q =
  try (S.max_elt q).window
  with Not_found -> 0

I think this means that if there are no segments ready to be read (q is empty) then we set the transmit window to zero, preventing us from sending any futher data. Could this happen if we get a retransmission? Anyone familiar with TCP who can confirm what's supposed to happen here?

talex5 added a commit to talex5/mirage-tcpip that referenced this issue Jun 4, 2015
Before, we set it to size zero, preventing us from sending any further
data. See: mirage#140
talex5 added a commit to talex5/mirage-tcpip that referenced this issue Jun 5, 2015
Before, we set it to size zero, preventing us from sending any further
data. See: mirage#140
@samoht
Copy link
Member

samoht commented Jun 10, 2015

Fixed by #146

@samoht samoht closed this as completed Jun 10, 2015
@talex5
Copy link
Contributor Author

talex5 commented Jun 26, 2015

Reopening because #146 only stopped the connection getting stuck after a retransmission, but doesn't explain why they're happening in the first place.

@talex5 talex5 reopened this Jun 26, 2015
@talex5
Copy link
Contributor Author

talex5 commented Jun 26, 2015

Here's a log from mirage-www, showing a client requesting the index twice, in parallel:

Initialising timer interface
Initialising console ... done.
gnttab_table mapped at 0000000020001000.
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(PATH) -> null
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(TMPDIR) -> null
getenv(TEMP) -> null
Netif: add resume hook
getenv(DEBUG) -> null
getenv(OMD_DEBUG) -> null
getenv(OMD_FIX) -> null
Netif.connect 0
Netfront.create: id=0 domid=0
MAC: c0:ff:ee:c0:ff:ee
Attempt to open(/dev/urandom)!
Manager: connect
Manager: configuring
Manager: Interface to 10.0.0.2 nm 255.255.255.0 gw [10.0.0.1]
[...]
Tcp.PCB: process-syn: [channels=10 listens=0 connects=0]
Tcp.PCB: new-server-connection: [channels=10 listens=0 connects=0]
Tcp.State: Closed  - Passive_open -> Listen
Tcp.State: Listen  - Send_synack(452874759) -> Syn_rcvd(452874759)
Tcp.Segment: TCP transmit seq=452874759
Tcp.PCB: process-syn: [channels=10 listens=1 connects=0]
Tcp.PCB: new-server-connection: [channels=10 listens=1 connects=0]
Tcp.State: Closed  - Passive_open -> Listen
Tcp.State: Listen  - Send_synack(452886026) -> Syn_rcvd(452886026)
Tcp.Segment: TCP transmit seq=452886026
Tcp.PCB: process-ack: [channels=10 listens=2 connects=0]
Tcp.Segment: input
Tcp.State: Syn_rcvd(452874759)  - Recv_ack(452874760) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452874760) -> Established
Tcp.PCB: process-ack: [channels=11 listens=1 connects=0]
Tcp.Segment: input
Tcp.State: Syn_rcvd(452886026)  - Recv_ack(452886027) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452886027) -> Established
200 GET /
Tcp.Segment: TCP transmit seq=452874760
Tcp.Segment: TCP transmit seq=452874777
Tcp.Segment: TCP transmit seq=452874841
200 GET /
Tcp.Segment: TCP transmit seq=452886027
Tcp.Segment: TCP transmit seq=452886044
Tcp.Segment: TCP transmit seq=452886108
Tcp.Segment: TCP transmit seq=452876301
Tcp.Segment: TCP transmit seq=452877761
Tcp.Segment: TCP transmit seq=452878937
Tcp.Segment: TCP transmit seq=452887568
Tcp.Segment: TCP transmit seq=452889028
Tcp.Segment: TCP transmit seq=452890204
conn 11 closed
conn 12 closed
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452874777) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452874841) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452876301) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452886027) -> Established
Tcp.Segment: TCP transmit seq=452880397
Tcp.Segment: TCP transmit seq=452881857
Tcp.Segment: TCP transmit seq=452891664
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452886044) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452886108) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452887568) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452877761) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452877761) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452877761) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452877761) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.Segment: TCP transmit seq=452893124
Tcp.Segment: TCP transmit seq=452894300
Tcp.Segment: TCP transmit seq=452883033
Tcp.Segment: TCP fast retransmission seq=452877761, dupack=452877761
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452877761) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452883372) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452883372) -> Established
Tcp.State: Established  - Recv_fin -> Close_wait
Tcp.Segment: PUSHING TIMER - new time=1.000000, new seq=452889028
Tcp.Segment: TCP retransmission on timer seq = 452889028
Tcp.Segment: PUSHING TIMER - new time = 2.000000, new seq = 452889028
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452894639) -> Established
Tcp.Segment: input
Tcp.State: Established  - Recv_ack(452894639) -> Established
Tcp.State: Established  - Recv_fin -> Close_wait
ARP: timeout 10.0.0.1

It looks like segment 452889028 gets retransmitted after being ack'd. In particular, we have:

Tcp.Segment: TCP transmit seq=452889028
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.State: Established  - Recv_ack(452889028) -> Established
Tcp.Segment: PUSHING TIMER - new time=1.000000, new seq=452889028
Tcp.Segment: TCP retransmission on timer seq = 452889028
Tcp.Segment: PUSHING TIMER - new time = 2.000000, new seq = 452889028

Am I reading this right?

CTF trace is here: http://test.roscidus.com/static/transmit.ctf

Debug logging is on, and I included Mindy's no_urx_close_t branch.
I added a line to log seq when sending the first time (in Segment.Tx.output):

Log.f debug (fun fmt -> Log.pf fmt "TCP transmit seq=%a" Sequence.pp seq);

@MagnusS
Copy link
Member

MagnusS commented Jun 26, 2015

Not sure if this should be a separate issue, but there's always a duplicate ack sent after we close a connection. These examples are from the pcap's recorded from the tests:

$ tshark -nr tests/pcap/tcp_iperf_two_stacks_basic.pcap | tail -n 5
13710   1.694047   10.0.0.100 -> 10.0.0.101   TCP 54 5001 > 18442 [FIN, ACK] Seq=1 Ack=10000002 Win=262140 Len=0
13711   1.694124   10.0.0.101 -> 10.0.0.100   TCP 54 18442 > 5001 [ACK] Seq=10000002 Ack=2 Win=262140 Len=0
13712   1.694272   10.0.0.100 -> 10.0.0.101   TCP 54 [TCP Dup ACK 13710#1] 5001 > 18442 [ACK] Seq=2 Ack=10000002 Win=262140 Len=0
13713   1.694357   10.0.0.101 -> 10.0.0.100   TCP 54 [TCP Dup ACK 13711#1] 18442 > 5001 [ACK] Seq=10000002 Ack=2 Win=262140 Len=0
13714   1.694397   10.0.0.100 -> 10.0.0.101   TCP 54 5001 > 18442 [RST, ACK] Seq=2 Ack=10000002 Win=0 Len=0
$ tshark -nr tests/pcap/tcp_iperf_two_stacks_uniform_packet_loss.pcap|tail -n 5
13634  78.002340   10.0.0.100 -> 10.0.0.101   TCP 54 5001 > 19123 [FIN, ACK] Seq=1 Ack=10000002 Win=262140 Len=0
13635  78.002417   10.0.0.101 -> 10.0.0.100   TCP 54 19123 > 5001 [ACK] Seq=10000002 Ack=2 Win=262140 Len=0
13636  78.002566   10.0.0.100 -> 10.0.0.101   TCP 54 [TCP Dup ACK 13634#1] 5001 > 19123 [ACK] Seq=2 Ack=10000002 Win=262140 Len=0
13637  78.002652   10.0.0.101 -> 10.0.0.100   TCP 54 [TCP Dup ACK 13635#1] 19123 > 5001 [ACK] Seq=10000002 Ack=2 Win=262140 Len=0
13638  78.002698   10.0.0.100 -> 10.0.0.101   TCP 54 5001 > 19123 [RST, ACK] Seq=2 Ack=10000002 Win=0 Len=0
$ tshark -nr tests/pcap/tcp_connect_two_stacks_basic.pcap | tail -n 5
  8   0.102135   10.0.0.101 -> 10.0.0.100   TCP 91 [TCP segment of a reassembled PDU]
  9   0.102217   10.0.0.100 -> 10.0.0.101   TCP 54 80 > 15426 [ACK] Seq=1 Ack=38 Win=262140 Len=0
 10   0.102437   10.0.0.101 -> 10.0.0.100   TCP 54 15426 > 80 [FIN, ACK] Seq=38 Ack=1 Win=262140 Len=0
 11   0.102514   10.0.0.100 -> 10.0.0.101   TCP 54 80 > 15426 [ACK] Seq=1 Ack=39 Win=262140 Len=0
 12   0.102665   10.0.0.100 -> 10.0.0.101   TCP 54 [TCP Dup ACK 11#1] 80 > 15426 [ACK] Seq=1 Ack=39 Win=262140 Len=0

@talex5
Copy link
Contributor Author

talex5 commented Jul 1, 2015

Here's a simple log from requesting the index page of mirage-www using curl, with debug on (including some extra debug in ack.ml):

ARP: sending gratuitous from 10.0.0.2
Manager: configuration done
Listening on http://localhost/
ARP responding to: who-has 10.0.0.2?
Tcp.PCB: process-syn: [channels=0 listens=0 connects=0]
Tcp.PCB: new-server-connection: [channels=0 listens=0 connects=0]
Tcp.State: Closed  - Passive_open -> Listen
Tcp.State: Listen  - Send_synack(452916572) -> Syn_rcvd(452916572)
Tcp.Wire: xmit checksum=d85a 10.0.0.2.80->192.168.0.11.39081 rst=false syn=true fin=false psh=false seq=452916572 ack=4282201965 options=[ MSS=1460
Window>> 2 ] datalen=0 datafrag=0 dataoff=7 olen=8
ARP: transmitting probe -> 10.0.0.1
ARP: updating 10.0.0.1 -> fe:ff:ff:ff:ff:ff
Tcp.PCB: Notify ACK: have sent 4282201965
Tcp.ACK: Immediate.transmit 4282201965
Tcp.PCB: process-ack: [channels=0 listens=1 connects=0]
Tcp.State: Syn_rcvd(452916572)  - Recv_ack(452916573) -> Established
Tcp.State: Established  - Recv_ack(452916573) -> Established
Tcp.ACK: Immediate.receive 4282202037
Tcp.ACK: Immediate.pushack 4282202037
[HTTP 1] 200 GET /
Tcp.Wire: xmit checksum=44f8 10.0.0.2.80->192.168.0.11.39081 rst=false syn=false fin=false psh=true seq=452916573 ack=4282202037 options=[] datalen=17 datafrag=1 dataoff=5 olen=0
Tcp.Wire: xmit checksum=5936 10.0.0.2.80->192.168.0.11.39081 rst=false syn=false fin=false psh=true seq=452916590 ack=4282202037 options=[] datalen=64 datafrag=1 dataoff=5 olen=0
Tcp.Wire: xmit checksum=1132 10.0.0.2.80->192.168.0.11.39081 rst=false syn=false fin=false psh=true seq=452916654 ack=4282202037 options=[] datalen=1460 datafrag=1 dataoff=5 olen=0
Tcp.ACK: Immediate.transmit 4282202037
Tcp.PCB: send_empty_ack: sending 4282202037 (mvar requested 4282202037)
Tcp.Wire: xmit checksum=fed1 10.0.0.2.80->192.168.0.11.39081 rst=false syn=false fin=false psh=false seq=452918114 ack=4282202037 options=[] datalen=0 datafrag=0 dataoff=5 olen=0
Tcp.PCB: Notify ACK: have sent 4282202037
Tcp.ACK: Immediate.transmit 4282202037
Tcp.PCB: Notify ACK: have sent 4282202037
Tcp.ACK: Immediate.transmit 4282202037
Tcp.PCB: Notify ACK: have sent 4282202037
Tcp.ACK: Immediate.transmit 4282202037

If I'm reading it right, then in this sequence we send a segment with ack=4282202037, notify the ACK system that we've sent it, and then immediately send an empty ACK packet with it again:

Tcp.Wire: xmit checksum=1132 10.0.0.2.80->192.168.0.11.39081 rst=false syn=false fin=false psh=true seq=452916654 ack=4282202037 options=[] datalen=1460 datafrag=1 dataoff=5 olen=0
Tcp.ACK: Immediate.transmit 4282202037
Tcp.PCB: send_empty_ack: sending 4282202037 (mvar requested 4282202037)
Tcp.Wire: xmit checksum=fed1 10.0.0.2.80->192.168.0.11.39081 rst=false syn=false fin=false psh=false seq=452918114 ack=4282202037 options=[] datalen=0 datafrag=0 dataoff=5 olen=0

Wireshark indeed reports a duplicate ACK here.

Can someone explain what's supposed to happen here?

@MagnusS
Copy link
Member

MagnusS commented Jul 7, 2015

@talex5 Hm, could this have been caused by packet loss + dup ack's to trigger fast retransmit and then the broken timer from #157?

@talex5
Copy link
Contributor Author

talex5 commented Jul 7, 2015

Maybe, but I'm still suspicious about why the retransmissions are happening in the first place. The original traces were my Cubieboard sending data to my laptop, and I'd be very surprised if my laptop wasn't able to keep up with it and was dropping packets.

@MagnusS
Copy link
Member

MagnusS commented Jul 7, 2015

I created a separate issue for the dup ack's when closing a connection in #162 as it seems to be unrelated to the cubieboard-problem.

@talex5
Copy link
Contributor Author

talex5 commented Jul 24, 2015

The retransmissions aren't causing any major problems now, but I'm still interested in understanding what causes them.

Here are some more traces. This is from a Unix process that just sends lots of TCP data in a loop (for the record, the code is in https://github.com/talex5/mirage-skeleton/tree/debug-retransmissions in the network directory):

http://test.roscidus.com/traces/2015-07-24/linux.pcap
http://test.roscidus.com/traces/2015-07-24/mirage-unix.pcap

mirage-unix.pcap is generated by this code, showing packets sent to and received from the network device (mirage-unix-net), which is a Linux tap device.

linux.pcap is the same test run, as recorded by tshark -i tap0 -w linux.pcap -b filesize:1024 -b files:3 on Linux, and taking the last file from the ring.

In mirage-unix.pcap, we record sending a segment with sequence number 631948077 early on (#938 in that trace), then we get some duplicate acks asking for it (but we don't retransmit), then we get a higher ack showing it had arrived.

In linux.pcap, the same segment appears after the acks (#579, as a TCP fast retransmission, with a "TCP Previous segment not captured" where it should have been).

So, it seems that the packets got reordered somewhere after Netif.write and before wireshark captured them at the other end of the tap device! I don't know whether this is Linux being strange, or if we're missing some locking when we do the writes. Wiggling the mouse during the run seems to trigger these effects fairly quickly.

@yomimono
Copy link
Contributor

I'm closing this in favor of #314 ; feel free to reopen if you feel something here isn't reflected there.

avsm added a commit to avsm/opam-repository that referenced this issue Feb 3, 2019
CHANGES:

* Use `Lwt_dllist` instead of `Lwt_sequence`, due to the latter being deprecated
  upstream in Lwt (ocsigen/lwt#361) (mirage/mirage-tcpip#388 by @avsm).
* Remove arpv4 and ethif sublibraries, now provided by ethernet and arp-mirage
  opam packages (mirage/mirage-tcpip#380 by @hannesm).
* Upgrade from jbuilder to dune (mirage/mirage-tcpip#391 @avsm)
* Switch from topkg to dune-release (mirage/mirage-tcpip#391 @avsm)

### v3.6.0 (2019-01-04)

* The IPv4 implementation now supports reassembly of IPv4 fragments (mirage/mirage-tcpip#375 by @hannesm)
  - using a LRU cache using up to 256KB memory
  - out of order fragments are supported
  - maximum number of fragments is 16
  - timeout between first and last fragment is 10s
  - overlapping fragments are dropped

* IPv6: use correct timeout value after first NS message (mirage/mirage-tcpip#334 @djs55)

* Use `Ipaddr.pp` instead of `Ipaddr.pp_hum` due to upstream
  interface changes (mirage/mirage-tcpip#385 @hannesm).

### v3.5.1 (2018-11-16)

* socket stack (tcp/udp): catch exception in recv_from and accept (mirage/mirage-tcpip#376 @hannesm)
* use mirage-random-test for testing (Stdlibrandom got removed from mirage-random>1.2.0, mirage/mirage-tcpip#377 @hannesm)

### v3.5.0 (2018-09-16)

* Ipv4: require Mirage_random.C, used for generating IPv4 identifier instead of using OCaml's stdlib Random directly (mirage/mirage-tcpip#371 @hannesm)
* Tcp: use entire 32 bits at random for the initial sequence number, thanks to Spencer Michaels and Jeff Dileo of NCC Group for reporting (mirage/mirage-tcpip#371 @hannesm)
* adjust to mirage-protocols 1.4.0 and mirage-stack 1.3.0 changes (mirage/mirage-tcpip#371 @hannesm)
  Arp no longer contains the type alias ethif
  Ethif no longer contains the type alias netif
  Static_ipv4 no longer contains the type alias ethif and prefix
  Ipv6 no longer contains the type alias ethif and prefix
  Mirage_protocols_lwt.IPV4 no longer contains the type alias ethif
  Mirage_protocols_lwt.UDPV4 and TCPV4 no longer contain the type alias ip
* remove unused types: 'a config, netif, and id from socket and direct stack (mirage/mirage-tcpip#371 @hannesm)
* remove usage of Result, depending on OCaml >= 4.03.0 (mirage/mirage-tcpip#372 @hannesm)

### v3.4.2 (2018-06-15)

Note the use of the new TCP keep-alive feature can cause excessive amounts
of memory to be used in some circumstances, see
  mirage/mirage-tcpip#367

* Ensure a zero UDP checksum is sent as 0xffff, not 0x0000 (mirage/mirage-tcpip#359 @stedolan)
* Avoid leaking a file descriptor in the socket stack if the connection fails (mirage/mirage-tcpip#363 @hannesm)
* Avoid raising an exception with `Lwt.fail` when `write` fails in the socket stack (mirage/mirage-tcpip#363 @hannesm)
* Ignore `EBADF` errors in `close` in the socket stack (mirage/mirage-tcpip#366 @hannesm)
* Emit a warning when TCP keep-alives are used (mirage/mirage-tcpip#368 @djs55)

### v3.4.1 (2018-03-09)

* expose tcp_socket_options in the socket stack, fixing downstream builds (mirage/mirage-tcpip#356 @yomimono)
* add missing dependencies and constraints (mirage/mirage-tcpip#354 @yomimono, mirage/mirage-tcpip#353 @rgrinberg)
* remove leftover ocamlbuild files (mirage/mirage-tcpip#353 @rgrinberg)

### v3.4.0 (2018-02-15)

* Add support for TCP keepalives (mirage/mirage-tcpip#338 @djs55)
* Fix TCP deadlock (mirage/mirage-tcpip#343 @mfp)
* Update the CI to test OCaml 4.04, 4.05, 4.06 (mirage/mirage-tcpip#344 @yomimono)

### v3.3.1 (2017-11-07)

* Add an example for user-space `ping`, and some socket ICMPv4 fixes (mirage/mirage-tcpip#336 @djs55)
* Make tcpip safe-string-safe (and buildable by default on OCaml 4.06.0) (mirage/mirage-tcpip#341 @djs55)

### v3.3.0 (2017-08-08)

* Test with current mirage-www master (mirage/mirage-tcpip#323 @yomimono)
* Improve the Tcp.Wire API (mirage/mirage-tcpip#325 @samoht)
* Add dependency from stack-unix to io-page-unix (@avsm)
* Replace dependency on cstruct.lwt with cstruct-lwt (mirage/mirage-tcpip#322 @yomimono)
* Update to lwt 3.0 (mirage/mirage-tcpip#326 @samoht)
* Replace oUnit with alcotest (mirage/mirage-tcpip#329 @samoht)
* Fix stub linking on Xen (mirage/mirage-tcpip#332 @djs55)
* Add support for ICMP sockets on Windows (mirage/mirage-tcpip#333 @djs55)

### v3.2.0 (2017-06-26)

* port to jbuilder. Build time is now roughly 4-5x faster than the old oasis-based build system.
* packs have been replaced by module aliases.

### v3.1.4 (2017-06-12)

* avoid linking to cstruct.ppx in the compiled library and only use it at build time (mirage/mirage-tcpip#316 @djs55)
* use improved packet size support in `mirage-vnetif>=0.4.0` to test the MTU fixes in mirage/mirage-tcpip#313.

### v3.1.3 (2017-05-23)

* involve the IP layer's MTU in the TCP MSS calculation (hopefully correctly) (mirage/mirage-tcpip#313, by @yomimono)

### v3.1.2 (2017-05-14)

* impose a maximum TCP MSS of 1460 to avoid sending over-large datagrams on 1500 MTU links
  (mirage/mirage-tcpip#309, by @hannesm)

### v3.1.1 (2017-05-14)

* fix parsing 20-byte cstructs as ipv4 packets (mirage/mirage-tcpip#307, by @yomimono)
* udp: payload length parse fix (mirage/mirage-tcpip#307, by @yomimono)
* support lwt >= 2.7.0 (mirage/mirage-tcpip#308, by @djs55)

### v3.1.0 (2017-03-14)

* implement MTU setting and querying in the Ethernet module (compatibility with mirage-protocols version 1.1.0), and use this value to inform TCP's MSS. (mirage/mirage-tcpip#288, by @djs55)
* rename the ~payload argument of TCP/UDP marshallers to `~payload_len`, in an attempt to clarify that the payload will not be copied to the Cstruct.t returned by these functions (mirage/mirage-tcpip#301, by @talex5)
* functorize ipv6 over a random implementation (mirage/mirage-tcpip#298, by @olleolleolle and @hannesm)
* add tests for sending and receiving UDP packets over IPv6 (mirage/mirage-tcpip#300, by @mattgray)
* avoid float in TCP RTO calculations. (mirage/mirage-tcpip#295, by @olleolleolle and @mattgray)
* numerous bugfixes in header marshallers and unmarshallers (mirage/mirage-tcpip#301, by @talex5 and @yomimono)
* replace polymorphic equality in `_packet.equals` functions (mirage/mirage-tcpip#302, by @yomimono)

### v3.0.0 (2017-02-23)

* adapt to MirageOS 3 API changes (*many* PRs, from @hannesm, @samoht, and @yomimono):
  - replace error polyvars in many functions with result types
  - define and use error types
  - `connect` in various modules now returns the device directly or raises an exception
  - refer to mirage-protocols and mirage-stacks, rather than mirage-types
* if no UDP source port is given to UDP.write, choose a random one (mirage/mirage-tcpip#272, by @hannesm)
* remove `Ipv4.Routing.No_route_to_destination_address` exception; treat routing failures as normal packet loss in TCP (mirage/mirage-tcpip#269, by @yomimono)
* Ipv6.connect takes a list of IPs (mirage/mirage-tcpip#268, by @yomimono)
* remove exception "Refused" in TCP (mirage/mirage-tcpip#267, by @yomimono)
* remove DHCP module. Users may be interested in the replacement charrua-core (mirage/mirage-tcpip#260, by @yomimono)
* move Ipv4 to Static\_ipv4, which can be used by other IPv4 modules with their own configuration logic (mirage/mirage-tcpip#260, by @yomimono)
* remove `mode` from STACKV4 record and configuration; Ipv4.connect now requires address parameters and the module exposes no methods for modifying them. (mirage/mirage-tcpip#260, by @yomimono)
* remove unused `id` types no longer required by mirage-types (mirage/mirage-tcpip#255, by @yomimono)
* overhaul how `random` is used and handled (mirage/mirage-tcpip#254 and others, by @hannesm)
* fix redundant `memset` that zeroed out options in Tcp\_packet.Marshal.into\_cstruct (mirage/mirage-tcpip#250, by @balrajsingh)
* add vnetif backend for triggering fast retransmit in iperf tests (mirage/mirage-tcpip#248, by @MagnusS)
* fixes for incorrect timer values (mirage/mirage-tcpip#247, by @balrajsingh)
* add vnetif backend that drops packets with no payload (mirage/mirage-tcpip#246, by @MagnusS)
* fix a race when closing test pcap files (mirage/mirage-tcpip#246, by @MagnusS)

### v2.8.1 (2016-09-12)

* Set the TCP congestion window correctly when going into fast-recovery mode. (mirage/mirage-tcpip#244, by @balrajsingh)
* When TCP packet loss is discovered by timeout, allow transition into fast-recovery mode. (mirage/mirage-tcpip#244, by @balrajsingh)

### v2.8.0 (2016-04-04)

* Provide an implementation for the ICMPV4 module type defined in mirage-types 2.8.0.  Remove default ICMP handling from the IPv4 module, but preserve it in tcpip-stack-direct. (mirage/mirage-tcpip#195 by @yomimono)
* Explicitly require the use of an OCaml compiler >= 4.02.3 . (mirage/mirage-tcpip#195 by @yomimono)
* Explicitly depend on `result`. (mirage/mirage-tcpip#195 by @yomimono)

### v2.7.0 (2016-03-20)

* Raise Invalid\_argument if given an invalid port number in listen_{tcp,udp}v4
  (mirage/mirage-tcpip#173 by @matildah and mirage/mirage-tcpip#175 by @hannesm)
* Improve TCP options marshalling/unmarshalling (mirage/mirage-tcpip#174 by @yomimono)
* Add state tests and fixes for closure conditions (mirage/mirage-tcpip#177 mirage/mirage-tcpip#176 by @yomimono)
* Remove bogus warning (mirage/mirage-tcpip#178 by @talex5)
* Clean up IPv6 stack (mirage/mirage-tcpip#179 by @nojb)
* RST checking from RFC5961 (mirage/mirage-tcpip#182 by @ppolv)
* Transform EPIPE exceptions into `Eof (mirage/mirage-tcpip#183 by @djs55)
* Improve error strings in IPv4 (mirage/mirage-tcpip#184 by @yomimono)
* Replace use of cstruct.syntax with cstruct.ppx (mirage/mirage-tcpip#188 by @djs55)
* Make the Unix subpackages optional, so the core builds on Win32
  (mirage/mirage-tcpip#191 by @djs55)

### v2.6.1 (2015-09-15)

* Add optional arguments for settings in ip v6 and v4 connects (mirage/mirage-tcpip#170, by @Drup)
* Expose `Ipv4.Routing.No_route_to_destination_address` (mirage/mirage-tcpip#166, by @yomimono)

### v2.6.0 (2015-07-29)

* ARP now handles ARP frames, not Ethernet frames with ARP payload
  (mirage/mirage-tcpip#164, by @hannesm)
* Check length of received ethernet frame to avoid cstruct exceptions
  (mirage/mirage-tcpip#117, by @hannesm)
* Pull arpv4 module out of ipv4. Also add unit-tests for the newly created
  ARP library  (mirage/mirage-tcpip#155, by @yomimono)

### v2.5.1 (2015-07-07)

* Fix regression introduced in 2.5.0 where packet loss could lead to the
  connection to become very slow (mirage/mirage-tcpip#157, MagnusS, @talex5, @yomimono and
  @balrajsingh)
* Improve the tests: more logging, more tracing and compile to native code when
  available, etc (@MagnusS and @talex5)
* Do not raise `Invalid_argument("Lwt.wakeup_result")` everytime a connection
  is closed. Also now pass the raised exceptions to `Lwt.async_exception_hook`
  instead of ignoring them transparently, so the user can decide to shutdown
  its application if something wrong happens (mirage/mirage-tcpip#153, mirage/mirage-tcpip#156, @yomomino and @talex5)
* The `channel` library now lives in a separate repository and is released
  separately (mirage/mirage-tcpip#159, @samoht)

### v2.5.0 (2015-06-10)

* The test runs now produce `.pcap` files (mirage/mirage-tcpip#141, by @MagnusS)
* Strip trailing bytes from network packets (mirage/mirage-tcpip#145, by @talex5)
* Add tests for uniform packet loss (mirage/mirage-tcpip#147, by @MagnusS)
* fixed bug where in case of out of order packets the ack and window were set
  incorrectly (mirage/mirage-tcpip#140, mirage/mirage-tcpip#146)
* Properly handle RST packets (mirage/mirage-tcpip#107, mirage/mirage-tcpip#148)
* Add a `Log` module to control at runtime the debug statements which are
  displayed (mirage/mirage-tcpip#142)
* Writing in a PCB which does not have the right state now returns an error
  instead of blocking (mirage/mirage-tcpip#150)

### v2.4.3 (2015-05-05)

* Fix infinite loop in `Channel.read_line` when the line does not contain a CRLF
  sequence (mirage/mirage-tcpip#131)

### v2.4.2 (2015-04-29)

* Fix a memory leak in `Channel` (mirage/mirage-tcpip#119, by @yomimono)
* Add basic unit-test for channels (mirage/mirage-tcpip#119, by @yomimono)
* Add alcotest testing templates
* Modernize Travis CI scripts

### v2.4.1 (2015-04-21)

* Merge between 2.4.0 and 2.3.1

### v2.4.0 (2015-03-24)

* ARP improvements (mirage/mirage-tcpip#118)

### v2.3.1 (2015-03-31)

* Do not raise an assertion if an IP frame has extra trailing bytes (mirage/mirage-tcpip#221).

### v2.3.0 (2015-03-09)

* Fix `STACKV4` for the `DEVICE` signature which has `connect` removed
  (in Mirage types 2.3+).

### v2.2.3 (2015-03-09)

* Add ICMPv6 error reporting functions (mirage/mirage-tcpip#101)
* Add universal IP address converters (mirage/mirage-tcpip#108)
* Add `error_message` functions for human-readable errors (mirage/mirage-tcpip#98)
* Improve debug logging for ICMP Destination Unreachable packets.
* Filter incoming frames by MAC address to stop sending unnecessary RSTs. (mirage/mirage-tcpip#114)
* Unhook unused modules `Sliding_window` and `Profiler` from the build. (mirage/mirage-tcpip#112)
* Add an explicit `connect` method to the signatures. (mirage/mirage-tcpip#100)

### v2.2.2 (2015-01-11)

* Readded tracing and ARP fixes which got accidentally reverted in the IPv6
  merge. (mirage/mirage-tcpip#96)

### v2.2.1 (2014-12-20)

* Use `Bytes` instead of `String` to begin the `-safe-string` migration in OCaml
  4.02.0 (mirage/mirage-tcpip#93).
* Remove dependency on `uint` to avoid the need for a C stub (mirage/mirage-tcpip#92).

### v2.2.0 (2014-12-18)

Add IPv6 support. This changeset minimises interface changes to the existing
`STACKV4` interfaces to faciliate a progressive merge.  The only visible
interface changes are:

* `IPV4.set_ipv4_*` functions have been renamed `IPV4.set_ip_*` because they
  are shared between IPV4 and IPV6.
* `IPV4.get_ipv4` and `get_ipv4_netmask` now return a `list` of `Ipaddr.V4.t`
  (again because this is the common semantics with IPV6.)
* Several types that had `v4` in their names (like `IPV4.ipv4addr`) have lost
  that particle.

### v2.1.1 (2014-12-12)

* Improve console printing for the DHCP client to output line
  breaks properly on Xen consoles.

### v2.1.0 (2014-12-07)

* Build Xen stubs separately, with `CFLAGS` from `mirage-xen` 2.1.0+.
  This allows us to use the red zone under x86_64 Unix again.
* Adding tracing labels and counters, which introduces a new dependency on the
  `mirage-profile` package.

### v2.0.3 (2014-12-05)

* Fixed race waiting for ARP response (mirage/mirage-tcpip#86).
* Move the the code that configures IPv4 address, netmask and gateways
  after receiving a successful lease out of the `Dhcp_clientv4` module
  and into `Stackv4` (mirage/mirage-tcpip#87)

### v2.0.2 (2014-12-01)

* Add IPv4 multicast to MAC address mapping in IPv4 output processing
  (mirage/mirage-tcpip#81 from Luke Dunstan).
* Improve formatting of DHCP console logging, including printing out options
  (mirage/mirage-tcpip#83).
* Build with -mno-red-zone on x86_64 to avoid stack corruption on Xen (mirage/mirage-tcpip#80).

### v2.0.1 (2014-11-04)

* Fixed race condition in the signalling between the rx/tx threads under load.
* Experimentally switch to immediate ACKs in TCPv4 by default instead of delayed ones.

### v2.0.0 (2014-11-02)

* Moved 1s complement checksum C code here from mirage-platform.
* Depend on `Console_unix` and `Console_xen` instead of `Console`.
* [socket] Do not return an `Eof` when writing 0-length buffer (mirage/mirage-tcpip#76).
* [socket] Accept callbacks now run in async threads instead of being serialised
  (mirage/mirage-tcpip#75).

### v1.1.6 (2014-07-20)

* Quieten down the stack logging rate by not announcing IPv6 packet discards.
* Raise exception `Bad_option` for unparseable or invalid TCPv4 options (mirage/mirage-tcpip#57).
* Fix linking error with module `Tcp_checksum` by lifting it into top library
  (mirage/mirage-tcpip#60).
* Add `opam` file to permit easier local pinning, and fix Travis to use this.

### v1.1.5 (2014-06-18)

* Ensure that DHCP completes before the application is started, so that
  unikernels that establish outgoing connections can do so without a race.
  (fix from Mindy Preston in mirage/mirage-tcpip#53, followup in mirage/mirage-tcpip#55)
* Add `echo`, `chargen` and `discard` services into the `examples/`
  directory. (from Mindy Preston in mirage/mirage-tcpip#52).

### v1.1.4 (2014-06-03)

* [tcp] Fully process the last `ACK` in a 3-way handshake for server connections.
  This ensures that a `FIN` is correctly transmitted upon application-initiated
  connection close. (fix from Mindy Preston in mirage/mirage-tcpip#51).

### v1.1.3 (2014-03-01)

* Expose IPV4 through the STACKV4 interface.

### v1.1.2 (2014-03-27)

* Fix DHCP variable length option parsing for MTU responses, which
  in turns improves robustness on Amazon EC2 (fix from @yomimono
  via mirage/mirage-tcpip#48)

### v1.1.1 (2014-02-21)

* Catch and ignore top-level socket exceptions (mirage/mirage-tcpip#219).
* Set `SO_REUSEADDR` on listening sockets for Unix (mirage/mirage-tcpip#218).
* Adapt the Stack interfaces to the v1.1.1 mirage-types interface
  (see mirage/mirage#226 for details).

### v1.1.0 (2014-02-03)

* Rewrite of the library as a set of functors that parameterize the
  stack across the `V1_LWT` module types from Mirage 1.1.x.  This removes
  the need to compile separate Xen and Unix versions of the stack.

### v0.9.5 (2013-12-08)

* Build for either Xen or Unix, depending on the value of the `OS` envvar.
* Shift to the `mirage-types` 0.5.0+ interfaces, which breaks the
  socket backend (temporarily).
* Port the direct stack to the new interfaces.
* Add Travis CI scripts.

### v0.9.4 (2013-08-09)

* Use the `Ipaddr` external library and remove the Homebrew
  equivalents in `Nettypes`.

### v0.9.3 (2013-07-18)

* Changes in module Manager: Removed some functions from the `.mli
  (plug/unplug) and added some modifications in the way the Manager
  interacts with the underlying module Netif. The Netif.create function
  does not take a callback anymore.

### v0.9.2 (2013-07-09)

* Improve TCP state machine for connection teardown.
* Limit fragment number to 8, and coalesce buffers if it goes higher.
* Adapt to mirage-platform-0.9.2 API changes.

### v0.9.1 (2013-06-12)

* Depend on mirage-platform-0.9.1 direct tuntap interfaces.
* Version bump to catch up with mirage-platform.

### v0.5.2 (2013-02-08)

* Encourage scatter-gather I/O all the time, rather than playing tricks
  with packet header buffers. This simplifies the output path considerably
  and cuts minor heap allocations down.
* Install the packed `cmx` along with the `cmxa` to ensure that the
  compiler can do cross-module optimization (this is not a fatal error,
  but will impact performance if the `cmx` file is not present).

### v0.5.1 (2012-12-20)

* Update socket stack to use Cstruct 0.6.0 API

### v0.5.0 (2012-12-20)

* Update Cstruct API to 0.6.0
* [tcp] write now blocks if the write buffer and write window are full

### v0.4.1 (2012-12-14)

* Add iperf self-test that creates two VIFs and transmits across
  them. This is a useful local test which stresses the bridge
  code using just one VM.
* Add support for attaching existing devices when initialising the
  network manager, via an optional `attached` parameter.
* Constrain TCP connect to be a `unit Lwt.t` instead of a polymorphic
  return value.
* Expose IPv4 netmask function.
* Reduce ARP verbosity to the console.
* Fix TCP fast recovery to wait until all in-flight packets are
  acked, rather then exiting early.

### v0.4.0 (2012-12-11)

* Require OCaml-4.00.0 or higher, and add relevant build fixes
  to deal with module packing.

### v0.3.1 (2012-12-10)

* Fix the DHCP client marshalling for IPv4 addresses.
* Expose the interface MAC address in the Manager signature.
* Tweak TCP ISN calculation to be more friendly on a 32-bit host.
* Add Manager.create ?devs to control the number of Netif devices
  constructed by default.
* Add Ethif.set/disable_promiscuous to permit directly tapping
  a network interface.

### v0.3.0 (2012-09-04)

* Initial public release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants