notify app that sock state changes to CLOSE_WAIT

(cherry picked from commit ff39d7770987a85c2201340c64f4388b9cc30f1f)
This commit is contained in:
jiangheng 2022-03-15 19:58:44 +08:00 committed by openeuler-sync-bot
parent fac87884fd
commit 1307e9ac9b
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From 05159c41efdc2f07ddbe3520330faf2675baa3d6 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Tue, 15 Mar 2022 20:10:07 +0800
Subject: [PATCH] notify app that sock changes to CLOSE_WAAIT
---
src/core/tcp_in.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 1652b86..0d3a2f1 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -58,6 +58,9 @@
#if LWIP_ND6_TCP_REACHABILITY_HINTS
#include "lwip/nd6.h"
#endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */
+#if USE_LIBOS
+#include "lwip/api.h"
+#endif
#include <string.h>
@@ -1032,6 +1035,9 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) {
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
+#if USE_LIBOS
+ API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
+#endif
}
} else {
/* incorrect ACK number, send RST */
@@ -1050,6 +1056,9 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) { /* passive close */
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
+#if USE_LIBOS
+ API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
+#endif
}
break;
case FIN_WAIT_1:
@@ -1676,6 +1685,9 @@ tcp_receive(struct tcp_pcb *pcb)
recv_flags |= TF_GOT_FIN;
if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
pcb->state = CLOSE_WAIT;
+#if USE_LIBOS
+ API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
+#endif
}
}
--
1.8.3.1

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 8
Release: 9
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.tar.gz
@ -30,6 +30,7 @@ Patch9017: 0018-exec-gazelle_init_sock-before-read-event.patch
Patch9018: 0019-gazelle-reduce-copy-in-send.patch
Patch9019: 0020-remove-chose_dlsym_handle-function-set-handle-to-RTL.patch
Patch9020: 0021-refactor-event-if-ring-is-full-the-node-is-added-to-.patch
Patch9021: 0022-notify-app-that-sock-state-changes-to-CLOSE_WAIT.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -58,6 +59,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Tue Mar 15 2022 jiangheng<jiangheng12@huawei.com> - 2.1.3-9
- notify app that sock state changes to CLOSE_WAIT
* Tue Mar 15 2022 jiangheng<jiangheng12@huawei.com> - 2.1.3-8
- refactor event,if ring is full, node is added to list