1 Star 0 Fork 32

hantwofish/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0126-cfg-host_addr-is-not-mandatory.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-02-04 15:21 . sync patches from upstream
From 1ad9802429cc2d2cf8eb90ec84cfed7d3c3d4feb Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Mon, 29 Jan 2024 15:01:05 +0800
Subject: [PATCH] cfg: host_addr is not mandatory
---
src/lstack/core/lstack_cfg.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 028ea26..7e4482f 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -185,6 +185,10 @@ static int32_t parse_gateway_addr(void)
char *value;
bool ok;
+ if (ip4_addr_isany_val(g_config_params.host_addr)) {
+ return 0;
+ }
+
ok = config_lookup_string(&g_config, "gateway_addr", (const char **)&value);
if (!ok) {
return -EINVAL;
@@ -202,6 +206,10 @@ static int32_t parse_mask_addr(void)
uint32_t mask;
bool ok;
+ if (ip4_addr_isany_val(g_config_params.host_addr)) {
+ return 0;
+ }
+
ok = config_lookup_string(&g_config, "mask_addr", (const char **)&value);
if (!ok) {
return -EINVAL;
@@ -225,7 +233,7 @@ static int32_t parse_host_addr(void)
ok = config_lookup_string(&g_config, "host_addr", (const char **)&value);
if (!ok) {
- return -EINVAL;
+ return 0;
}
g_config_params.host_addr.addr = inet_addr(value);
@@ -242,7 +250,12 @@ static int32_t parse_host_addr6(void)
ok = config_lookup_string(&g_config, "host_addr6", (const char **)&value);
if (!ok) {
- return 0;
+ if (ip4_addr_isany_val(g_config_params.host_addr)) {
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: host_addr and host_addr6 must have a valid one.");
+ return -EINVAL;
+ } else {
+ return 0;
+ }
}
if (ip6addr_aton(value, &g_config_params.host_addr6) == 0) {
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/gazelle_1.git
git@gitee.com:hantwofish/gazelle_1.git
hantwofish
gazelle_1
gazelle_1
master

搜索帮助