Blame

8fb58d Samuli Seppänen 2025-02-27 12:41:07 1
# Tapctl Network Interface Management Utility
2
3
## Introduction
4
5
The Tapctl or ``tapctl.exe`` is a command line utility introduced in OpenVPN 2.5 to manage TAP network interfaces on Windows. It was developed to replace the ``tapinstall.exe`` utility.
6
7
8
## User Manual
9
10
The Tapctl utility requires elevation. Please, run it from an elevated command prompt (Run as Administrator).
11
12
13
### Creating a TAP/TUN network interface
14
15
Usage:
16
17
tapctl create [--name <desired interface name>]
18
19
A new virtual network interface is created.
20
21
When the ``--name`` parameter is omitted, Windows selects a name automatically (e.g. "Ethernet 2").
22
23
When the ``--name`` parameter is specified, the utility will rename the newly created interface to the name given. Should the interface with the given name already exist, an error is returned. If the name contains spaces, enclose it in quotes.
24
25
Upon successful creation, the newly created interface's GUID is output to stdout.
26
27
Notes:
28
1. The name specified using ``--name`` parameter can also be specified as OpenVPN's ``--dev-node`` option.
29
1. Tapctl does not install or update TAP-Windows driver. It assumes the driver is already installed. The TAP-Windows NDIS 6 driver is installed as a part of OpenVPN MSI setup or may be installed manually using the INF file.
30
31
32
### Listing installed TAP interfaces
33
34
Usage:
35
36
tapctl list
37
38
This command prints installed TAP network interfaces to stdout. The list will contain interface GUIDs and names.
39
40
### Removing a TAP interface
41
42
Usage:
43
44
tapctl delete <interface GUID | interface name>
45
46
Deletes the specified TAP interface.
47
48
## Developer Notes
49
50
The Tapctl utility was developed to compile using Microsoft Visual Studio 2017 and later upgraded to support building as a part of the OpenVPN-build system.
51
52
### Source files
53
54
`basic.h`
55
56
Basic macro declarations
57
58
`error.c` and `error.h`
59
60
OpenVPN compatible error reporting API. Though the Tapctl utility does not rely on ``openvpn.exe``'s source code, it borrows the run-time information output scheme from it. This tries to keep the source code style and best practices as close to OpenVPN as possible.
61
62
`main.c`
63
64
Main utility logic. It also includes implementation of ``msg()`` function to output any messages to stdout and stderr.
65
66
`tap.c` and `tap.h`
67
68
Windows network interface management functions. All definitions in ``tap.h`` include description and usage instructions in a Doxygen form.
69
70
Except the `main.c`, all of these source files are reused by the `openvpnmsica` DLL.