代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/lwip 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 430469b1fa14ed689781eeed14dc8ce7cadd22a3 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 19:16:07 +0800
Subject: replace qtuple addr with gz_addr_t
---
src/include/lwip/priv/tcp_priv.h | 24 ++++++------------------
src/include/reg_sock.h | 19 ++++++++++++-------
2 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index 75c67ee..8d7b9df 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -347,24 +347,12 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
LWIP_ASSERT("Invalid parameter", pcb != NULL);
struct gazelle_quintuple qtuple;
- if (IP_IS_V4_VAL(pcb->local_ip)) {
- qtuple.protocol = 0;
- qtuple.src_ip = ip_2_ip4(&pcb->local_ip)->addr;
- qtuple.src_port = lwip_htons(pcb->local_port);
- qtuple.dst_ip = ip_2_ip4(&pcb->remote_ip)->addr;
- qtuple.dst_port = lwip_htons(pcb->remote_port);
- } else {
-#if LWIP_IPV6
- qtuple.protocol = 1;
- qtuple.src_port = lwip_htons(pcb->local_port);
- qtuple.dst_port = lwip_htons(pcb->remote_port);
-
- for (int i = 0; i < 4; i++) {
- qtuple.src_ip6[i] = pcb->local_ip.u_addr.ip6.addr[i];
- qtuple.dst_ip6[i] = pcb->remote_ip.u_addr.ip6.addr[i];
- }
-#endif
- }
+
+ qtuple.protocol = IP_IS_V4_VAL(pcb->local_ip) ? GZ_ADDR_TYPE_V4 : GZ_ADDR_TYPE_V6;
+ qtuple.src_ip = *((gz_addr_t *)&pcb->local_ip);
+ qtuple.src_port = lwip_htons(pcb->local_port);
+ qtuple.dst_ip = *((gz_addr_t *)&pcb->remote_ip);
+ qtuple.dst_port = lwip_htons(pcb->remote_port);
#if GAZELLE_TCP_REUSE_IPPORT
if (reg_type == REG_RING_TCP_CONNECT_CLOSE) {
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
index a11102e..466a2c2 100644
--- a/src/include/reg_sock.h
+++ b/src/include/reg_sock.h
@@ -37,6 +37,16 @@
#include "lwipopts.h"
+/* compatible with lwip_ip_addr_type */
+enum gz_ip_addr_type {
+ /** IPv4 */
+ GZ_ADDR_TYPE_V4 = 0U,
+ /** IPv6 */
+ GZ_ADDR_TYPE_V6 = 6U,
+ /** IPv4+IPv6 ("dual-stack") */
+ GZ_ADDR_TYPE_ANY = 46U
+};
+
/* compatible with ip4_addr_t */
struct gz_ip4 {
uint32_t addr;
@@ -78,13 +88,8 @@ struct gazelle_quintuple {
uint16_t src_port;
uint16_t dst_port;
- /* TODO: replace with gz_addr_t */
- uint32_t src_ip;
- uint32_t dst_ip;
-#if LWIP_IPV6
- uint32_t src_ip6[4];
- uint32_t dst_ip6[4];
-#endif
+ gz_addr_t src_ip;
+ gz_addr_t dst_ip;
};
struct reg_ring_msg {
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。