From 33efdf6e98d223f44a0168ae2e17e95cb7f27402 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Thu, 14 Mar 2024 13:16:58 +0800
Subject: [PATCH] fix netperf setsockopt fail

---
 src/lstack/api/lstack_wrap.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 49bbf91..1bec08b 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -364,6 +364,14 @@ static inline int32_t do_getsockname(int32_t s, struct sockaddr *name, socklen_t
     return posix_api->getsockname_fn(s, name, namelen);
 }
 
+static bool unsupport_ip_optname(int32_t optname)
+{
+    if (optname == IP_RECVERR) {
+        return true;
+    }
+    return false;
+}
+
 static bool unsupport_tcp_optname(int32_t optname)
 {
     if ((optname == TCP_QUICKACK) ||
@@ -391,6 +399,10 @@ static bool unsupport_socket_optname(int32_t optname)
 
 static bool unsupport_optname(int32_t level, int32_t optname)
 {
+    if (level == SOL_IP) {
+        return unsupport_ip_optname(optname);
+    }
+
     if (level == SOL_TCP) {
         return unsupport_tcp_optname(optname);
     }
-- 
2.33.0

