From 63ad56cdd63673506db317161b89b20b254fca8a Mon Sep 17 00:00:00 2001
From: hankangkang <hankangkang5@huawei.com>
Date: Fri, 1 Nov 2024 15:22:52 +0800
Subject: [PATCH] bugfix: Codedump occurs, when the GAZELLE_TCP_REUSE_IPPORT is
 turned on and only monitors the v6 address.

---
 src/core/tcp_in.c      | 3 +++
 src/include/lwipopts.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index fa2a88b..2910c84 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -405,6 +405,9 @@ tcp_input(struct pbuf *p, struct netif *inp)
         if (IP_IS_ANY_TYPE_VAL(lpcb->local_ip)) {
           /* found an ANY TYPE (IPv4/IPv6) match */
 #if SO_REUSE
+#if GAZELLE_TCP_REUSE_IPPORT
+          min_cnts_lpcb = min_cnts_lpcb_get(lpcb);
+#endif
           lpcb_any = lpcb;
           lpcb_prev = prev;
 #else /* SO_REUSE */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 4f89884..572d550 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -259,7 +259,7 @@
 
 #define LWIP_SO_SNDTIMEO 1
 
-#define LWIP_SO_LINGER 0
+#define LWIP_SO_LINGER 1
 
 #define LWIP_SO_RCVBUF 1
 
-- 
2.33.0

