[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] More troubles with tcp on ARM



On 10 April 2015 at 05:29, Magnus Therning <magnus@xxxxxxxxxxxx> wrote:
> On Thu, Apr 09, 2015 at 10:18:53PM +0200, Magnus Therning wrote:
> [...]
>
>>
>> It works fine in Unix mode, both on x86 and on my cubietruck board.
>> When built in Xen mode though it doesn't work as well.
>>
>> When run in Unix mode I see the expected behaviour:
>>
>>   shell                                         my server console
>>   -----                                         -----------------
>>   % echo hello | ncat -4 -u localhost 18081 ->  udp: 127.0.0.1:46507
>>                                                  udp: 6 - hello
>>
>>   % echo hello | ncat -4 localhost 18080    ->  tcp: 127.0.0.1:59888
>>   hello                                          6 - hello
>>
>>   % echo foobar | ncat -4 localhost 18080   ->  tcp: 127.0.0.1:59888
>>   foobar                                         6 - foobar
>
> That last line should of course read
>
>   foobar                                         7 - foobar
>
> That was caused by a copy-paste mistake of mine.
>
>> When running the server in a VM on ARM I see the same behaviour for
>> UDP, but for TCP it changes.
>>
>>   shell                                         my server console
>>   -----                                         -----------------
>>   % echo hello | ncat -4 -u localhost 18081 ->  udp: 127.0.0.1:46507
>>                                                  udp: 6 - hello
>>
>>   % echo hello | ncat -4 localhost 18080    ->  tcp: 127.0.0.1:59888
>>                                                  6 -
>>                                                  6 -
>
> And here there are even more copy-paste mistakes.  I must have been
> tired yesterday.  Just disregard the `localhost` and `127.0.0.1`, that
> should of course be the IPs of my cubietruck and my PC, respectively.
>
> I did a little bit more testing of this just now, and found something
> surprising.  This is against a VM on ARM:
>
> ~~~
> % echo thisisalongerstring | ncat -4 192.168.0.33 18080
> alongerstring
>
> ->
>
> tcp: 192.168.0.11:48731
>  6 -
>  14 - alongerstring
> ~~~
>
> and
>
> ~~~
> % echo thisisalongerstringandthisislongerstill | ncat -4 192.168.0.33 18080
> alongerstringandthisislongerstill
>
> ->
>
> tcp: 192.168.0.11:48732
>  6 -
>  34 - alongerstringandthisislongerstill
> ~~~
>
> and if I send a string that is shorter than 6 characters (I'm guessing
> including the trailing \r\n), then `ncat` hangs and on the ARM I only
> see a single line of "length - content":
>
> ~~~
> tcp: 192.168.0.11:48766
>  6 -
> ~~~
>
> I do wonder where those initial 6 characters go...

Interesting! Probably the easiest thing now is to git clone
mirage-net-xen and/or mirage-tcpip and add some code to dump out the
buffer at various points:

https://github.com/mirage/mirage-net-xen/
https://github.com/mirage/mirage-tcpip/

(use e.g. "opam pin add tcpip mirage-tcpip" to rebuild with your debug
version, then make clean and rebuild your unikernel)

I think this is the first point where we learn that Xen has placed the
new packet in our buffer:

https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L387

A few Cstruct.hexdump calls along the way should let you see where it
first differs from the wireshare capture (assuming that looks OK).


-- 
Dr Thomas Leonard        http://0install.net/
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.