53 lines
1.6 KiB
Diff
53 lines
1.6 KiB
Diff
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
|
|
|