• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From c91f1d05c65526fe250cf5e5c32f9038721bc1d5 Mon Sep 17 00:00:00 2001
2From: yangchen <yangchen145@huawei.com>
3Date: Mon, 25 Dec 2023 12:39:56 +0800
4Subject: [PATCH] tcp_send_fin: add the fin to the last unsent segment
5
6---
7 src/core/tcp_out.c | 4 ++--
8 1 file changed, 2 insertions(+), 2 deletions(-)
9
10diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
11index 137e3cf..e5c407e 100644
12--- a/src/core/tcp_out.c
13+++ b/src/core/tcp_out.c
14@@ -1195,8 +1195,8 @@ tcp_send_fin(struct tcp_pcb *pcb)
15   LWIP_ASSERT("tcp_send_fin: invalid pcb", pcb != NULL);
16
17   /* first, try to add the fin to the last unsent segment */
18-  if (pcb->unsent != NULL) {
19-    struct tcp_seg *last_unsent = pcb->unsent;
20+  if (pcb->last_unsent != NULL) {
21+    struct tcp_seg *last_unsent = pcb->last_unsent;
22
23     if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) {
24       /* no SYN/FIN/RST flag in the header, we can add the FIN flag */
25--
262.33.0
27
28