From 1467a35b5af93a5f7c6678e1c6a8d9b4c191160c Mon Sep 17 00:00:00 2001 From: David Gibson Date: Sat, 24 Sep 2022 19:08:18 +1000 Subject: udp: Delay initialization of UDP reversed port mapping table Because it's connectionless, when mapping UDP ports we need, in addition to the table of deltas for destination ports needed by TCP, we need an inverted table to translate the source ports on return packets. Currently we fill out the inverted table at the same time we construct the main table in udp_remap_to_tap() and udp_remap_to_init(). However, we don't use either table until after we've initialized UDP, so we can delay the construction of the reverse table to udp_init(). This makes the configuration more symmetric between TCP and UDP which will enable further cleanups. Signed-off-by: David Gibson --- udp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'udp.h') diff --git a/udp.h b/udp.h index cfd1a97..25422b6 100644 --- a/udp.h +++ b/udp.h @@ -14,7 +14,7 @@ int udp_tap_handler(struct ctx *c, int af, const void *addr, const struct pool *p, const struct timespec *now); void udp_sock_init(const struct ctx *c, int ns, sa_family_t af, const void *addr, in_port_t port); -int udp_init(const struct ctx *c); +int udp_init(struct ctx *c); void udp_timer(struct ctx *c, const struct timespec *ts); void udp_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s, const uint32_t *ip_da); -- cgit v1.2.3