diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-09-13 21:51:24 +0000 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-09-13 21:51:24 +0000 |
commit | c331ee4f18e98b7063dc74e3d8b0ab556cff3a96 (patch) | |
tree | a567ce755b49b3302ea1503991cc86c9c5250c9e | |
parent | TODO: document TDI bugs (diff) | |
download | wireguard-nt-c331ee4f18e98b7063dc74e3d8b0ab556cff3a96.tar.xz wireguard-nt-c331ee4f18e98b7063dc74e3d8b0ab556cff3a96.zip |
driver: socket: bypass TDI entirely
Not only will this improve performance, but it will eliminate a big
issue with IP_PKTINFO.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | TODO.md | 4 | ||||
-rw-r--r-- | driver/socket.c | 12 |
2 files changed, 12 insertions, 4 deletions
@@ -28,10 +28,6 @@ mode -- the routing logic ignores `IP_PKTINFO`. This seems like a bug, but one unlikely to be fixed. We'll need a opt-in `setsockopt` to make `IP_PKTINFO` choose the right behavior in this case. -### TDI drivers never do the right thing with `IP_PKTINFO` -Windows only looks at Options/OptionsLength if UserBuffer==(PVOID)0x886103. -This is crazy, so nobody actually does it. - ## Bug workarounds ### Remove `_NO_CRT_STDIO_INLINE` once WDK is fixed diff --git a/driver/socket.c b/driver/socket.c index 11e402b..466daac 100644 --- a/driver/socket.c +++ b/driver/socket.c @@ -991,6 +991,18 @@ WskInit(VOID) if (!NT_SUCCESS(Status)) goto cleanupWskProviderNPI; + /* Ignore return value, as MSDN says eventually this will be removed. */ + ULONG NoTdi = WSK_TDI_BEHAVIOR_BYPASS_TDI; + WskProviderNpi.Dispatch->WskControlClient( + WskProviderNpi.Client, + WSK_TDI_BEHAVIOR, + sizeof(NoTdi), + &NoTdi, + 0, + NULL, + NULL, + NULL); + Status = NotifyRouteChange2(AF_INET, RouteNotification, &RoutingGenerationV4, FALSE, &RouteNotifierV4); if (!NT_SUCCESS(Status)) goto cleanupWskProviderNPI; |