WINTUN example user space app?

Simon Rozman simon at rozman.si
Wed Mar 11 10:55:32 CET 2020


Hi,

> In my case, I need to take packets - encapsulate them into a serial
> protocol and send them to a radio, Then - take packets from the radio
> and pump them back into the network stack.
> It is sort of like SLIP ... but its not...
>
> For me - the above is trival on Linux, but.. my challenge is this
> statement:
>
> Site: https://git.zx2c4.com/wintun/about/
>
> >>> After loading the driver and creating a network interface the
> typical way using SetupAPI, open the NDIS device object associated with
> the PnPInstanceId, enabling all forms of file sharing:
>
> There are ENDLESS windows rabbit holes, and rat holes to go exploring...
> I just don't know the setup api that well.
>
> Is there a "full simple windows example app"  that I can use as a
> starting point?
>
> Something simplistic to start with, in C, C++ or C#
>
> a) Given an network interface name on the command line
> b) Opens that interface
> c) Prints to stdout the some of the packets it received.
> d) Possibly injects a few example packets, ie: send a ping to some
> address like Yahoo.com or something?

Long story short...

1. Installing the Wintun driver on your computer:
You have some options:
- install WireGuard, even if you don't plan to use it, just to get Wintun 
driver installed
- install WiX Toolset, adapt the sample MSI installer provided in the Wintun 
repo, build your own Wintun driver MSI installer (recommended)

2. Creating/deleting Wintun adapters:
To manage Wintun adapters on your system, checkout the 
https://github.com/Microsoft/Windows-driver-samples and build the setup\devcon 
utility. Invoke as "devcon install Wintun.inf Wintun". Get the Wintun.inf from 
the Wintun repo (ouch, you need colossal WDK installed to build the driver to 
spit out the final Wintun.inf). Once you get familiar with devcon, examine the 
devcon source code how it creates the adapter. You will notice it needs 
Wintun.inf file only to detect that the Wintun device is of the "NET" class.

3. Using Wintun adapters:
See the source snippets in https://git.zx2c4.com/wintun/about/.

This is the general big picture.

Good luck and once you have particular technical details to discuss, feel free 
to ask.

Regards,
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4919 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20200311/492d1412/attachment.p7s>


More information about the WireGuard mailing list