TCP handshaking fails - what's wrong with the server's reply? -
i'm building server enc28j60 chip , pic18f4620. chip connected pc via ethernet. currently, i'm trying set tcp connection on i'll build http connection later on. have never worked tcp before.
i'm implementing tcp on embedded device only, not on pc.
after needed arp requests , replies sent, open browser, type ip address of chip in , press enter. in wireshark, see tcp request1 syn flag made. believe syn flag indicates new handshake initiation, that's good, isn't it?
my chip's reply1 has syn , ack flag enabled. what understood, correct way reply syn-flagged request. acknowledgement number chip sends correct. now, chip should reply ack flag enabled, according same reference.
however, process seems start over: pc sends exact same packet1 first packet, 'identification' has changed. programmed chip stop replying when keeps getting syn requests on same socket, end of transmission, in browser read server can't reached.
this connection made on 4 sockets @ same time, same result.
as i'm using pc client (and there's nothing wrong ethernet port / driver), problem must server , second packet.
what's wrong second packet? wireshark doesn't mark incorrect, client doesn't send ack.
1: here packets wireshark picks up:
client: 3085 > 80 [syn] seq=0 win=65535 len=0 mss=1460 ws=8 tsval=0 tsecr=0 sack_perm=1 0000 00 13 d4 c6 53 16 00 1a a0 03 c7 21 08 00 45 00 ....s... ...!..e. 0010 00 40 de 48 40 00 80 06 9a e1 c0 a8 00 01 c0 a8 .@.h@... ........ 0020 00 3c 0c 0d 00 50 88 ab 7e 18 00 00 00 00 b0 02 .<...p.. ~....... 0030 ff ff a1 4f 00 00 02 04 05 b4 01 03 03 03 01 01 ...o.... ........ 0040 08 0a 00 00 00 00 00 00 00 00 01 01 04 02 ........ ...... server: 80 > 3085 [syn, ack] seq=0 ack=1 win=65535 len=0 mss=1460 ws=8 0000 00 1a a0 03 c7 21 00 13 d4 c6 53 16 08 00 45 00 .....!.. ..s...e. 0010 00 30 88 10 40 00 7f 06 f2 29 c0 a8 00 3c c0 a8 .0..@... .)...<.. 0020 00 01 00 50 0c 0d 00 00 00 01 88 ab 7e 19 70 12 ...p.... ....~.p. 0030 ff ff ef 77 00 00 02 04 05 b4 01 03 03 03 ...w.... ...... client: 3085 > 80 [syn] seq=0 win=65535 len=0 mss=1460 ws=8 tsval=0 tsecr=0 sack_perm=1 0000 00 13 d4 c6 53 16 00 1a a0 03 c7 21 08 00 45 00 ....s... ...!..e. 0010 00 40 de 6f 40 00 80 06 9a ba c0 a8 00 01 c0 a8 .@.o@... ........ 0020 00 3c 0c 0d 00 50 88 ab 7e 18 00 00 00 00 b0 02 .<...p.. ~....... 0030 ff ff a1 4f 00 00 02 04 05 b4 01 03 03 03 01 01 ...o.... ........ 0040 08 0a 00 00 00 00 00 00 00 00 01 01 04 02 ........ ...... all happens 3 other client's source ports.
for comparison, made request google.com , here tcp stream:
client: 49562 > 80 [syn] seq=0 win=8192 len=0 mss=1460 ws=256 sack_perm=1 0000 00 1a a0 03 c7 21 08 9e 01 30 ee 69 08 00 45 00 .....!.. .0.i..e. 0010 00 34 32 3f 40 00 80 06 38 ab c0 a8 00 3c 4a 7d .42?@... 8....<j} 0020 84 78 c1 9a 00 50 74 b8 31 9c 00 00 00 00 80 02 .x...pt. 1....... 0030 20 00 56 f7 00 00 02 04 05 b4 01 03 03 08 01 01 .v..... ........ 0040 04 02 .. server: 80 > 49562 [syn, ack] seq=0 ack=1 win=62920 len=0 mss=1430 sack_perm=1 ws=64 0000 08 9e 01 30 ee 69 00 1a a0 03 c7 21 08 00 45 00 ...0.i.. ...!..e. 0010 00 34 9e e3 00 00 2e 06 5e 07 4a 7d 84 78 c0 a8 .4...... ^.j}.x.. 0020 00 3c 00 50 c1 9a f4 5e 12 bc 74 b8 31 9d 80 12 .<.p...^ ..t.1... 0030 f5 c8 7a 22 00 00 02 04 05 96 01 01 04 02 01 03 ..z".... ........ 0040 03 06 .. client: 49562 > 80 [ack] seq=1 ack=1 win=65536 len=0 0000 00 1a a0 03 c7 21 08 9e 01 30 ee 69 08 00 45 00 .....!.. .0.i..e. 0010 00 28 32 49 40 00 80 06 38 ad c0 a8 00 3c 4a 7d .(2i@... 8....<j} 0020 84 78 c1 9a 00 50 74 b8 31 9d f4 5e 12 bd 50 10 .x...pt. 1..^..p. 0030 01 00 af 9e 00 00 00 00 00 00 00 00 ........ ....
i used text2pcap load capture wireshark.
if enable tcp checksum validation , absolute sequence numbers, see bad tcp checksum in chip’s syn-ack packet.
also, chip starting @ absolute sequence number 0 weak.
Comments
Post a Comment