From af04d2037d5813f2bcbbc26ea3dea389556b2bea Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 13 Jan 2025 10:41:10 +0800
Subject: [PATCH] fix pcb.tcp null pointer error when netperf recv RST

---
 src/api/sockets.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/api/sockets.c b/src/api/sockets.c
index 69c3086..9fafca3 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -3147,7 +3147,7 @@ lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *opt
 #endif /* LWIP_SO_RCVTIMEO */
 #if GAZELLE_SO_SNDBUF
         case SO_SNDBUF:
-          LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock, *optlen, tcpwnd_size_t);
+          LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, *optlen, tcpwnd_size_t);
           if (netconn_type(sock->conn) == NETCONN_TCP) {
             *(tcpwnd_size_t *)optval = netconn_get_sndbufsize(sock->conn);
           }
@@ -3556,7 +3556,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
 #endif /* LWIP_SO_RCVTIMEO */
 #if GAZELLE_SO_SNDBUF
         case SO_SNDBUF:
-          LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock, optlen, tcpwnd_size_t);
+          LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, tcpwnd_size_t);
           if (netconn_type(sock->conn) == NETCONN_TCP) {
             netconn_set_sndbufsize(sock->conn, *(const tcpwnd_size_t *)optval);    
           }
-- 
2.33.0

