Josef Moellers
2013-03-10 17:47:12 UTC
Hi,
I'm trying to teach a small AtMega32 with an ENC28J60 TCP/IP, to use the
setup as a COM-to-LAN adapter.
I have successfully implemented (rudimentary versions) of DHCP, ARP and
ICMP and have now started to process TCP packets.
Note: I *do* know there's ethersex and friends out there, but I get
greater satisfaction when "suddenly" the ARP-table of my notebook shows
the data of my AtMega ;-) Maybe once this is running, I'll rebase on
ethersex, but, at this time, I'm having lots of fun.
As a first step, I try to just refuse a connection. I process the
request, extract source addresses (MAC and IP) and source and
destination ports and the packet's sequence number and then build a
reply with the correct acknowledgement number (sequence number plus 1)
and RST and ACK set. Wireshark says it's OK.
However, when I telnet to the AtMega, telnet doesn't stop trying to
connect while when I telnet to another Linux box, telnet immediately
gives up after the first ACK|RST and tells me
"telnet: Unable to connect to remote host: Connection refused"
When I compare the two RST packets, I can see no obvious difference,
other than
a) trailing ff's (Linux) vs. trailing 00's (AtMega)
b) an IP "Identification" field of 0 (Linux) vs. 5 (AtMega)
What makes telnet give up on the Linux box and not give up on the AtMega?
Thanks,
Josef
I'm trying to teach a small AtMega32 with an ENC28J60 TCP/IP, to use the
setup as a COM-to-LAN adapter.
I have successfully implemented (rudimentary versions) of DHCP, ARP and
ICMP and have now started to process TCP packets.
Note: I *do* know there's ethersex and friends out there, but I get
greater satisfaction when "suddenly" the ARP-table of my notebook shows
the data of my AtMega ;-) Maybe once this is running, I'll rebase on
ethersex, but, at this time, I'm having lots of fun.
As a first step, I try to just refuse a connection. I process the
request, extract source addresses (MAC and IP) and source and
destination ports and the packet's sequence number and then build a
reply with the correct acknowledgement number (sequence number plus 1)
and RST and ACK set. Wireshark says it's OK.
However, when I telnet to the AtMega, telnet doesn't stop trying to
connect while when I telnet to another Linux box, telnet immediately
gives up after the first ACK|RST and tells me
"telnet: Unable to connect to remote host: Connection refused"
When I compare the two RST packets, I can see no obvious difference,
other than
a) trailing ff's (Linux) vs. trailing 00's (AtMega)
b) an IP "Identification" field of 0 (Linux) vs. 5 (AtMega)
What makes telnet give up on the Linux box and not give up on the AtMega?
Thanks,
Josef