From d0c8c259add3b170e413d4c3a9e248ba3e550680 Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Thu, 23 Nov 2023 11:19:01 +0800
Subject: [PATCH] cfg: rm ipv6_enable

---
 src/lstack/api/lstack_wrap.c     | 2 +-
 src/lstack/core/lstack_cfg.c     | 8 --------
 src/lstack/include/lstack_cfg.h  | 1 -
 src/lstack/netif/lstack_ethdev.c | 4 ++--
 4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 43b9dad..abbf8a1 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -384,7 +384,7 @@ static inline int32_t do_socket(int32_t domain, int32_t type, int32_t protocol)
     }
 
     if ((domain != AF_INET && domain != AF_UNSPEC && domain != AF_INET6) ||
-        ((domain == AF_INET6) && !get_global_cfg_params()->ipv6_enable) ||
+        ((domain == AF_INET6) && ip6_addr_isany(&get_global_cfg_params()->host_addr6)) ||
         ((type & SOCK_DGRAM) && !get_global_cfg_params()->udp_enable)) {
         return posix_api->socket_fn(domain, type, protocol);
     }
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 7a4504f..d1cbd1d 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -76,7 +76,6 @@ static int32_t parse_bond_mode(void);
 static int32_t parse_bond_slave_mac(void);
 static int32_t parse_use_sockmap(void);
 static int32_t parse_udp_enable(void);
-static int32_t parse_ipv6_enable(void);
 static int32_t parse_nic_rxqueue_size(void);
 static int32_t parse_nic_txqueue_size(void);
 static int32_t parse_stack_thread_mode(void);
@@ -139,7 +138,6 @@ static struct config_vector_t g_config_tbl[] = {
     { "bond_slave_mac", parse_bond_slave_mac },
     { "use_sockmap", parse_use_sockmap },
     { "udp_enable", parse_udp_enable },
-    { "ipv6_enable", parse_ipv6_enable },
     { "nic_rxqueue_size", parse_nic_rxqueue_size},
     { "nic_txqueue_size", parse_nic_txqueue_size},
     { "stack_thread_mode", parse_stack_thread_mode },
@@ -1271,9 +1269,3 @@ static int32_t parse_nic_vlan_mode(void)
     return ret;
 }
 
-static int32_t parse_ipv6_enable(void)
-{
-    int32_t ret;
-    PARSE_ARG(g_config_params.ipv6_enable, "ipv6_enable", 0, 0, 1, ret);
-    return ret;
-}
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index e3edc57..26da357 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -117,7 +117,6 @@ struct cfg_params {
     struct rte_ether_addr bond_slave_mac_addr[GAZELLE_MAX_BOND_NUM];
     bool use_sockmap;
     bool udp_enable;
-    bool ipv6_enable;
     struct cfg_nic_params nic;
     bool stack_mode_rtc;
 };
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 02aa611..9912858 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -961,11 +961,11 @@ int32_t ethdev_init(struct protocol_stack *stack)
     }
     if (netif == NULL) {
         LSTACK_LOG(ERR, LSTACK, "netif_add failed\n");
-	return ERR_IF;
+        return ERR_IF;
     }
     if (!ip6_addr_isany(&cfg->host_addr6)) {
         netif_ip6_addr_set(&stack->netif, 0, &cfg->host_addr6);
-	netif_ip6_addr_set_state(&stack->netif, 0, IP6_ADDR_VALID);
+        netif_ip6_addr_set_state(&stack->netif, 0, IP6_ADDR_VALID);
     }
 
     netif_set_link_up(&stack->netif);
-- 
2.27.0

