lwip/0096-tcp_send_fin-add-the-fin-to-the-last-unsent-segment.patch
yangchen c6f2b3e5c9 tcp_send_fin: add the fin to the last unsent segment
(cherry picked from commit 39e67d34f8ccdea8ad221f0c0af11787b4858687)
2023-12-27 17:26:41 +08:00

28 lines
949 B
Diff

From c91f1d05c65526fe250cf5e5c32f9038721bc1d5 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 25 Dec 2023 12:39:56 +0800
Subject: [PATCH] tcp_send_fin: add the fin to the last unsent segment
---
src/core/tcp_out.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 137e3cf..e5c407e 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1195,8 +1195,8 @@ tcp_send_fin(struct tcp_pcb *pcb)
LWIP_ASSERT("tcp_send_fin: invalid pcb", pcb != NULL);
/* first, try to add the fin to the last unsent segment */
- if (pcb->unsent != NULL) {
- struct tcp_seg *last_unsent = pcb->unsent;
+ if (pcb->last_unsent != NULL) {
+ struct tcp_seg *last_unsent = pcb->last_unsent;
if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) {
/* no SYN/FIN/RST flag in the header, we can add the FIN flag */
--
2.33.0