2 Star 0 Fork 32

我们17走/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0146-udp-add-restriction-message-too-long.patch 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-03-14 16:57 . sync fix rpc_pool create failed coredump
From a37c451e63bed06a70e887aba6364183d71f414f Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 11 Mar 2024 11:18:54 +0800
Subject: [PATCH] udp add restriction: message too long
---
src/common/gazelle_opt.h | 2 ++
src/lstack/core/lstack_lwip.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/src/common/gazelle_opt.h b/src/common/gazelle_opt.h
index 1d1c5f5..6d787b9 100644
--- a/src/common/gazelle_opt.h
+++ b/src/common/gazelle_opt.h
@@ -60,6 +60,8 @@
#define DPDK_PKT_BURST_SIZE 512
+#define GAZELLE_UDP_PKGLEN_MAX (65535 - IP_HLEN - UDP_HLEN)
+
/* total:33 client, index 32 is invaild client */
#define GAZELLE_CLIENT_NUM_ALL 33
#define GAZELLE_NULL_CLIENT (GAZELLE_CLIENT_NUM_ALL - 1)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index f4199f8..8aae433 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -779,6 +779,11 @@ ssize_t do_lwip_send_to_stack(int32_t fd, const void *buf, size_t len, int32_t f
return 0;
}
+ if (NETCONN_IS_UDP(sock) && (len > GAZELLE_UDP_PKGLEN_MAX)) {
+ LSTACK_LOG(ERR, LSTACK, "Message too long\n");
+ GAZELLE_RETURN(EMSGSIZE);
+ }
+
thread_bind_stack(sock);
if (sock->same_node_tx_ring != NULL) {
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/together17/gazelle.git
git@gitee.com:together17/gazelle.git
together17
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385