Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6/TCP checksum calcluated incorrectly #3

Open
alexirger opened this issue Jun 14, 2019 · 1 comment
Open

IPv6/TCP checksum calcluated incorrectly #3

alexirger opened this issue Jun 14, 2019 · 1 comment

Comments

@alexirger
Copy link

Any IPv6/TCP packet crafted by sendip has incorrect TCP checksum on latest code.

Proposed patch:

diff --git a/tcp.c b/tcp.c
index fa9db26..56fcd46 100644
--- a/tcp.c
+++ b/tcp.c
@@ -74,7 +74,8 @@ static void tcp6csum(sendip_data *ipv6_hdr, sendip_data *tcp_hdr,
        memset(&phdr,0,sizeof(phdr));
        memcpy(&phdr.source,&ipv6->ip6_src,sizeof(struct in6_addr));
        memcpy(&phdr.destination,&ipv6->ip6_dst,sizeof(struct in6_addr));
-       phdr.ulp_length=IPPROTO_TCP;
+        phdr.nexthdr=IPPROTO_TCP;
+        phdr.ulp_length=htobe32(tcp_hdr->alloc_len+data->alloc_len);

        memcpy(tempbuf,&phdr,sizeof(phdr));
@ptpt52
Copy link

ptpt52 commented Apr 22, 2022

fixed in ptpt52/sendip@878ab01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants