mirror of
https://passt.top/passt
synced 2025-08-13 10:33:13 +02:00
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>
This commit is contained in:
parent
67151090bc
commit
2ee07697c4
3 changed files with 34 additions and 94 deletions
12
tcp_vu.c
12
tcp_vu.c
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue