aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* driver: allowedips: expand maximum node depthHEADmasterJason A. Donenfeld2023-12-112-12/+14
| | | | | | | | | | | | In the allowedips self-test, nodes are inserted into the tree, but it generated an even amount of nodes, but for checking maximum node depth, there is of course the root node, which makes the total number necessarily odd. With two few nodes added, it never triggered the maximum depth check like it should have. So, add 129 nodes instead of 128 nodes, and do so with a more straightforward scheme, starting with all the bits set, and shifting over one each time. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: header: add C++ enum manipulation operatorsSimon Rozman2022-03-301-0/+2
| | | | | | | | C++ doesn't have bitwise operators on enums by default. Rather than reinventing the wheel, we use an undocumented DEFINE_ENUM_FLAG_OPERATORS macro from Windows SDK to implement the enum operators. Signed-off-by: Simon Rozman <simon@rozman.si>
* proj: stop building for arm32Simon Rozman2021-10-212-4/+3
| | | | | | | | | | | | | This does not remove 32-bit ARM compilation support out of the project yet. Shipping of 32-bit ARM drivers became a real challenge: - Microsoft changed policy to prohibit EV-signed drivers - Attestation signing is not supported for this platform - Setting up Windows 8 ARM HCK to get WHQL certification requires a lot of effort if doable in 2021 at all. Signed-off-by: Simon Rozman <simon@rozman.si>
* driver: PEER_UPDATE is supposed to be UPDATE_ONLYJason A. Donenfeld2021-10-195-5/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump0.10.1Jason A. Donenfeld2021-10-161-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: main: avoid excessive function castJason A. Donenfeld2021-10-151-4/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* example: remove overly specific castsJason A. Donenfeld2021-10-151-12/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* README: add API referenceJason A. Donenfeld2021-10-141-1/+262
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: header: fix typoJason A. Donenfeld2021-10-141-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: use proper instance id boundsJason A. Donenfeld2021-10-146-11/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: handle cases explicitly in dev query callbackJason A. Donenfeld2021-10-141-5/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* downlevelshim: remove in preparation for full WHQLJason A. Donenfeld2021-10-137-159/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: driver: don't allocate for instance IDJason A. Donenfeld2021-10-122-31/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump0.10Jason A. Donenfeld2021-10-111-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* proj: remove SDV and DVL supportSimon Rozman2021-10-111-22/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: unify remaining poll loop formsJason A. Donenfeld2021-10-112-4/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: ensure file handle opens on win7Jason A. Donenfeld2021-10-111-7/+15
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: open devinst after arrival and skip stub on win8Jason A. Donenfeld2021-10-113-23/+43
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: replace INF Include/Needs hack with stub deviceJason A. Donenfeld2021-10-112-92/+81
| | | | | | | | | | | | Apparently breaking the guarantee of "Universal INF"s receives the big tsk tsk, so this commit is yet another way to set SuggestedInstanceId. We create an SwDevice, with DEVPKEY_Device_ClassGuid set to GUID_DEVCLASS_NET and an empty HWID, and then create the software regkey and add the keys we need. We then destroy the SwDevice, and recreate a new one with the same instance ID, this time with the proper parameters. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: cleanup ROOT\NET enumerated devices on DLL loadJason A. Donenfeld2021-10-113-0/+39
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: add icon to device managerJason A. Donenfeld2021-10-113-0/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: migrate to swdevice and rework entire apiJason A. Donenfeld2021-10-0625-2127/+2121
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: set suggested instance ID using INF instead of ourselvesJason A. Donenfeld2021-10-064-37/+113
| | | | | | This might allow us to more successfully move to using SwDevice. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: inf: remove Windows 9x regkeyJason A. Donenfeld2021-10-061-1/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: get rid of registry polling on Win8+Jason A. Donenfeld2021-10-067-343/+190
| | | | | | | Wait for the device to come up as enabled instead using the proper Win8+ API. Fall back to polling for Win7. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: logger: remove function prefixesJason A. Donenfeld2021-10-062-52/+30
| | | | | | | The strings are already unique, so prefixing function names adds nothing. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: treat reboot required as real errorJason A. Donenfeld2021-10-065-63/+40
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: check for errors before waiting on reg keysJason A. Donenfeld2021-10-061-40/+46
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: adapter: remove deadgwdetect settingJason A. Donenfeld2021-10-061-128/+2
| | | | | | It's unclear whether this registry key is still being respected. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: memory: help SDV with annotationJason A. Donenfeld2021-10-061-1/+3
| | | | | | | Presumably it's fighting with the _Post_nonnull_, so add an assumption statement. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: ioctl: remove force closing of handlesJason A. Donenfeld2021-10-063-123/+0
| | | | | | | | | | | | | | | | This driver has never actually made successful use of it, because we've been wrongly matching against the FunctionalDeviceObject instead of Stack->FileObject->DeviceObject. Yet, things seem to have worked fine enough because of smart notification to the logger thread. Furthermore, SwDevice calls halt immediately, because it constitutes a surprise removal, which means we don't really even have time for the fuse to go off. And finally, dereferencing Table[i]->Object can race with the destruction of that object, which is a UaF. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: ioctl: remove old pid checkJason A. Donenfeld2021-09-291-5/+1
| | | | | | | Since this is now a kernel thread, it doesn't make sense to compare to the current PID. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: socket: fix IRQL annotationsSimon Rozman2021-09-282-2/+2
| | | | | | | | By calling WskInit in SocketInit, the later must be run at passive IRQL. Actually, it is. This commit only updates the IRQL annotations accordingly. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: adapter: cleanup wintrust shim if install failsJason A. Donenfeld2021-09-281-6/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump0.9Jason A. Donenfeld2021-09-241-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: socket: defer WskInit until sockets are actually createdJason A. Donenfeld2021-09-243-80/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that MINIPORT_INITIALIZE can actually delay system load, and we currently have reports of people's systems hanging indefinitely. WskCaptureNPI is known to deadlock if called too early in boot (say, from DriverEntry of a PnP driver), but it was thought that MINIPORT_INITIALIZE was sufficiently late that it was okay. Perhaps that assumption is incorrect. In case it is, this patch moves WSK initialization to when sockets are created, which always happens in the context of a user thread, which naturally happens late in boot and can block. We know empirically that MINIPORT_INITIALIZE can block system boot, by adding a `KeDelayExecutionThread(KernelMode, FALSE, &(LARGE_INTEGER){ .QuadPart = -SEC_TO_SYS_TIME_UNITS(300) });` to the top and noting that boot takes 5 minutes longer. So the theory that the assumption is incorrect is at least plausible. All this commit does is move the call to WskInit() from InitializeEx in device.c to SocketInit() in socket.c. The diff looks more verbose than it is because making WskInit static and removing its forward declaration required shuffling some functions around in socket.c, but no code changed during that shuffle. Reported-by: Oliver Freyermuth <freyermuth@physik.uni-bonn.de> Reported-by: Joshua Sjoding <joshua.sjoding@scjalliance.com> Reported-by: John-Paul Andreini <jandreini@geonerco.com> Reported-by: Arlo Clauser <Arlo@starcubedesign.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: inf: remove useless LoadOrderGroupJason A. Donenfeld2021-09-241-1/+0
| | | | | | It's ignored for PnP drivers. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: queueing: don't wait on more than 64 cores at onceJason A. Donenfeld2021-09-231-34/+19
| | | | | | | | | | It turns out we can't wait on more than 64 handles at once, which happens on monster systems with 128 cores. So, split this into chunks. While we're at it, make both the normal and low-mem path use the same logic, with the low-mem path simply doing 3 threads at once. Reported-by: Joe Mulvihill <Joe.Mulvihill@Hardsuitlabs.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: socket: do not use zero UDPv4 checksumsJason A. Donenfeld2021-09-201-7/+0
| | | | | | | | | | Some routers using hardware NAT can't handle this. A packet goes through initially, but then once the flow is established and it's offloaded to the NAT hardware, the zero checksum causes most packets to be dropped. So, unfortunately, we have to remove this optimization. Reported-by: Christian Ã…rebrand <myspysgaddan@hotmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: remove _NO_CRT_STDIO_INLINE workaroundJason A. Donenfeld2021-09-162-3/+1
| | | | | | This was only present in 16.10. EWDK is at 16.9 and VS is now at 16.11. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: support MinGW in distributed headerJason A. Donenfeld2021-09-162-3/+22
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump0.8Jason A. Donenfeld2021-09-151-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: socket: bypass TDI entirelyJason A. Donenfeld2021-09-132-4/+12
| | | | | | | 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>
* TODO: document TDI bugsJason A. Donenfeld2021-09-131-0/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* README: mention Windows 11Jason A. Donenfeld2021-09-131-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump0.7Jason A. Donenfeld2021-09-121-1/+1
| | | | | | | This is the version that finally goes live by default to folks. Big deal! Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* TODO: bring up to speedJason A. Donenfeld2021-09-122-19/+19
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* driver: socket: use IP_OPTIONS for cmsg hackJason A. Donenfeld2021-09-101-14/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* example: disable dad for faster startupJason A. Donenfeld2021-09-101-6/+7
| | | | | | And set address after routes so that loopback works. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump0.6Jason A. Donenfeld2021-09-091-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>