Commit 5e99ea7
authored
Add support for multi-process port sharing with CIBIR. (#5798)
## Description
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
## Potential options to allow for multi-process port sharing:
- **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.
## Option chosen: 1
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.
## What changed
- 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
## Port protection options
- 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.
## Testing
A new DataPathTest was added.
## Documentation
Settings.md1 parent cbfea02 commit 5e99ea7
27 files changed
Lines changed: 862 additions & 632 deletions
File tree
- docs
- src
- core
- generated/linux
- inc
- manifest
- platform
- unittest
- test/lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6721 | 6721 | | |
6722 | 6722 | | |
6723 | 6723 | | |
6724 | | - | |
| 6724 | + | |
6725 | 6725 | | |
6726 | | - | |
| 6726 | + | |
6727 | 6727 | | |
6728 | | - | |
| 6728 | + | |
| 6729 | + | |
| 6730 | + | |
| 6731 | + | |
6729 | 6732 | | |
6730 | 6733 | | |
6731 | 6734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | | - | |
| 838 | + | |
839 | 839 | | |
840 | | - | |
| 840 | + | |
841 | 841 | | |
842 | | - | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
843 | 846 | | |
844 | 847 | | |
845 | 848 | | |
| |||
885 | 888 | | |
886 | 889 | | |
887 | 890 | | |
888 | | - | |
889 | | - | |
| 891 | + | |
| 892 | + | |
890 | 893 | | |
891 | 894 | | |
892 | | - | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
893 | 899 | | |
894 | 900 | | |
895 | 901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
856 | | - | |
857 | | - | |
| 856 | + | |
| 857 | + | |
858 | 858 | | |
859 | | - | |
| 859 | + | |
860 | 860 | | |
861 | | - | |
| 861 | + | |
862 | 862 | | |
863 | | - | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
864 | 867 | | |
865 | 868 | | |
866 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
867 | 873 | | |
868 | | - | |
869 | | - | |
870 | | - | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
871 | 877 | | |
872 | 878 | | |
873 | 879 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
915 | | - | |
916 | | - | |
| 915 | + | |
| 916 | + | |
917 | 917 | | |
918 | | - | |
| 918 | + | |
919 | 919 | | |
920 | | - | |
| 920 | + | |
921 | 921 | | |
922 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
923 | 926 | | |
924 | 927 | | |
925 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
926 | 932 | | |
927 | | - | |
| 933 | + | |
928 | 934 | | |
929 | 935 | | |
930 | 936 | | |
931 | | - | |
| 937 | + | |
| 938 | + | |
932 | 939 | | |
933 | 940 | | |
934 | 941 | | |
935 | 942 | | |
| 943 | + | |
936 | 944 | | |
937 | 945 | | |
938 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
162 | 208 | | |
163 | 209 | | |
164 | 210 | | |
| |||
0 commit comments