Re: [Openvpn-devel] [PATCH] tapctl: add optional "hardware id" parameter

2019-09-23 Thread Simon Rozman
Hi,

LGTM

Best regards,
Simon

> -Original Message-
> From: Lev Stipakov 
> Sent: Monday, September 23, 2019 11:08 AM
> To: openvpn-devel@lists.sourceforge.net
> Subject: [Openvpn-devel] [PATCH] tapctl: add optional "hardware id"
> parameter
> 
> From: Lev Stipakov 
> 
> If parameter is not specified, default value "root\tap0901"
> is used.
> 
> This enables tapctl to work with different tun drivers, like "tapoas"
> (from OpenVPN Connect) or "wintun".
> 
> Signed-off-by: Lev Stipakov 


smime.p7s
Description: S/MIME cryptographic signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH] tapctl: add optional "hardware id" parameter

2019-09-23 Thread Lev Stipakov
From: Lev Stipakov 

If parameter is not specified, default value "root\tap0901"
is used.

This enables tapctl to work with different tun drivers,
like "tapoas" (from OpenVPN Connect) or "wintun".

Signed-off-by: Lev Stipakov 
---
 src/openvpnmsica/msica_op.c | 10 +-
 src/openvpnmsica/openvpnmsica.c |  2 +-
 src/tapctl/main.c   | 37 +
 src/tapctl/tap.c| 24 ++--
 src/tapctl/tap.h| 10 ++
 5 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/src/openvpnmsica/msica_op.c b/src/openvpnmsica/msica_op.c
index 3b9878d..63aa6c8 100644
--- a/src/openvpnmsica/msica_op.c
+++ b/src/openvpnmsica/msica_op.c
@@ -446,7 +446,7 @@ msica_op_tap_interface_create_exec(
 
 /* Get all available network interfaces. */
 struct tap_interface_node *pInterfaceList = NULL;
-DWORD dwResult = tap_list_interfaces(NULL, , TRUE);
+DWORD dwResult = tap_list_interfaces(NULL, NULL, , TRUE);
 if (dwResult == ERROR_SUCCESS)
 {
 /* Does interface exist? */
@@ -457,7 +457,7 @@ msica_op_tap_interface_create_exec(
 /* No interface with a same name found. Create one. */
 BOOL bRebootRequired = FALSE;
 GUID guidInterface;
-dwResult = tap_create_interface(NULL, NULL, , 
);
+dwResult = tap_create_interface(NULL, NULL, NULL, 
, );
 if (dwResult == ERROR_SUCCESS)
 {
 /* Set interface name. */
@@ -601,7 +601,7 @@ msica_op_tap_interface_delete_by_name_exec(
 
 /* Get available TUN/TAP interfaces. */
 struct tap_interface_node *pInterfaceList = NULL;
-DWORD dwResult = tap_list_interfaces(NULL, , FALSE);
+DWORD dwResult = tap_list_interfaces(NULL, NULL, , FALSE);
 if (dwResult == ERROR_SUCCESS)
 {
 /* Does interface exist? */
@@ -659,7 +659,7 @@ msica_op_tap_interface_delete_by_guid_exec(
 
 /* Get all available interfaces. */
 struct tap_interface_node *pInterfaceList = NULL;
-DWORD dwResult = tap_list_interfaces(NULL, , TRUE);
+DWORD dwResult = tap_list_interfaces(NULL, NULL, , TRUE);
 if (dwResult == ERROR_SUCCESS)
 {
 /* Does interface exist? */
@@ -718,7 +718,7 @@ msica_op_tap_interface_set_name_exec(
 
 /* Get all available network interfaces. */
 struct tap_interface_node *pInterfaceList = NULL;
-DWORD dwResult = tap_list_interfaces(NULL, , TRUE);
+DWORD dwResult = tap_list_interfaces(NULL, NULL, , TRUE);
 if (dwResult == ERROR_SUCCESS)
 {
 /* Does interface exist? */
diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c
index f5ad229..16381ea 100644
--- a/src/openvpnmsica/openvpnmsica.c
+++ b/src/openvpnmsica/openvpnmsica.c
@@ -478,7 +478,7 @@ FindTAPInterfaces(_In_ MSIHANDLE hInstall)
 
 /* Get all TUN/TAP network interfaces. */
 struct tap_interface_node *pInterfaceList = NULL;
-uiResult = tap_list_interfaces(NULL, , FALSE);
+uiResult = tap_list_interfaces(NULL, NULL, , FALSE);
 if (uiResult != ERROR_SUCCESS)
 {
 goto cleanup_CoInitialize;
diff --git a/src/tapctl/main.c b/src/tapctl/main.c
index 04c03dd..bf21586 100644
--- a/src/tapctl/main.c
+++ b/src/tapctl/main.c
@@ -81,7 +81,9 @@ static const TCHAR usage_message_create[] =
 TEXT("   specified, a default interface name is chosen by 
Windows.   \n")
 TEXT("   Note: This name can also be specified as OpenVPN's 
--dev-node   \n")
 TEXT("   option.   
  \n")
-TEXT("\n")
+TEXT("--hwid   Interface hardware id. Default value is 
root\\tap0901, which\n")
+TEXT("   describes tap-windows6 driver. To work with wintun 
driver,  \n")
+TEXT("   specify 'wintun'. 
  \n")
 TEXT("Output:\n")
 TEXT("\n")
 TEXT("This command prints newly created TUN/TAP interface's GUID to 
stdout.  \n")
@@ -96,6 +98,11 @@ static const TCHAR usage_message_list[] =
 TEXT("\n")
 TEXT("tapctl list\n")
 TEXT("\n")
+TEXT("Options:\n")
+TEXT("\n")
+TEXT("--hwid   Interface hardware id. Default value is 
root\\tap0901, which\n")
+TEXT("   describes tap-windows6 driver. To work with wintun 
driver,  \n")
+TEXT("   specify 'wintun'. 
  \n")
 TEXT("Output:\n")
 TEXT("\n")
 TEXT("This command prints all TUN/TAP interfaces to stdout.
  \n")
@@ -170,6 +177,7 @@ _tmain(int argc, LPCTSTR argv[])
 else if (_tcsicmp(argv[1], TEXT("create")) == 0)
 {
 LPCTSTR szName = NULL;
+LPCTSTR szHwId = NULL;
 
 /* Parse options. */
 for (int i = 2; i < argc; i++)
@@ -179,6 +187,11 @@ _tmain(int argc, LPCTSTR argv[])