Skip to content

Packet injection and verdict setting fixes. - #2122

Merged
stenya merged 4 commits into
safing:developmentfrom
vlabo:develop
Mar 10, 2026
Merged

Packet injection and verdict setting fixes.#2122
stenya merged 4 commits into
safing:developmentfrom
vlabo:develop

Conversation

@vlabo

@vlabo vlabo commented Jan 26, 2026

Copy link
Copy Markdown
Member

61c3443: Makes the block and drop verdict immutable. This will make windows apply the verdict immediately and not let other layers in the chain override the verdict. Also makes the applying of the verdict immediate in the ALE layer. So applications will get permission denied when trying to create a connection instead of timeout after few seconds.

04f8708: Fixes the packet injection in the packet callout. From what I remember this is only used in packet dns monitoring. Without recalculating the checksums the packet will just get dropped after injection by the network system.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed incorrect checksum calculations for network packets in outbound traffic, ensuring proper packet validation for both IPv4 and IPv6 protocols.

@vlabo
vlabo requested a review from stenya January 26, 2026 19:23
@coderabbitai

coderabbitai Bot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b9b80d5a-73bc-43b6-9ccd-c1d05206a653

📥 Commits

Reviewing files that changed from the base of the PR and between 04f8708 and 8786aac.

📒 Files selected for processing (1)
  • windows_kext/driver/src/packet_callouts.rs

📝 Walkthrough

Walkthrough

The changes add header checksum recalculation functionality to the Windows kernel extension driver. A new public function recalc_header_checksums is introduced to compute transport-layer checksums for both IPv4 and IPv6 packets. The packet callouts module is updated to invoke this function on outbound packets after cloning, ensuring checksums are properly recalculated before packet injection.

Changes

Cohort / File(s) Summary
Checksum Utility Function
windows_kext/driver/src/packet_util.rs
New public function recalc_header_checksums that recomputes transport-layer (UDP/TCP) checksums for both IPv4 and IPv6 packets by parsing IP headers, extracting addresses, and updating checksum fields as needed.
Packet Callout Integration
windows_kext/driver/src/packet_callouts.rs
Imports the new checksum function and integrates it into clone_packet to recalculate checksums on outbound packets after cloning and when data is available, before packet injection.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • dhaavi
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Packet injection and verdict setting fixes' partially aligns with the changeset. The PR addresses packet injection checksum fixes (verified in the raw summary), but the 'verdict setting fixes' part references commits that were reverted per reviewer feedback. The title remains technically accurate for the final state but is partially obsolete.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@stenya stenya self-assigned this Mar 6, 2026
Comment thread windows_kext/wdk/src/filter_engine/callout_data.rs Outdated
Comment thread windows_kext/wdk/src/filter_engine/callout_data.rs Outdated
@stenya

stenya commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Hello @vlabo

I’m sorry for the long delay in reviewing this - I only just noticed your pull request.
Many thanks for your efforts.

I only have a few comments:

// Checksums may be zero/garbage due to NIC hardware offload. When injecting
// via software those flags are absent, so we must write valid checksum bytes
// before storing the clone — even if the packet is otherwise unmodified.

By the way, I would really appreciate any feedback you might have on these commits: 674ff3f, 2d6fd0a,
or on the whole PR #2136 in general.

Comment thread windows_kext/driver/src/packet_callouts.rs
@stenya stenya modified the milestones: v2.1.10, v2.1.9 Mar 6, 2026
stenya added 2 commits March 10, 2026 14:02
Added a comment for the recalc_header_checksums() call.
Reverted changes to prevent merge conflicts

@stenya stenya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@stenya
stenya merged commit 8ed094b into safing:development Mar 10, 2026
3 of 5 checks passed
@vlabo

vlabo commented May 9, 2026

Copy link
Copy Markdown
Member Author

Sorry for the long delay. For some reason I did not get a notification.
I just reviewed the changes and they look good.

@stenya

stenya commented May 9, 2026

Copy link
Copy Markdown
Contributor

Thank you @vlabo !

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.

2 participants