From 955dd3251c9e9b0a1469015748e4600f68e8de0a Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 22 Aug 2023 15:29:57 +1000 Subject: tcp, udp: Don't pre-fill IPv4 destination address in headers Because packets sent on the tap interface will always be going to the guest/namespace, we more-or-less know what address they'll be going to. So we pre-fill this destination address in our header buffers for IPv4. We can't do the same for IPv6 because we could need either the global or link-local address for the guest. In future we're going to want more flexibility for the destination address, so this pre-filling will get in the way. Change the flow so we always fill in the IPv4 destination address for each packet, rather than prefilling it from proto_update_l2_buf(). In fact for TCP we already redundantly filled the destination for each packet anyway. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tcp.h') diff --git a/tcp.h b/tcp.h index 3454d9a..1608d58 100644 --- a/tcp.h +++ b/tcp.h @@ -26,8 +26,7 @@ void tcp_timer(struct ctx *c, const struct timespec *ts); void tcp_defer_handler(struct ctx *c); void tcp_sock_set_bufsize(const struct ctx *c, int s); -void tcp_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s, - const struct in_addr *ip_da); +void tcp_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s); /** * union tcp_epoll_ref - epoll reference portion for TCP connections -- cgit v1.2.3