Skip to content

Fix sparse endianness warnings in TCP hijacking - #123

Open
randomizedcoder wants to merge 1 commit into
PlatformLab:mainfrom
randomizedcoder:fix/hijack-sparse-endian
Open

randomizedcoder wants to merge 1 commit into
PlatformLab:mainfrom
randomizedcoder:fix/hijack-sparse-endian

Conversation

@randomizedcoder

Copy link
Copy Markdown
Contributor
  • homa_skb_hijacked: compare the __be16 urgent field with htons(HOMA_HIJACK_URGENT) (was ntohs), matching homa_hijack_set_hdr. Same value on all architectures.
  • homa_common_hdr.checksum: __sum16 (what tcp_v4_check/tcp_v6_check return) instead of __be16.

Found with sparse -D__CHECK_ENDIAN__; clears all 4 warnings in homa_hijack.c/.h.

No test: annotation-only, no behaviour change. Unit tests: 862/862 pass.

🤖 Generated with Claude Code

* homa_skb_hijacked compared the __be16 urgent field with
  ntohs(HOMA_HIJACK_URGENT); use htons, matching homa_hijack_set_hdr
  (same value on every architecture, since the swap is symmetric).
* Declare homa_common_hdr.checksum as __sum16, the type returned by
  tcp_v4_check/tcp_v6_check, instead of __be16.
* Found with sparse -D__CHECK_ENDIAN__; clears all four warnings in
  homa_hijack.c/.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant