Changeset e59aaa


Ignore:
Timestamp:
06/14/09 21:50:35 (3 years ago)
Author:
Erik Ekman <yarrick@…>
Branches:
master
Children:
8fc8ce
Parents:
f20b3c
git-author:
Erik Ekman <yarrick@…> (06/14/09 21:50:35)
git-committer:
Erik Ekman <erik@…> (02/04/12 20:34:02)
Message:

Fixed #47, support any TAP device name

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r6ac35c re59aaa  
    8820xx-xx-xx: x.y.z 
    99        - Fixed tunnel not working on Windows. 
     10        - Any device name is now supported on Windows, fixes #47. 
    1011 
    11122009-06-01: 0.5.2 "WifiFree" 
  • README-win32.txt

    r894ca2 re59aaa  
    16162. Have one TAP32 interface installed 
    1717 
    18 3. Name the interface "dns" 
     183. Make sure the interface does not have a default gateway set 
    1919 
    20 4. Make sure the interface does not have a default gateway set 
    21  
    22 5. Run iodine/iodined as normal (see the main README file). 
     204. Run iodine/iodined as normal (see the main README file). 
    2321   You may have to run it as administrator depending on user privileges. 
    2422 
    25 6. Enjoy! 
     235. Enjoy! 
    2624 
    2725 
     
    5149The following fixable limitations apply: 
    5250- Exactly one TAP32 interface must be installed 
    53 - The TAP32 interface must be named "dns" and be version 0801 or 0901 
    5451- Server cannot read packet destination address 
    5552 
  • src/iodine.c

    rf20b3c re59aaa  
    741741 
    742742                if(r > 0) { 
    743                         len = read(dns_fd, in, sizeof(in)); 
     743                        /* recv() needed for windows, dont change to read() */ 
     744                        len = recv(dns_fd, in, sizeof(in), 0); 
    744745                        if (len >= (17 + RAW_HDR_LEN)) { 
    745746                                char hash[16]; 
  • src/tun.c

    r96ee6f re59aaa  
    3838 
    3939#define TAP_ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 
     40#define NETWORK_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 
    4041#define TAP_DEVICE_SPACE "\\\\.\\Global\\" 
    4142#define TAP_VERSION_ID_0801 "tap0801" 
     
    5455#include "common.h" 
    5556 
    56 char if_name[50]; 
     57char if_name[250]; 
    5758 
    5859#ifndef WINDOWS32 
     
    228229} 
    229230 
     231static void 
     232get_name(char *dev_name) 
     233{ 
     234        char path[256]; 
     235        char name_str[256] = "Name"; 
     236        LONG status; 
     237        HKEY conn_key; 
     238        DWORD len; 
     239        DWORD datatype; 
     240 
     241        memset(if_name, 0, sizeof(if_name)); 
     242 
     243        snprintf(path, sizeof(path), NETWORK_KEY "\\%s\\Connection", dev_name); 
     244        status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, path, 0, KEY_READ, &conn_key); 
     245        printf("%s ?? %s\n", path, dev_name); 
     246        if (status != ERROR_SUCCESS) { 
     247                fprintf(stderr, "Could not look up name of interface %s: error opening key\n", dev_name); 
     248                RegCloseKey(conn_key); 
     249                return; 
     250        } 
     251        len = sizeof(if_name); 
     252        status = RegQueryValueEx(conn_key, name_str, NULL, &datatype, (LPBYTE)if_name, &len); 
     253        if (status != ERROR_SUCCESS || datatype != REG_SZ) { 
     254                fprintf(stderr, "Could not look up name of interface %s: error reading value\n", dev_name); 
     255                RegCloseKey(conn_key); 
     256                return; 
     257        } 
     258        RegCloseKey(conn_key); 
     259} 
     260 
    230261DWORD WINAPI tun_reader(LPVOID arg) 
    231262{ 
     
    266297        memset(adapter, 0, sizeof(adapter)); 
    267298        get_device(adapter, sizeof(adapter)); 
    268  
    269         if (strlen(adapter) == 0) { 
     299        get_name(adapter); /* Copies interface 'human name' to if_name */ 
     300 
     301        if (strlen(adapter) == 0 || strlen(if_name) == 0) { 
    270302                warnx("No TAP adapters found. See README-win32.txt for help.\n"); 
    271303                return -1; 
     
    278310                return -1; 
    279311        } 
    280  
    281         /* TODO get name of interface */ 
    282         strncpy(if_name, "dns", MIN(4, sizeof(if_name))); 
    283312 
    284313        /* Use a UDP connection to forward packets from tun, 
Note: See TracChangeset for help on using the changeset viewer.