From 7cb4456d14405d1d9dbeb890642a339ef13165da Mon Sep 17 00:00:00 2001
From: Lemmy Huang <huangliming5@huawei.com>
Date: Mon, 22 Jul 2024 15:09:33 +0800
Subject: [PATCH] Check the return of lwip_init

Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
---
 src/lstack/core/lstack_protocol_stack.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 6f2e84e..2867711 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -421,6 +421,11 @@ static struct protocol_stack *stack_thread_init(void *arg)
     RTE_PER_LCORE(_lcore_id) = stack->cpu_id;
 
     lwip_init();
+    /* Using errno to return lwip_init() result. */
+    if (errno != 0) {
+        LSTACK_LOG(ERR, LSTACK, "lwip_init failed, errno %d\n", errno);
+        goto END;
+    }
 
     if (use_ltran()) {
         if (client_reg_thrd_ring() != 0) {
-- 
2.33.0

