Skip to content

[CP] Add support for multiprocess sharing + Fix a QTIP xdp bug (#5798) (#5747) (#5395)#6050

Merged
ProjectsByJackHe merged 8 commits into
release/2.5from
jacke/CP-cibir
Jun 3, 2026
Merged

[CP] Add support for multiprocess sharing + Fix a QTIP xdp bug (#5798) (#5747) (#5395)#6050
ProjectsByJackHe merged 8 commits into
release/2.5from
jacke/CP-cibir

Conversation

@ProjectsByJackHe
Copy link
Copy Markdown
Contributor

Description

Cherry picking:

#5798

and

#5747

Testing

CI

Documentation

No

ProjectsByJackHe and others added 2 commits May 29, 2026 14:55
Since the XDP datapath is initialized on a "best-effort" basis, it will
fall back to normal OS sockets whenever there is an issue with creating
the XDP datapath.

One check that it does is whether or not we previously have already
created the same datapath on the same IP/port for local/remote. The
assumption is, we already hooked into XDP and it's already snooping on
the same IP/port, no need to do it again. It will fall back to using
normal OS sockets.

This is misleading because when using QTIP, it is possible that a client
machine has connections bound to the same ephemeral port, except the
difference is it's UDP/TCP. Previously, this was not possible as MsQuic
is using either ALL QTIP, or None at all.

Fixes #5718

<img width="3997" height="2507" alt="image"
src="https://github.com/user-attachments/assets/8497efd7-5cd3-4502-9282-8d60b35fc352"
/>

NOTE:
On any machine, either ALL listeners have QTIP enabled or all of them
have them disabled.
This is controlled via the GLOBAL MsQuic settings.

It's only client connections that can vary this on a per-connection
basis with local settings.

Logs from CI.

QTIP.md

---------

Co-authored-by: Guillaume Hetier <guhetier@microsoft.com>
Co-authored-by: Michael Friesen <3517159+mtfriesen@users.noreply.github.com>
Fixes #5795

The XDP datapath can be configured to intercept packets based on QUIC
Connection ID instead of local port.
This behavior existed in MsQuic but was not heavily exercised until
recently.
One issue was that MsQuic always attempted to reserve UDP / TCP sockets
for each application server process.
But for multiple server processes that may want to share a single port,
we would run into port collision errors.
This PR adds support for CIBIR across multiple processes on the same
port and document the behavior

- **Option 1:** MsQuic delegates port protection to applications and
provides best practice recommendations.
> **Analysis:** Deferring the responsibility of port protection and
isolation to the application has the upside of enabling the most
potential scenarios but could also be a footgun.
- **Option 2:** MsQuic makes sure *some* persistent reservation exists
at a port.
> **Analysis:** Note that LookUpPersistentReservation does not require
admin privileges, but CreatePersistentReservation does require admin.
This is useful in that if any reservation exists on a port, we can
reasonably trust that an admin knew what they were doing when they
created it. safety, and ensure the consumers of CIBIR must know what
they are doing.
- **Option 3:** MsQuic creates per-proc sockets with SIO_CPU_AFFINITY,
but does not reserve the port.
> **Analysis:** If another unrelated app creates a socket with
SIO_CPU_AFFINITY, then they can bind to the CIBIR shared port. But for
all other apps, trying to bind a socket to a CIBIR port will result in a
collision.

MsQuic's stance is that the application takes responsibility for
book-keeping and protecting sharing shared local ports when using XDP +
CIBIR.

- Multiple MsQuic processes in Cibir+XDP mode can share a local port for
**server sockets only.**
- Applications should also not assume the shared port is safe from other
non-Msquic processes binding to it.
>MsQuic will NOT make an OS port reservation for server sockets when
CIBIR+XDP is enabled. Clients on the other hand, MsQuic will always make
OS port reservations.
- Applications using server sockets + CIBIR/XDP must specify a
well-known local port.

- Server sockets with XDP+CIBIR both enabled/available will skip OS port
reservation and OS socket creation to rely on XDP.
> any failures plumbing xdp rules will bubble up as a socket creation
error to the app. Can't fall back to OS sockets.
- Client sockets with XDP+CIBIR both enabled/available will still do OS
port reservation and socket creation but rely on XDP.
> any failures plumbing xdp rules will silently fall back to using OS
sockets. CIBIR transport negotiation can still work without XDP.
- Server sockets with CIBIR enabled but XDP not available/enabled will
do OS port reservation and fall back to OS sockets
- Client sockets with CIBIR enabled but XDP not available/enabled will
do OS port reservation and fall back to OS sockets

- Windows has the
https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-createpersistentudpportreservation
API, to allow sysadmins to pre-allocate a block of ports and disallow
other applications from binding to it.
- A well known CIBIR registry key can be used to detail shared ports,
and sysadmins can coordinate their system such that other apps will not
bind to those ports.
- ALE policies; applications can configure WFP to block certain ports
from being binded to by other apps.

A new DataPathTest was added.

Settings.md
@ProjectsByJackHe ProjectsByJackHe requested a review from a team as a code owner May 29, 2026 22:28
guhetier
guhetier previously approved these changes May 29, 2026
Copy link
Copy Markdown
Collaborator

@guhetier guhetier left a comment

Choose a reason for hiding this comment

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

nit: Consider cherry-picking PRs one at a time, it makes it easier to see changes in the release notes.

Comment thread src/test/lib/HandshakeTest.cpp Outdated
ProjectsByJackHe and others added 2 commits May 29, 2026 16:02
Remove stale ListenerPartitionIndexSet CLOG entries that were
cherry-picked from main but don't exist in the release/2.5 source.
Regenerate clog.sidecar to match current branch state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.74%. Comparing base (3e1a5c0) to head (765ec80).

Files with missing lines Patch % Lines
src/core/library.c 68.42% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (72.72%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@               Coverage Diff               @@
##           release/2.5    #6050      +/-   ##
===============================================
- Coverage        87.17%   86.74%   -0.43%     
===============================================
  Files               59       59              
  Lines            18212    18229      +17     
===============================================
- Hits             15876    15813      -63     
- Misses            2336     2416      +80     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Rules[RuleSize].Action = XDP_PROGRAM_ACTION_REDIRECT;
Rules[RuleSize].Redirect.TargetType = XDP_REDIRECT_TARGET_TYPE_XSK;
Rules[RuleSize].Redirect.Target = NULL;
Rules[RulesSize].Match = XDP_MATCH_UDP_DST;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You had to also cherry-pick !5395, basically, is that correct? Let's list in in the PR description / title so it is easy to map find it.

Copy link
Copy Markdown
Collaborator

@guhetier guhetier left a comment

Choose a reason for hiding this comment

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

Looks good assuming the ids of all 3 cherry-picked PRs are added to the title.

@ProjectsByJackHe ProjectsByJackHe changed the title [CP] Add support for multiprocess sharing + Fix a QTIP xdp bug [CP] Add support for multiprocess sharing + Fix a QTIP xdp bug (#5798) (#5747) (#5395) Jun 3, 2026
@ProjectsByJackHe ProjectsByJackHe merged commit 0efce2b into release/2.5 Jun 3, 2026
301 of 306 checks passed
@ProjectsByJackHe ProjectsByJackHe deleted the jacke/CP-cibir branch June 3, 2026 18:45
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