mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-09-07 14:54:28 +00:00
Fixed sequence number of initial TCP ACK packet on tcp_connect.
So far the sequence number for the first packet after the initial SYN packet was calculated directly before returning from tcp_connect. This is however far to late as the ACK packet to be send as response for the SYN,ACK packet sent by the server already needs that sequence number. Therefore it is now calculated right after a successful reception of the SYN,ACK packet is detected.
This commit is contained in:
parent
b9cad0b2ef
commit
8d6b28eee5
31
ip65/tcp.s
31
ip65/tcp.s
@ -185,7 +185,20 @@ tcp_listen:
|
||||
cmp tcp_state
|
||||
beq @listen_loop
|
||||
|
||||
jmp tcp_connection_established
|
||||
tcp_connection_established:
|
||||
; inc the sequence number to cover the SYN we have sent
|
||||
ldax #tcp_connect_sequence_number
|
||||
stax acc32
|
||||
ldax #$01
|
||||
jsr add_16_32
|
||||
|
||||
set_expected_ack:
|
||||
; set the expected ack number with current seq number
|
||||
ldx #3
|
||||
: lda tcp_connect_sequence_number,x
|
||||
sta tcp_connect_expected_ack_number,x
|
||||
dex
|
||||
bpl :-
|
||||
rts
|
||||
|
||||
; make outbound tcp connection
|
||||
@ -278,20 +291,6 @@ tcp_connect:
|
||||
sec ; if we got here, then the other side sent a RST or FIN, so signal an error to the caller
|
||||
rts
|
||||
@was_accepted:
|
||||
tcp_connection_established:
|
||||
; inc the sequence number to cover the SYN we have sent
|
||||
ldax #tcp_connect_sequence_number
|
||||
stax acc32
|
||||
ldax #$01
|
||||
jsr add_16_32
|
||||
|
||||
set_expected_ack:
|
||||
; set the expected ack number with current seq number
|
||||
ldx #3
|
||||
: lda tcp_connect_sequence_number,x
|
||||
sta tcp_connect_expected_ack_number,x
|
||||
dex
|
||||
bpl :-
|
||||
clc
|
||||
rts
|
||||
|
||||
@ -726,6 +725,8 @@ tcp_process:
|
||||
ldax #$0001
|
||||
jsr add_16_32 ; increment the ACK counter by 1, for the SYN we just received
|
||||
|
||||
jsr tcp_connection_established
|
||||
|
||||
lda #tcp_cxn_state_established
|
||||
sta tcp_state
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user