sync add udp_enable to turn off udp in need
(cherry picked from commit d5372bfea3eb3d10c061e5a7f19c605d093d98bc)
This commit is contained in:
parent
8e91092c61
commit
a14e3cb652
72
0260-add-udp_enable-to-turn-off-udp-in-need.patch
Normal file
72
0260-add-udp_enable-to-turn-off-udp-in-need.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From b842ce11460bb2f181b33a8ee71af1277eb80567 Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Tue, 27 Jun 2023 14:50:06 +0800
|
||||
Subject: [PATCH] add udp_enable to turn off udp in need
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 1 +
|
||||
src/lstack/core/lstack_cfg.c | 9 +++++++++
|
||||
src/lstack/include/lstack_cfg.h | 1 +
|
||||
3 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 6ee0512..6a1a2c4 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -414,6 +414,7 @@ static inline int32_t do_setsockopt(int32_t s, int32_t level, int32_t optname, c
|
||||
static inline int32_t do_socket(int32_t domain, int32_t type, int32_t protocol)
|
||||
{
|
||||
if ((domain != AF_INET && domain != AF_UNSPEC)
|
||||
+ || ((type & SOCK_DGRAM) && !get_global_cfg_params()->udp_enable)
|
||||
|| posix_api->ues_posix) {
|
||||
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 8a627d5..32d63b9 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -73,6 +73,7 @@ static int32_t parse_tuple_filter(void);
|
||||
static int32_t parse_use_bond4(void);
|
||||
static int32_t parse_bond4_slave_mac(void);
|
||||
static int32_t parse_use_sockmap(void);
|
||||
+static int32_t parse_udp_enable(void);
|
||||
|
||||
#define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
|
||||
do { \
|
||||
@@ -129,6 +130,7 @@ static struct config_vector_t g_config_tbl[] = {
|
||||
{ "use_bond4", parse_use_bond4 },
|
||||
{ "bond4_slave_mac", parse_bond4_slave_mac },
|
||||
{ "use_sockmap", parse_use_sockmap },
|
||||
+ { "udp_enable", parse_udp_enable },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -1097,6 +1099,13 @@ static int parse_tuple_filter(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int32_t parse_udp_enable(void)
|
||||
+{
|
||||
+ int32_t ret;
|
||||
+ PARSE_ARG(g_config_params.udp_enable, "udp_enable", 1, 0, 1, ret);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int32_t parse_use_bond4(void)
|
||||
{
|
||||
int32_t ret;
|
||||
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
|
||||
index 6da18cf..9102fee 100644
|
||||
--- a/src/lstack/include/lstack_cfg.h
|
||||
+++ b/src/lstack/include/lstack_cfg.h
|
||||
@@ -109,6 +109,7 @@ struct cfg_params {
|
||||
uint8_t bond4_slave1_mac_addr[ETHER_ADDR_LEN];
|
||||
uint8_t bond4_slave2_mac_addr[ETHER_ADDR_LEN];
|
||||
bool use_sockmap;
|
||||
+ bool udp_enable;
|
||||
};
|
||||
|
||||
struct cfg_params *get_global_cfg_params(void);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.1
|
||||
Release: 68
|
||||
Release: 69
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -274,6 +274,7 @@ Patch9256: 0256-lstack-cfg-add-app_exclude_cpus.patch
|
||||
Patch9257: 0257-enable-UDP-CKSUM-in-gazelle.patch
|
||||
Patch9258: 0258-fix-core-dump-when-slave-mac-failed.patch
|
||||
Patch9259: 0259-check-return-value-of-hugepage_init-to-avoid-coredum.patch
|
||||
Patch9260: 0260-add-udp_enable-to-turn-off-udp-in-need.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -315,6 +316,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Tue Jun 27 2023 jiangheng12 <jiangheng14@huawei.com> - 1.0.1-69
|
||||
- add udp_enable to turn off udp in need
|
||||
|
||||
* Wed Jun 21 2023 jiangheng12 <jiangheng14@huawei.com> - 1.0.1-68
|
||||
- check return value of hugepage_init to avoid coredump when hugepage memory is insufficient
|
||||
- fix core dump when slave mac failed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user