diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-11-27 14:54:06 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-11-28 14:03:16 +0100 |
commit | 2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1 (patch) | |
tree | 66a8926d83fb889e9ef84731713c2d411088acee /tcp_vu.c | |
parent | 67151090bc349d9eec5a0b303d0cb3347b755251 (diff) | |
download | passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.tar passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.tar.gz passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.tar.bz2 passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.tar.lz passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.tar.xz passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.tar.zst passt-2ee07697c4ab4f4efff6431aaa787f21bcc6f1d1.zip |
tcp: Pass TCP header and payload separately to tcp_update_check_tcp[46]()
Currently these expects both the TCP header and payload in a single IOV,
and goes to some trouble to locate the checksum field within it. In the
current caller we've already know where the TCP header is, so we might as
well just pass it in. This will need to work a bit differently for
vhost-user, but that code already needs to locate the TCP header for other
reasons, so again we can just pass it in.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_vu.c')
-rw-r--r-- | tcp_vu.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -73,15 +73,19 @@ static void tcp_vu_update_check(const struct flowside *tapside, char *base = iov[0].iov_base; if (inany_v4(&tapside->oaddr)) { + struct tcphdr *th = vu_payloadv4(base); const struct iphdr *iph = vu_ip(base); + struct iov_tail payload = IOV_TAIL(iov, iov_cnt, + (char *)(th + 1) - base); - tcp_update_check_tcp4(iph, iov, iov_cnt, - (char *)vu_payloadv4(base) - base); + tcp_update_check_tcp4(iph, th, &payload); } else { + struct tcphdr *th = vu_payloadv6(base); const struct ipv6hdr *ip6h = vu_ip(base); + struct iov_tail payload = IOV_TAIL(iov, iov_cnt, + (char *)(th + 1) - base); - tcp_update_check_tcp6(ip6h, iov, iov_cnt, - (char *)vu_payloadv6(base) - base); + tcp_update_check_tcp6(ip6h, th, &payload); } } |