projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6f7cce6
)
Make sure (at least) the MinGW device driver works.
author
Guus Sliepen
<guus@tinc-vpn.org>
Tue, 29 Jul 2003 12:38:49 +0000
(12:38 +0000)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Tue, 29 Jul 2003 12:38:49 +0000
(12:38 +0000)
src/mingw/device.c
patch
|
blob
|
history
diff --git
a/src/mingw/device.c
b/src/mingw/device.c
index
e49ab99
..
d005a63
100644
(file)
--- a/
src/mingw/device.c
+++ b/
src/mingw/device.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.
4 2003/07/29 11:06:23
guus Exp $
+ $Id: device.c,v 1.1.2.
5 2003/07/29 12:38:49
guus Exp $
*/
#include "system.h"
*/
#include "system.h"
@@
-90,26
+90,24
@@
bool setup_device(void)
if(RegEnumKeyEx(key, i, adapterid, &len, 0, 0, 0, NULL))
break;
if(RegEnumKeyEx(key, i, adapterid, &len, 0, 0, 0, NULL))
break;
- if(device) {
- if(!strcmp(device, adapterid)) {
- found = true;
- break;
- } else
- continue;
- }
-
/* Find out more about this adapter */
snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", REG_CONTROL_NET, adapterid);
/* Find out more about this adapter */
snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", REG_CONTROL_NET, adapterid);
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, regpath, 0, KEY_READ, &key2)) {
- logger(LOG_ERR, _("Unable to read registry"));
- return false;
- }
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, regpath, 0, KEY_READ, &key2))
+ continue;
len = sizeof(adaptername);
RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len);
len = sizeof(adaptername);
RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len);
+ if(device) {
+ if(!strcmp(device, adapterid)) {
+ found = true;
+ break;
+ } else
+ continue;
+ }
+
if(iface) {
if(!strcmp(iface, adaptername)) {
found = true;
if(iface) {
if(!strcmp(iface, adaptername)) {
found = true;
@@
-148,7
+146,7
@@
bool setup_device(void)
/* Get MAC address from tap device */
/* Get MAC address from tap device */
- if(DeviceIoControl(device_fd, TAP_IOCTL_GET_MAC, mymac.x, sizeof(mymac.x), mymac.x, sizeof(mymac.x), &len, 0)) {
+ if(
!
DeviceIoControl(device_fd, TAP_IOCTL_GET_MAC, mymac.x, sizeof(mymac.x), mymac.x, sizeof(mymac.x), &len, 0)) {
logger(LOG_ERR, _("Could not get MAC address from Windows tap device!"));
return false;
}
logger(LOG_ERR, _("Could not get MAC address from Windows tap device!"));
return false;
}
@@
-157,9
+155,6
@@
bool setup_device(void)
overwrite_mac = 1;
}
overwrite_mac = 1;
}
- if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
- iface = device;
-
device_info = _("Windows tap device");
logger(LOG_INFO, _("%s (%s) is a %s"), device, iface, device_info);
device_info = _("Windows tap device");
logger(LOG_INFO, _("%s (%s) is a %s"), device, iface, device_info);
@@
-176,7
+171,7
@@
void close_device(void)
bool read_packet(vpn_packet_t *packet)
{
bool read_packet(vpn_packet_t *packet)
{
-
int
lenin;
+
long
lenin;
cp();
cp();
@@
-198,7
+193,7
@@
bool read_packet(vpn_packet_t *packet)
bool write_packet(vpn_packet_t *packet)
{
bool write_packet(vpn_packet_t *packet)
{
-
int
lenout;
+
long
lenout;
cp();
cp();