feat(windows-kext): owner PID tracking, downstream filter bypass, and split-tunneling routing support#2137
Merged
stenya merged 6 commits intodevelopmentfrom Mar 10, 2026
Merged
Conversation
Add Verdict::RedirectSplitTunnel (11) with PM_SPLIT_TUN_PORT redirection. Wire up the new verdict in ALE, packet, and device layers alongside the existing redirect verdicts. RedirectSplitTunnel is kept last in the enum so older Portmaster versions (which only know verdicts 0–10) remain unaffected.
Add IRP_MJ_CREATE and IRP_MJ_CLEANUP handlers to capture and clear the PID of the user-space process that holds the device handle open. - wdk/ffi: expose PsGetCurrentProcessId kernel API - wdk/irp_helpers: add CreateRequest and CleanupRequest wrappers - driver/device: add owner_pid AtomicU32 field with lock-free access for callouts; add is_owner_pid() helper - driver/entry: register driver_create/driver_cleanup dispatch routines that store/clear owner_pid on connect/disconnect
…onnections When a permitted connection is initiated by Portmaster itself, clear the write flag on the classify result so subsequent filters in the sublayer chain cannot override the permit action.
…hes in Device struct
Contributor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis change extends the Windows kernel driver with split-tunnel redirect support by introducing a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Windows kernel extension (kext) changes that prepare the driver for split-tunneling support:
RedirectSplitTunnelverdict — adds the routing primitive needed to steer selected traffic to the split-tunnel proxy.Changes
feat(kext): track owner PID of connected user-space processDevicestruct gains anAtomicU32 owner_pidfield — written once onIRP_MJ_CREATE, cleared onIRP_MJ_CLEANUP. Lock-free reads are safe from callout context.IRP_MJ_CREATE/IRP_MJ_CLEANUPdispatch routines registered inentry.rs(driver_create/driver_cleanup).CreateRequestandCleanupRequestIRP wrapper types added towdk/src/irp_helpers.rs.PsGetCurrentProcessIdFFI binding added towdk/src/ffi.rs.feat(kext): bypass downstream filters for Portmaster's own outbound connectionsfeat(kext): add RedirectSplitTunnel verdictVerdict::RedirectSplitTunnel = 11to the verdict enum inconnection.rs, mapped to the new well-known portPM_SPLIT_TUN_PORT = 719.is_own_packet()extended with matchingRedirectSplitTunnelarms.Notes / Follow-ups
RedirectSplitTunnelverdicts is not yet merged — this PR only adds the kext-side handling.Summary by CodeRabbit
Release Notes
New Features
Documentation