1 Star 0 Fork 48

flying-eagle/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0142-virtio-record-local_port-for-port_map-of-virtio.patch 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
From 97608b76168fc80d25f1871f4c8c17fd0457c9f9 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Tue, 25 Jun 2024 15:25:18 +0800
Subject: [PATCH] [virtio]: record local_port for port_map of virtio
---
src/core/udp.c | 8 ++++++++
src/include/reg_sock.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/src/core/udp.c b/src/core/udp.c
index 086e7e0..6b11bf6 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -1191,6 +1191,11 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("udp_bind: bound to "));
ip_addr_debug_print_val(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, pcb->local_ip);
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, (", port %"U16_F")\n", pcb->local_port));
+#if GAZELLE_ENABLE
+ struct gazelle_quintuple qtuple = {0};
+ qtuple.src_port = lwip_htons(pcb->local_port);
+ vdev_reg_xmit(REG_RING_UDP_BIND, &qtuple);
+#endif
return ERR_OK;
}
@@ -1373,6 +1378,9 @@ udp_remove(struct udp_pcb *pcb)
}
}
#if GAZELLE_UDP_ENABLE
+ struct gazelle_quintuple qtuple = {0};
+ qtuple.src_port = lwip_htons(pcb->local_port);
+ vdev_reg_xmit(REG_RING_UDP_BIND_CLOSE, &qtuple);
udp_release_port(pcb->local_port);
#endif
memp_free(MEMP_UDP_PCB, pcb);
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
index 466a2c2..04d1a8f 100644
--- a/src/include/reg_sock.h
+++ b/src/include/reg_sock.h
@@ -79,6 +79,8 @@ enum reg_ring_type {
REG_RING_TCP_LISTEN_CLOSE,
REG_RING_TCP_CONNECT,
REG_RING_TCP_CONNECT_CLOSE,
+ REG_RING_UDP_BIND,
+ REG_RING_UDP_BIND_CLOSE,
RING_REG_MAX,
};
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flying-eagle12138/lwip.git
git@gitee.com:flying-eagle12138/lwip.git
flying-eagle12138
lwip
lwip
master

搜索帮助