Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rfc9293 WIP #202

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1113751
tcp: Remove redundant :ack-p t
ebrasca Feb 19, 2024
3b0fe68
tcp: Update the protocol specification link to rfc9293
ebrasca Feb 25, 2024
ef54dfb
tcp: Do nothing to finish segments when in state :closed or :listen
ebrasca Feb 25, 2024
c140f05
tcp: Fix errata
ebrasca Feb 25, 2024
d2c3874
tcp: Refactor acceptable-segment-p
ebrasca Feb 25, 2024
8c0a1c1
tcp: Add tcp4-send-ack
ebrasca Mar 20, 2024
e8b7f35
tcp: Add challenge-ack
ebrasca Mar 20, 2024
0e6ca64
tcp: Check the sequence numbers before accepting RST in :syn-sent
ebrasca Mar 20, 2024
bce312d
tcp: Send RST when package is from old connection in :syn-sent state
ebrasca Mar 20, 2024
fb4e215
tcp: Refactor tcp4-connection-receive :syn-sent state
ebrasca Mar 20, 2024
e91e108
tcp: ACK non RST incoming unacceptable segments
ebrasca Mar 20, 2024
5a6d095
tcp: Check incomming RST segments
ebrasca Mar 20, 2024
53363c9
tcp: Don't abort connection when resiving segment in :syn-received state
ebrasca Mar 20, 2024
cc921f7
tcp: Remove connection from listener when getting SYN in state :syn-r…
ebrasca Mar 20, 2024
d602981
tcp: Challenge any SYN segment when not in :syn-sent state
ebrasca Mar 20, 2024
352172c
tcp: Add :time-wait state
ebrasca Mar 20, 2024
663c799
tcp: Add =<
ebrasca Mar 22, 2024
9688f25
tcp: Deal with wrap around sequence numbers correctly
ebrasca Mar 22, 2024
08e01fb
tcp: Small refactor
ebrasca Mar 22, 2024
f6fa477
tcp: Send RST to segments of old connections in :syn-received state
ebrasca Mar 22, 2024
3278434
tcp: Handle FIN in :syn-received state
ebrasca Mar 22, 2024
180b7b4
tcp: Chenck ACK sequence number in :last-ack state before ending it
ebrasca Mar 22, 2024
3334d79
tcp: Hangle FIN in :last-ack state
ebrasca Mar 22, 2024
0c28348
tcp: Ignore SYN or RST packets without ACK
ebrasca Mar 22, 2024
c9a2b0d
tcp: Allow sending data in half open connection
ebrasca Mar 22, 2024
d4bf137
tcp: Add rfc5961 mitigation
ebrasca Mar 22, 2024
98af636
tcp: Send ACK to segments that acknowledges something not yet sent
ebrasca Mar 22, 2024
bfb920a
tcp: Hangle FIN in :closing state
ebrasca Mar 22, 2024
dd95347
tcp: Hangle FIN in :close-wait state
ebrasca Mar 23, 2024
0d07fa7
tcp: Allow to resive data and control in the same segment
ebrasca Mar 23, 2024
5a15692
tcp: Refactor tcp4-connection-receive :fin-wait-1 state
ebrasca Mar 23, 2024
7cf7956
tcp: Update window size
ebrasca Mar 27, 2024
b365915
arp: Use correct function to get the time
ebrasca Jul 1, 2024
4f2bd69
tcp: Report connection-closing in tcp-send when connetion is closing
ebrasca Jul 1, 2024
c229bc9
tcp: Implemented abort close
ebrasca Jul 1, 2024
24ea270
tcp: Refactor tcp-send
ebrasca Jul 9, 2024
94ebcb6
tcp: Add missing :closed case
ebrasca Jul 9, 2024
dc3eced
tcp: Implemented time-wait timeout
ebrasca Jul 10, 2024
1690e24
tcp: Add :closed case to tcp4-connection-receive
ebrasca Jul 12, 2024
fe6ae64
tcp: Add close for :syn-sent and :syn-received cases
ebrasca Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions net/tcp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,7 @@ Set to a value near 2^32 to test SND sequence number wrapping.")
(when (<= seq (tcp-connection-rcv.nxt connection))
;; Don't check *netmangler-force-local-retransmit* here,
;; or no acks will ever get through.
(tcp4-send-packet connection
(tcp-connection-snd.nxt connection)
(tcp-connection-rcv.nxt connection)
nil)))
(tcp4-send-ack connection)))

(defun tcp-packet-sequence-number (packet start end)
(declare (ignore end))
Expand Down Expand Up @@ -627,10 +624,7 @@ Set to a value near 2^32 to test SND sequence number wrapping.")
(:established
(cond ((not (acceptable-segment-p connection seq data-length))
(when (not (logtest flags +tcp4-flag-rst+))
(tcp4-send-packet connection
(tcp-connection-snd.nxt connection)
(tcp-connection-rcv.nxt connection)
nil)))
(tcp4-send-ack connection)))
((logtest flags +tcp4-flag-rst+)
(setf (tcp-connection-pending-error connection)
(make-condition 'connection-reset
Expand Down Expand Up @@ -714,10 +708,7 @@ Set to a value near 2^32 to test SND sequence number wrapping.")
(cond ((logtest flags +tcp4-flag-fin+)
(setf (tcp-connection-rcv.nxt connection)
(+u32 (tcp-connection-rcv.nxt connection) 1))
(tcp4-send-packet connection
(tcp-connection-snd.nxt connection)
(tcp-connection-rcv.nxt connection)
nil)
(tcp4-send-ack connection)
(if (logtest flags +tcp4-flag-ack+)
;; Remote saw our FIN and closed as well.
(detach-tcp-connection connection)
Expand All @@ -735,10 +726,7 @@ Set to a value near 2^32 to test SND sequence number wrapping.")
;; Remote has sent FIN and waiting for ACK
(setf (tcp-connection-rcv.nxt connection)
(+u32 (tcp-connection-rcv.nxt connection) 1))
(tcp4-send-packet connection
(tcp-connection-snd.nxt connection)
(tcp-connection-rcv.nxt connection)
nil)
(tcp4-send-ack connection)
(detach-tcp-connection connection))
(tcp4-receive-data connection data-length end header-length packet seq start)))
(:closing
Expand Down Expand Up @@ -779,6 +767,12 @@ Set to a value near 2^32 to test SND sequence number wrapping.")
(when errors-escape
(error c))))))

(defun tcp4-send-ack (connection)
fitzsim marked this conversation as resolved.
Show resolved Hide resolved
(tcp4-send-packet connection
(tcp-connection-snd.nxt connection)
(tcp-connection-rcv.nxt connection)
nil))

(defun compute-ip-pseudo-header-partial-checksum (src-ip dst-ip protocol length)
(+ (logand src-ip #xFFFF)
(logand (ash src-ip -16) #xFFFF)
Expand Down