From e07f539ae0aa3ad623c4e8afcaca26906fd1eb17 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Fri, 30 Apr 2021 14:52:18 +0200 Subject: udp, passt: Introduce socket packet buffer, avoid getsockname() for UDP This is in preparation for scatter-gather IO on the UDP receive path: save a getsockname() syscall by setting a flag if we get the numbering of all bound sockets in a strict sequence (expected, in practice) and repurpose the tap buffer to be also a socket receive buffer, passing it down to protocol handlers. Signed-off-by: Stefano Brivio --- icmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'icmp.c') diff --git a/icmp.c b/icmp.c index 493452d..2966cb3 100644 --- a/icmp.c +++ b/icmp.c @@ -38,9 +38,10 @@ * @c: Execution context * @s: File descriptor number for socket * @events: epoll events bitmap + * @pkt_buf: Buffer to receive packets, currently unused * @now: Current timestamp, unused */ -void icmp_sock_handler(struct ctx *c, int s, uint32_t events, +void icmp_sock_handler(struct ctx *c, int s, uint32_t events, char *pkt_buf, struct timespec *now) { struct in6_addr a6 = { .s6_addr = { 0, 0, 0, 0, @@ -53,6 +54,7 @@ void icmp_sock_handler(struct ctx *c, int s, uint32_t events, ssize_t n; (void)events; + (void)pkt_buf; (void)now; n = recvfrom(s, buf, sizeof(buf), MSG_DONTWAIT, -- cgit v1.2.3