Revert "tcp_abandon: no need to buffer pcb->local_port"

This reverts commit 1570dd8ad1.

Buffering pcb->local_port is needed because TCP_PCB_REMOVE_ACTIVE()
sets it to 0 via tcp_pcb_remove() (comment: "reset the local port
to prevent the pcb from being 'bound'").

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2018-10-12 22:13:28 +02:00
parent 1bba969a4a
commit 426a6004bf

View File

@ -583,6 +583,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
tcp_free(pcb);
} else {
int send_rst = 0;
u16_t local_port = 0;
enum tcp_state last_state;
seqno = pcb->snd_nxt;
ackno = pcb->rcv_nxt;
@ -597,6 +598,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
}
} else {
send_rst = reset;
local_port = pcb->local_port;
TCP_PCB_REMOVE_ACTIVE(pcb);
}
if (pcb->unacked != NULL) {
@ -613,7 +615,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
tcp_backlog_accepted(pcb);
if (send_rst) {
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n"));
tcp_rst(pcb, seqno, ackno, &pcb->local_ip, &pcb->remote_ip, pcb->local_port, pcb->remote_port);
tcp_rst(pcb, seqno, ackno, &pcb->local_ip, &pcb->remote_ip, local_port, pcb->remote_port);
}
last_state = pcb->state;
tcp_free(pcb);