Skip to content

Commit

Permalink
tcp_in: Flag the pcb as closing if TCP_EVENT_CLOSED refused
Browse files Browse the repository at this point in the history
If the packet contained FIN flag, we post a TCP_EVENT_CLOSE with null pbuf,
which could get lost if the underlying platform implementation of sys_mbox_(try)post()
returns ERR_MEM (i.e. won't fit into the recv mailbox).
Loosing this event causes trouble since the FIN initiator gets ACK'ed and
assumes the connection has closed, but the TCP state machine is stuck in its active state.
Fixed by flagging the pcb as closing if the ERR_MEM returned.

Picked from d050c331
Patch posted https://savannah.nongnu.org/patch/?10013
Ref IDF-4847
  • Loading branch information
david-cermak committed Aug 16, 2022
1 parent 1343f47 commit 223101f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/tcp_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
TCP_EVENT_CLOSED(pcb, err);
if (err == ERR_ABRT) {
goto aborted;
} else if (err == ERR_MEM) {
tcp_set_flags(pcb, TF_CLOSEPEND);
}
}
}
Expand Down

0 comments on commit 223101f

Please sign in to comment.