1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-17 20:55:34 +02:00

udp: Pre-populate msg_names with local address

udp_splice_namebuf is now used only for spliced sending, and so it is
only ever populated with the localhost address, either IPv4 or IPv6.
So, replace the awkward initialization in udp_sock_handler_splice()
with statically initialized versions for IPv4 and IPv6.  We then just
need to update the port number in udp_sock_handler_splice().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-01-05 15:26:22 +11:00 committed by Stefano Brivio
parent c9e193b5ae
commit f1ed8dbfa7
2 changed files with 25 additions and 22 deletions

7
util.h
View file

@ -79,6 +79,13 @@
(IN_MULTICAST(ntohl((a)->s_addr)))
#define IN4_ARE_ADDR_EQUAL(a, b) \
(((struct in_addr *)(a))->s_addr == ((struct in_addr *)b)->s_addr)
#if __BYTE_ORDER == __BIG_ENDIAN
#define IN4ADDR_LOOPBACK_INIT \
{ .s_addr = INADDR_LOOPBACK }
#else
#define IN4ADDR_LOOPBACK_INIT \
{ .s_addr = __bswap_constant_32(INADDR_LOOPBACK) }
#endif
#define NS_FN_STACK_SIZE (RLIMIT_STACK_VAL * 1024 / 8)
int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags,