mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +00:00
tcp: fix receival of resets
This commit is contained in:
@@ -908,13 +908,18 @@ __attribute__((noreturn)) static void tcp_worker() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seqinrange(tcpheader->seq, tcpheader->seq + 1, tcb->rcvnext, tcb->rcvnext + tcb->rcvwindow) && (tcpheader->control & CONTROL_RST) && tcb->state != TCB_STATE_LISTEN) {
|
// resets have different requirements based on the state of the connection.
|
||||||
|
// if the state is not *syn sent*, it must fall within the window to bee accepted
|
||||||
|
if ((tcpheader->control & CONTROL_RST) && tcb->state != TCB_STATE_LISTEN && (
|
||||||
|
(tcb->state == TCB_STATE_SYNSENT) ||
|
||||||
|
(seqinrange(tcpheader->seq, tcpheader->seq + 1, tcb->rcvnext, tcb->rcvnext + tcb->rcvwindow)))) {
|
||||||
tcp_reset(tcb);
|
tcp_reset(tcb);
|
||||||
MUTEX_RELEASE(&tcb->mutex);
|
MUTEX_RELEASE(&tcb->mutex);
|
||||||
TCB_RELEASE(tcb);
|
TCB_RELEASE(tcb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (tcb->state) {
|
switch (tcb->state) {
|
||||||
case TCB_STATE_LISTEN: {
|
case TCB_STATE_LISTEN: {
|
||||||
// (listening socket only)
|
// (listening socket only)
|
||||||
|
|||||||
Reference in New Issue
Block a user