aboutsummaryrefslogtreecommitdiffstats
path: root/installer (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-08-22README: clarify spinningJason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-05Use WiX directly rather than via WiX's MSBuildSimon Rozman6-105/+48
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-05Dynamically gather signtool full pathJason A. Donenfeld3-2/+7
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-05Unify XML empty-element spacingSimon Rozman3-41/+41
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-04Version bump0.6Jason A. Donenfeld1-2/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-04Use performance counter for less spinningJason A. Donenfeld1-5/+5
Previously we had to spin for a minimum of 15ms because the tick interval is 156250 on NT. On linux, usually trips to the high performance timers are discouraged because if they don't hit the RDTSC path (due to being unstable or the like), they hit more expensive hardware. I assume that's probably the same on NT, but all of tcpip.sys and ndis.sys uses the performance counters too, so what are we going to do? Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-04Spin less and more efficientlyJason A. Donenfeld3-6/+7
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-03GetCurrentProcessToken() is Win8+, so open our own tokenJason A. Donenfeld1-5/+15
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Shorten READMEJason A. Donenfeld1-72/+3
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Free interface list when aborting in installerJason A. Donenfeld1-1/+4
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Document how to get file handleJason A. Donenfeld1-19/+48
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Cleanup NBL reference countingSimon Rozman1-39/+25
The Empty event state is now set according to Ctx->Device.Receive.ActiveNbls.Head != NULL. But, we still have to clear the Empty event inside the TransitionLock to prevent race with TunPause(). Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-02Skip packet on NBL allocation failure properlySimon Rozman1-0/+2
Should NBL allocation persist to fail, the receive ring could eventually fill up as there will be no TunReturnNetBufferLists() calls to advance its head. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-02Version bump0.5Jason A. Donenfeld1-2/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Rearrange README and add additional MSM infoJason A. Donenfeld1-73/+90
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Do not rebuild driver on installer library buildJason A. Donenfeld1-3/+3
This commit is in many ways wrong, but when we're dealing with whql imports, there's often a large gap in time, and it's useful to be able to just restore everything exactly how it was prior and then build only installer.dll and the msm. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Use reference counter and KEVENT instead of remove locksSimon Rozman1-12/+9
Driver verifier doesn't like re-initializing remove locks. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-02Rearrange comment to make clang-format happyJason A. Donenfeld1-2/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Disable APC when taking rwlockJason A. Donenfeld1-0/+6
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Unify driver input file listSimon Rozman1-4/+7
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-02Resolve SDV reported "defect"Simon Rozman3-1/+5
NdisMGetDeviceProperty() should always return non-NULL FunctionalDeviceObject according to _Outptr_opt_. An explicit FunctionalDeviceObject NULL check has been added to keep the SDV happy and not calling our driver "defective". Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-02Add SDVView targetSimon Rozman1-1/+4
This invokes SDV GUI for easier review of SDV reported defects. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-02Separate out atomic helpersJason A. Donenfeld5-65/+71
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02Rewrite installer logic in CJason A. Donenfeld21-196/+1552
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-31Use explicit running boolean and use set instead of exchangeJason A. Donenfeld1-24/+31
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-31Assert that adapter is always running when client is registering ringsSimon Rozman1-0/+2
By attaching to NDIS device instead of creating our own device for I/O, the adapter is always running before client is able to connect and register rings. NDIS also won't allow adapter to pause with connected clients. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-31Cleanup TUN_FLAGS_PRESENTSimon Rozman1-8/+2
With no PnP notifications and custom surprise removal code we do not need the TUN_FLAGS_PRESENT any more. The traffic is stopped when handle is closed or adapter is somehow paused. Though by reusing the NDIS device for our I/O, the adapter will not be able to pause with a client connected. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-31Add handle closing ioctlJason A. Donenfeld5-11/+131
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-31Reinitialize active NBL remove lock to allow adapter reuseSimon Rozman1-1/+3
Before the TunProcessReceiveData() thread terminates or adapter is paused, we wait for all receive NBLs to be returned. Unfortunately, IoReleaseRemoveLockAndWait() leaves the remove lock in non reusable state. To be able to start receiving packets on existing adapter again, we (re)initialize the remove lock on ring registration or adapter resume. The former addresses TunProcessReceiveData()'s IoReleaseRemoveLockAndWait() call, the later addresses the TunPause()'s. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-19Compile on 32-bit and arm64Jason A. Donenfeld1-6/+8
No popcnt intrinsic on arm, no PopulationCount64 function on 32bit. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-19Use more specific IOCTL codeJason A. Donenfeld2-3/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18Require the usual SDDL_DEVOBJ_SYS_ALL permissionsJason A. Donenfeld1-36/+96
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18Make receiving NBLs asynchronousSimon Rozman1-26/+105
This commit moves NBL post-processing (moving ring head, releasing NBL) to MINIPORT_RETURN_NET_BUFFER_LISTS handler. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-18Minimize TransitionLock when receiving packetsSimon Rozman1-13/+11
We do not need to share-lock the TransitionLock for the whole life of receiver thread. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-18Fix insane coding styleJason A. Donenfeld1-2/+2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18Fix awkward comment styleJason A. Donenfeld1-3/+3
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18Do not hijack PNP notifierJason A. Donenfeld1-35/+1
We no longer pend send-side NBLs, so we don't have a real use for this. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18Switch to paged dispatch handlersJason A. Donenfeld1-4/+7
We're not totally sure this is kosher, unfortunately. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18Minimize TransitionLock when sending packetsSimon Rozman1-7/+9
We do not need to share-lock the TransitionLock for complete NBL chain. This commit should improve better state transition response, thou until NDIS is sending a single NBL per MINIPORT_SEND_NET_BUFFER_LISTS call, this should not have a considerable effect. Since the skibNbl: call of NdisMSendNetBufferListsComplete() is made inside the TransactionLock at dispatch IRQL, a dispatch IRQL hint was added to the NdisMSendNetBufferListsComplete() call. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-18Piggy-back on top of NDIS' device object instead of adding our ownJason A. Donenfeld6-333/+86
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-17README: clarify ring usageJason A. Donenfeld1-32/+41
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-17Replace TUN_FLAGS_CONNECTED by an eventSimon Rozman1-18/+18
On client closing the handle there is a potential race if somebody resets the TailMoved event of receive ring at the right time. Rather than rely on TailMoved event, we introduce our own Disconnected notification event and have the receive thread wait on both. The Disconnected event is also usable as TUN_FLAGS_CONNECTED substitute. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-17Improve lock retention when sendingSimon Rozman1-44/+123
NDIS may call MINIPORT_SEND_NET_BUFFER_LISTS from parallel threads to queue as many packets as fast as possible. Initial implementation of ring buffers used a spin lock to completely serialize sending packets making it sub-optimal and burning large amount of CPU. This commit uses locked section to allocate space for packet(s) in the ring. It copies the packets unlocked, then it locks again to adjust the ring tail. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-17Spin for a bit before falling back to event objectJason A. Donenfeld1-8/+31
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-16Switch to ring buffers for exchanging packetsSimon Rozman3-846/+495
This demonstrates the use of ring buffers in its simplest, purest form. No performance optimizations were made. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-09README: correct path of deviceJason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reported-by: Shay Sharon <Shay.Sharon@audiocodes.com>
2019-07-08Rename remaining status -> Status and ctx -> CtxSimon Rozman1-19/+19
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-05Remove TunMapIrpJason A. Donenfeld1-28/+8
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-05Simplify ActiveNblCount decrementJason A. Donenfeld1-12/+7
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-05Rename NBL -> NblOdd Stranne1-34/+34
Signed-off-by: Odd Stranne <odd@mullvad.net>