FreeBSD implements TCP according to spec, right?

Hi all,
Me again...

I am implementing a very light weight tcp/IP layer on a microcontroller. The micro has a RF tranceiver that communicates with another rf transceiver (bridge) connected to a PC running freebsd.

I am using the command fetch to make an http request to the micro in order to get a simple web page.

At the micro, it arrives the SYN message and it replys with the SYN/ACK to the freebsb. Next free bsd sends a RST (reset) instead of a ack, for all my attempts.

Why does free bsd doesnt send the ack to finish the 3way handshake of the TCP protocol?

Using tcpdump I can see this:

PC sends, on the 16 bit flag field this:
A002 - first 6 bits define the flags=000010 (SYN) (OK!)

Micro replys with this:
6012 - 00010010 (ACK|SYN) (OK!)

PC then sends this:
5004 - 00000100 (RST) (???)

Very strange for me...
Any help?

Thanks a lot


(Can I put some debug messages on the tcp implementation and compile it again? Any advices on doing that?)
I would guess that you are missing something that the FreeBSD machine is expecting so it sends the RST. Implementing TCP isn't as simple as just following a spec, unfortunately. There are lots of variables with all the different combinations of Operating Systems and Routers and their implementations that might be close to the spec but not 100% exactly on spec. I would google around for tools to help you trace what is happening, tools like wireshark or tcpdump would be a good starting point.
Thank you,

There is no routings. Just a pc and serial port...

Yes... This is very unexpectable.

Does TCP/IP stack of the freebsd makes any log?

You can use tcpdump to get a dump of all TCP packets. That should at least show you what FreeBSD thinks it's sending and receiving.
Yes, I am using tcpdump...
I can see the SYN|ACK answer arriving at pc but pc sends a RST next :-(

Here is all the TCPdump output:

After issuing the lynx command on PC, tcpdump shows this:

4500 003c 0014 4000 4006 b754 c0a8 0101
C0a8 0102 d07f 0050 6e7e 446d 0000 0000
A002 ffff 753f 0000 0204 0200 0103 0303
0402 080a 002e cf3b 0000 0000

Then target board answers with this:

4500 002c 0001 0000 4006 f777 c0a8 0102
c0a8 0101 0050 007f 001e fdd1 007e 006e
6012 0200 1506 0000 0204 03c6

Then PC answers with:

4500 0028 0015 4000 4006 b767 c0a8 0101
C0a8 0102 007f 0050 007e 006e 0000 0000
5004 0000 2ad2 0000

Thanks a lot…