Wierdness of WSASendTo()??

Mark Paulus mpaulus78@earthlink.net
Thu Apr 11 07:37:00 GMT 2002


I am attempting to port MTR (Matt's TraceRoute), and after getting
the minires library, I can get it all to compile and it seems to run, except
for one small problem.  I never see any output.  So, after further
analysis, and also using iptraf & tcpdump on my linux box, I have this
to report:

MTR believes it's sending out a good ICMP packet of 64 bytes (0x40).
cygwin_sendto() also thinks it's sending out 64 bytes (as reported by strace).

However, tcpdump on my linux box is receiving 84 bytes.  

What it looks like to me is that somehow WSASendTo is re-formatting 
the packet that is going out.  But, this
turns it into an invalid packet, and causes a "network unreachable" error
on the linux box, and the response never comes back.

Has anyone seen this behaviour before??

Here is a synopsis of the data traffic:

What cygwin/MTR creates/sends out:

0x0000   4500 0040 0000 0000 0601 f40d 0000 0000        E..@............
0x0010   c0a8 0008 0800 1ef7 d408 0500 0000 0000         ................
0x0020   0000 0000 0000 0000 0000 0000 0000 0000        ................
0x0030   0000 0000 0000 0000 0000 0000 0000 0000        ................

Strace Result:

  285 10960006 [main] mtr 1944 cygwin_sendto: 64 = sendto (3, 22ED84, 40, 0)
 showing a 64 byte packet going out to WSASendTo()

Here is what my linux box/tcpdump sees:

20:33:36.661467 gairloch.recluce.org > seti2.recluce.org:  ip-proto-255 64
0x0000   4500 0054 6fa8 0000 80ff 48a8 c0a8 0002        E..To.....H.....
0x0010   c0a8 0008 4500 0040 0000 0000 0601 f40d        ....E..@........
0x0020   0000 0000 c0a8 0008 0800 1ef7 d408 0500        ................
0x0030   0000 0000 0000 0000 0000 0000 0000 0000        ................
0x0040   0000 0000 0000 0000 0000 0000 0000 0000        ................
0x0050   0000                                           ..

As can be seen above, the original packet is buried within the new packet, but
an additional 20 byte header has been prepended to this packet, which skews 
everything and invalidates the packet.

Here is how my linux box responds:

20:33:36.661506 seti2.recluce.org > gairloch.recluce.org: icmp: seti2.recluce.or
g protocol 255 unreachable [tos 0xc0]
0x0000   45c0 0070 5207 0000 ff01 e76a c0a8 0008        E..pR......j....
0x0010   c0a8 0002 0302 fcfd 0000 0000 4500 0054        ............E..T
0x0020   6fa8 0000 80ff 48a8 c0a8 0002 c0a8 0008        o.....H.........
0x0030   4500 0040 0000 0000 0601 f40d 0000 0000        E..@............
0x0040   c0a8 0008 0800 1ef7 d408 0500 0000 0000        ................
0x0050   0000                                           ..




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list