tcp on uC, 3way handshake problem

hello,

i tried to implement tcp on my uC, starting with the handshake to establish the connection (passive open only). And here is my problem: Computer sends the SYN packet, uC replies with SYN,ACK packet, but the computer doesn't answer with an ACK packet. This sounds to me, as if my reply packet is wrong. Possibly my missing checksums (in ip, and tcp layer) are the reason, but i read, checksum 0x0000 would be ok (at least for beta testing). I will post at the end some lines of the ethereal dump.

Does anybody have an idea what could be wrong in my packet (the rfc seems not require special options for connecting...), and what (free) tools (windows) can help me (maybe analysing and finding mistakes and not just showing the packet) to find my fails.

thanks heiko

ethereal dump:

192.168.101.10 -> 192.168.101.14 port 1111 -> 988 [SYN] seq=5633985 Ack=0 win=8192 Len=0, some options are set 192.168.101.14 -> 192.168.101.10 port 988 -> 1111 [SYN,ACK] seq=4074241 Ack=5633986 win=8192 Len=0, options are all 0x00
Reply to
heiko_greiner
Loading thread data ...

Heiko,

The checksum is probably the culprit.

For TCP packets, the checksum must be calculated. It isn't optional.

A UDP packet can turn off checksums by setting the checksum field to 0. In fact, if the computed checksum of an outgoing packet is 0, then the UDP layer must set the value to 0xFFFF if it wants the receiver to compute the checksum.

Joe

Reply to
Joe Hagen

Heiko,

Also don't forget about the IP checksum field.

This is a separate field from the UDP or TCP checksum fields, and is computed on just the IP header.

Joe

Reply to
Joe Hagen

Heiko, you need checksums on both the IP header and the TCP with pseudo-header. If either checksum is not correct, the peer is supposed to drop the packet without any notice to the sender ('silently discarded').

Ethereal is your friend here - adjust you code till Ethereal is happy with both checksums.

IMHO, the checksum handling in the IP protocol stack is a sorry mess - there are things checked many times and intertwined on different protocol layers.

Been there - done that.

Tauno Voipio tauno voipio @ iki fi

Reply to
Tauno Voipio

hello,

thanks to all for giving advices, now i "decided" to implement the checksum.

heiko

Reply to
heiko_greiner

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.