diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-10-19 11:43:50 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-10-19 03:34:40 +0200 |
commit | f72b63e92f040104a289d5f38047c3688fa76593 (patch) | |
tree | 7f22d45d62b81e70816cd95589fc5347b34c0ce9 /tap.c | |
parent | a2eb2d310a28aa916d47c41d98dfddcc7619f639 (diff) | |
download | passt-f72b63e92f040104a289d5f38047c3688fa76593.tar passt-f72b63e92f040104a289d5f38047c3688fa76593.tar.gz passt-f72b63e92f040104a289d5f38047c3688fa76593.tar.bz2 passt-f72b63e92f040104a289d5f38047c3688fa76593.tar.lz passt-f72b63e92f040104a289d5f38047c3688fa76593.tar.xz passt-f72b63e92f040104a289d5f38047c3688fa76593.tar.zst passt-f72b63e92f040104a289d5f38047c3688fa76593.zip |
Remove support for TCP packets from tap_ip_send()
tap_ip_send() is never used for TCP packets, we're unlikely to use it for
that in future, and the handling of TCP packets makes other cleanups
unnecessarily awkward. Remove it.
This is the only user of csum_tcp4(), so we can remove that as well.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
-rw-r--r-- | tap.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -165,9 +165,7 @@ void tap_ip_send(const struct ctx *c, const struct in6_addr *src, uint8_t proto, memcpy(data, in, len); - if (iph->protocol == IPPROTO_TCP) { - csum_tcp4(iph); - } else if (iph->protocol == IPPROTO_UDP) { + if (iph->protocol == IPPROTO_UDP) { struct udphdr *uh = (struct udphdr *)(iph + 1); csum_udp4(uh, iph->saddr, iph->daddr, uh + 1, len - sizeof(*uh)); @@ -196,13 +194,8 @@ void tap_ip_send(const struct ctx *c, const struct in6_addr *src, uint8_t proto, ip6h->hop_limit = proto; ip6h->version = 0; ip6h->nexthdr = 0; - if (proto == IPPROTO_TCP) { - struct tcphdr *th = (struct tcphdr *)(ip6h + 1); - th->check = 0; - th->check = csum_unaligned(ip6h, len + sizeof(*ip6h), - 0); - } else if (proto == IPPROTO_UDP) { + if (proto == IPPROTO_UDP) { struct udphdr *uh = (struct udphdr *)(ip6h + 1); csum_udp6(uh, &ip6h->saddr, &ip6h->daddr, |