aboutgitcodebugslistschat
path: root/checksum.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-10-19 11:43:50 +1100
committerStefano Brivio <sbrivio@redhat.com>2022-10-19 03:34:40 +0200
commitf72b63e92f040104a289d5f38047c3688fa76593 (patch)
tree7f22d45d62b81e70816cd95589fc5347b34c0ce9 /checksum.c
parenta2eb2d310a28aa916d47c41d98dfddcc7619f639 (diff)
downloadpasst-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 'checksum.c')
-rw-r--r--checksum.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/checksum.c b/checksum.c
index 7b83196..09d2c7c 100644
--- a/checksum.c
+++ b/checksum.c
@@ -211,40 +211,6 @@ void csum_icmp6(struct icmp6hdr *icmp6hr,
icmp6hr->icmp6_cksum = csum_unaligned(payload, len, psum);
}
-/**
- * csum_tcp4() - Calculate TCP checksum for IPv4 and set in place
- * @iph: Packet buffer, IP header
- */
-void csum_tcp4(struct iphdr *iph)
-{
- uint16_t tlen = ntohs(iph->tot_len) - iph->ihl * 4, *p;
- struct tcphdr *th;
- uint32_t sum = 0;
-
- th = (struct tcphdr *)((char *)iph + (intptr_t)(iph->ihl * 4));
- p = (uint16_t *)th;
-
- sum += (iph->saddr >> 16) & 0xffff;
- sum += iph->saddr & 0xffff;
- sum += (iph->daddr >> 16) & 0xffff;
- sum += iph->daddr & 0xffff;
-
- sum += htons(IPPROTO_TCP);
- sum += htons(tlen);
-
- th->check = 0;
- while (tlen > 1) {
- sum += *p++;
- tlen -= 2;
- }
-
- if (tlen > 0) {
- sum += *p & htons(0xff00);
- }
-
- th->check = (uint16_t)~csum_fold(sum);
-}
-
#ifdef __AVX2__
#include <immintrin.h>