mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +00:00
fixed bug #35435: No pcb state check before adding it to time-wait queue while closing
This commit is contained in:
parent
4d71f7270b
commit
63dbd8faed
@ -62,6 +62,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2012-02-11: Simon Goldschmidt
|
||||||
|
* tcp.c: fixed bug #35435: No pcb state check before adding it to time-wait
|
||||||
|
queue while closing
|
||||||
|
|
||||||
2012-01-22: Simon Goldschmidt
|
2012-01-22: Simon Goldschmidt
|
||||||
* tcp.c, tcp_in.c: fixed bug #35305: pcb may be freed too early on shutdown(WR)
|
* tcp.c, tcp_in.c: fixed bug #35305: pcb may be freed too early on shutdown(WR)
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
|
|||||||
{
|
{
|
||||||
err_t err;
|
err_t err;
|
||||||
|
|
||||||
if (rst_on_unacked_data && (pcb->state != LISTEN)) {
|
if (rst_on_unacked_data && ((pcb->state == ESTABLISHED) || (pcb->state == CLOSE_WAIT))) {
|
||||||
if ((pcb->refused_data != NULL) || (pcb->rcv_wnd != TCP_WND)) {
|
if ((pcb->refused_data != NULL) || (pcb->rcv_wnd != TCP_WND)) {
|
||||||
/* Not all data received by application, send RST to tell the remote
|
/* Not all data received by application, send RST to tell the remote
|
||||||
side about this. */
|
side about this. */
|
||||||
@ -183,14 +183,15 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
|
|||||||
pcb->local_port, pcb->remote_port);
|
pcb->local_port, pcb->remote_port);
|
||||||
|
|
||||||
tcp_pcb_purge(pcb);
|
tcp_pcb_purge(pcb);
|
||||||
|
|
||||||
/* TODO: to which state do we move now? */
|
|
||||||
|
|
||||||
/* move to TIME_WAIT since we close actively */
|
|
||||||
TCP_RMV_ACTIVE(pcb);
|
TCP_RMV_ACTIVE(pcb);
|
||||||
pcb->state = TIME_WAIT;
|
if (pcb->state == ESTABLISHED) {
|
||||||
TCP_REG(&tcp_tw_pcbs, pcb);
|
/* move to TIME_WAIT since we close actively */
|
||||||
|
pcb->state = TIME_WAIT;
|
||||||
|
TCP_REG(&tcp_tw_pcbs, pcb);
|
||||||
|
} else {
|
||||||
|
/* CLOSE_WAIT: deallocate the pcb since we already sent a RST for it */
|
||||||
|
memp_free(MEMP_TCP_PCB, pcb);
|
||||||
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user