sync CFG:fix multicast IP assert error

(cherry picked from commit fedbae8953db198a5889b96d1868338462e9ff90)
This commit is contained in:
yinbin6 2024-05-09 10:54:57 +08:00 committed by openeuler-sync-bot
parent 8aca4746ed
commit fffe6852d1
6 changed files with 208 additions and 2 deletions

View File

@ -0,0 +1,25 @@
From 3e10c7661d412082990d88d479c02d77c14fbd8c Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Tue, 30 Apr 2024 09:56:59 +0800
Subject: [PATCH] ltran: memset quintuple
---
src/ltran/ltran_forward.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ltran/ltran_forward.c b/src/ltran/ltran_forward.c
index a5756d7..0658b11 100644
--- a/src/ltran/ltran_forward.c
+++ b/src/ltran/ltran_forward.c
@@ -251,7 +251,7 @@ static __rte_always_inline int32_t tcp_handle(struct rte_mbuf *m, const struct r
{
struct gazelle_tcp_conn *tcp_conn = NULL;
struct gazelle_tcp_sock *tcp_sock = NULL;
- struct gazelle_quintuple quintuple;
+ struct gazelle_quintuple quintuple = {0};
quintuple.dst_ip.u_addr.ip4.addr = ipv4_hdr->dst_addr;
quintuple.src_ip.u_addr.ip4.addr = ipv4_hdr->src_addr;
--
2.33.0

View File

@ -0,0 +1,69 @@
From 62297e7fb9299a75bc582b1abb4343e88e5c7c05 Mon Sep 17 00:00:00 2001
From: ningjin <ningjin@kylinos.cn>
Date: Thu, 28 Mar 2024 16:05:01 +0800
Subject: [PATCH] gazellectl add lwip stats_proto print
---
src/common/gazelle_dfx_msg.h | 4 ++++
src/ltran/ltran_dfx.c | 12 +++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 5d626a2..17e1662 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -206,6 +206,10 @@ struct gazelle_stat_lstack_proto {
/* data */
uint16_t xmit; /* Transmitted packets. */
uint16_t recv; /* Received packets. */
+ uint16_t tx_in; /* Transmitted in packets. */
+ uint16_t tx_out; /* Transmitted out packets. */
+ uint16_t rx_in; /* Received in packets. */
+ uint16_t rx_out; /* Received out packets. */
uint16_t fw; /* Forwarded packets. */
uint16_t drop; /* Dropped packets. */
uint16_t chkerr; /* Checksum error. */
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index c81cce2..f4e55e3 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -1114,8 +1114,10 @@ static void gazelle_print_lstack_stat_proto_core(const struct gazelle_stack_dfx_
const struct gazelle_stat_lstack_proto *proto)
{
printf("\n------ stack tid: %6u ------\n", stat->tid);
- printf("xmit: %u\n", proto->xmit);
- printf("recv: %u\n", proto->recv);
+ printf("tx_in: %u\n", proto->tx_in);
+ printf("tx_out: %u\n", proto->tx_out);
+ printf("rx_in: %u\n", proto->rx_in);
+ printf("rx_out: %u\n", proto->rx_out);
printf("fw: %u\n", proto->fw);
printf("drop: %u\n", proto->drop);
printf("chkerr: %u\n", proto->chkerr);
@@ -1297,11 +1299,11 @@ static void show_usage(void)
" -x, xstats show lstack xstats \n"
" -k, nic-features show state of protocol offload and other features \n"
" -a, aggregatin [time] show lstack send/recv aggregation \n"
+ " -p, protocol {UDP | TCP | ICMP | IP | ETHARP} show lstack protocol statistics \n"
" set: \n"
" loglevel {error | info | debug} set lstack loglevel \n"
" lowpower {0 | 1} set lowpower enable \n"
" [time] measure latency time default 1S, maximum 30mins \n\n"
- " -p, protocol {UDP | TCP | ICMP | IP | ETHARP | IP_FRAG} show lstack protocol statistics \n"
#ifdef GAZELLE_FAULT_INJECT_ENABLE
" *inject params*\n"
" |inject_type | digit_param_1 | digit_param_2 | inject_rule |\n"
@@ -1512,8 +1514,8 @@ static int32_t parse_dfx_lstack_show_proto_args(int32_t argc, char *argv[], stru
int32_t ret;
char *param = argv[GAZELLE_OPTIONS2_ARG_IDX];
- if (strcmp(param, "UDP") != 0 && strcmp(param, "TCP") != 0 && strcmp(param, "IP") &&
- strcmp(param, "ICMP") && strcmp(param, "ETHARP") != 0) {
+ if ((param == NULL) || (strcmp(param, "UDP") != 0 && strcmp(param, "TCP") != 0 && strcmp(param, "IP") &&
+ strcmp(param, "ICMP") && strcmp(param, "ETHARP") != 0)) {
return cmd_index;
}
ret = strncpy_s(req_msg[cmd_index].data.protocol, MAX_PROTOCOL_LENGTH, argv[GAZELLE_OPTIONS2_ARG_IDX],
--
2.33.0

View File

@ -0,0 +1,28 @@
From 38f5dbd34dfede9fc4a22c89903132fafc01fc6d Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Mon, 29 Apr 2024 17:07:15 +0800
Subject: [PATCH] CFG:set multicast IP assert
---
src/lstack/core/lstack_cfg.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 533eb6c..319a720 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -244,6 +244,11 @@ static int32_t parse_host_addr(void)
if (g_config_params.host_addr.addr == INADDR_NONE) {
return -EINVAL;
}
+
+ if (IN_MULTICAST(g_config_params.host_addr.addr)) {
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: host_addr:%s should not be a multicast IP.", value);
+ return -EINVAL;
+ }
return 0;
}
--
2.33.0

View File

@ -0,0 +1,47 @@
From 82ad5f93a2bd11411fec78ec7bcb26d6055fdfda Mon Sep 17 00:00:00 2001
From: zhangmengxuan <zhangmengxuan@kylinos.cn>
Date: Mon, 29 Apr 2024 10:43:37 +0800
Subject: [PATCH] cfg: devices must be in bond_slave_mac for
BONDING_MODE_ACTIVE
---
src/lstack/core/lstack_cfg.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 533eb6c..8073dd4 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -1210,6 +1210,16 @@ static int32_t parse_bond_miimon(void)
return ret;
}
+static bool validate_bond_mac(uint8_t *mac_addr, struct rte_ether_addr *bond_slave_mac, int num_slaves)
+{
+ for (int i = 0; i < num_slaves; i++) {
+ if (memcmp(mac_addr, bond_slave_mac[i].addr_bytes, ETHER_ADDR_LEN) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
static int32_t parse_bond_slave_mac(void)
{
if (g_config_params.bond_mode == -1) {
@@ -1252,6 +1262,12 @@ static int32_t parse_bond_slave_mac(void)
k = k + 1;
}
free(bond_slave_mac_tmp);
+ if (g_config_params.bond_mode == BONDING_MODE_ACTIVE_BACKUP) {
+ if (!validate_bond_mac(g_config_params.mac_addr, g_config_params.bond_slave_mac_addr, GAZELLE_MAX_BOND_NUM)) {
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: devices must be in bond_slave_mac for BONDING_MODE_ACTIVE_BACKUP.\n");
+ return -EINVAL;
+ }
+ }
return ret;
}
--
2.33.0

View File

@ -0,0 +1,25 @@
From f9407c8871223cef6dfbc66afb89a3b1b13b811a Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Wed, 8 May 2024 16:32:44 +0800
Subject: [PATCH] CFG:fix multicast IP assert error
---
src/lstack/core/lstack_cfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 7967bb7..9efdbaa 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -245,7 +245,7 @@ static int32_t parse_host_addr(void)
return -EINVAL;
}
- if (IN_MULTICAST(g_config_params.host_addr.addr)) {
+ if (IN_MULTICAST(ntohl(g_config_params.host_addr.addr))) {
LSTACK_PRE_LOG(LSTACK_ERR, "cfg: host_addr:%s should not be a multicast IP.", value);
return -EINVAL;
}
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.2
Release: 34
Release: 35
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -188,6 +188,11 @@ Patch9168: 0168-fix-tcp-recv-does-not-return-pkg-when-ring-buffer-is.patch
Patch9169: 0169-add-tuple_fileter-error-info.patch
Patch9170: 0170-adapt-dpdk-23.11-remove-kni.patch
Patch9171: 0171-fix-ioctl-set-failed.patch
Patch9172: 0172-ltran-memset-quintuple.patch
Patch9173: 0173-gazellectl-add-lwip-stats_proto-print.patch
Patch9174: 0174-CFG-set-multicast-IP-assert.patch
Patch9175: 0175-cfg-devices-must-be-in-bond_slave_mac-for-BONDING_MO.patch
Patch9176: 0176-CFG-fix-multicast-IP-assert-error.patch
%description
%{name} is a high performance user-mode stack.
@ -229,7 +234,14 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Sun Apr 28 CST yinbin6 <yinbin8@huawei.com> - 1.0.2-34
* Thu May 9 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-35
- CFG:fix multicast IP assert error
- cfg: devices must be in bond_slave_mac for BONDING_MODE_ACTIVE
- CFG:set multicast IP assert
- gazellectl add lwip stats_proto print
- ltran: memset quintuple
* Sun Apr 28 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-34
- fix ioctl set failed
* Fri Apr 19 2024 yangchen555 <yangchen145@huawei.com> - 1.0.2-33