[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25378 - gnunet/src/vpn
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25378 - gnunet/src/vpn |
Date: |
Mon, 10 Dec 2012 21:42:31 +0100 |
Author: cfuchs
Date: 2012-12-10 21:42:31 +0100 (Mon, 10 Dec 2012)
New Revision: 25378
Modified:
gnunet/src/vpn/gnunet-helper-vpn-windows.c
Log:
added functionality to fetch the virtual interface's FriendlyName from
the registry. This information is needed for netsh later on.
Modified: gnunet/src/vpn/gnunet-helper-vpn-windows.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn-windows.c 2012-12-10 17:48:20 UTC (rev
25377)
+++ gnunet/src/vpn/gnunet-helper-vpn-windows.c 2012-12-10 20:42:31 UTC (rev
25378)
@@ -75,7 +75,12 @@
* hardware ID for our device.
*/
static TCHAR secondary_hwid[LINE_LEN / 2];
-
+
+/*
+ * Device's Friendly Name, used to identify a network device in netsh.
+ * eg: "TAP-Windows Adapter V9 #4"
+ */
+static TCHAR device_friendly_name[LINE_LEN / 2];
/**
* This is our own local instance of a virtual network interface
* It is (somewhat) equivalent to using tun/tap in unixoid systems
@@ -191,7 +196,6 @@
}
}
-
/**
* Setup a new virtual interface to use for tunneling.
*
@@ -256,7 +260,7 @@
return FALSE;
DeviceNode.cbSize = sizeof (SP_DEVINFO_DATA);
- if (!SetupDiCreateDeviceInfo (DeviceInfo,
+ if (! SetupDiCreateDeviceInfo (DeviceInfo,
class,
&guid,
NULL,
@@ -274,12 +278,24 @@
return FALSE;
/* Install our new class(=device) into the system */
- if (SetupDiCallClassInstaller (DIF_REGISTERDEVICE,
+ if (! SetupDiCallClassInstaller (DIF_REGISTERDEVICE,
DeviceInfo,
&DeviceNode))
- return TRUE;
+ return FALSE;
- return FALSE;
+ /* Now, pull the device device's FriendlyName off the registry. */
+ if ( !SetupDiGetDeviceRegistryProperty(DeviceInfo,
+ (PSP_DEVINFO_DATA) & DeviceNode,
+ SPDRP_FRIENDLYNAME,
+ NULL,
+ (LPBYTE)device_friendly_name,
+ LINE_LEN / 2,
+ NULL) || strlen(device_friendly_name) < 1){
+ return FALSE;
+ }
+ device_friendly_name[LINE_LEN / 2 - 1] = _T("\0");
+
+ return TRUE;
}
@@ -341,13 +357,12 @@
return -1;
}
- if (FALSE == setup_interface()){
+ if (! setup_interface()){
errno = ENODEV;
return -1;
}
-
return fd;
}
@@ -383,7 +398,7 @@
*
* @param argc must be 6
* @param argv 0: binary name (gnunet-helper-vpn)
- * 1: tunnel interface name (gnunet-vpn) (unused, can be used as
additional HWID in the future)
+ * 1: tunnel interface name (gnunet-vpn)
* 2: IPv6 address (::1), "-" to disable
* 3: IPv6 netmask length in bits (64), ignored if #2 is "-"
* 4: IPv4 address (1.2.3.4), "-" to disable
@@ -473,6 +488,7 @@
//run (fd_tun);
global_ret = 0;
cleanup:
- //close (fd_tun);
+ remove_interface();
+
return global_ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25378 - gnunet/src/vpn,
gnunet <=