Tun/Tap Driver using OpenVPN and DeviceIoControl

Discussion in 'Python' started by Andrew, May 23, 2008.

  1. Andrew

    Andrew Guest

    Hello I am trying to port some code and I am running into some issues I
    may or may not be able to solve on my own and would appreciate your help

    Basically I am trying to open the Tun Driver through openvpn in Ether
    (Tap mode).

    code is as follows

    f = win32file.CreateFile("C:\\WINDOWS\\System32\\drivers\\tunmp.sys",
    GENERIC_READ, 0, None, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
    if WINDOWS:
    ifs = win32file.DeviceIoControl(f, TUNSETIFF,
    struct.pack("16sH", "wj%d", TUNMODE), 0, None)
    else:
    ifs = ioctl(f, TUNSETIFF, struct.pack("16sH", "wj%d", TUNMODE))
    ifname = ifs[:16].strip("\x00")
    print "Interface %s created. Configure it and use it" % ifname

    but does not seem to work so well I get "The Paramater is incorrect"

    Traceback (most recent call last):
    File "wifi.py", line 167, in <module>
    ifs = win32file.DeviceIoControl(f, TUNSETIFF, struct.pack("16sH",
    "wj%d", TU
    NMODE), 0, None)
    pywintypes.error: (87, 'DeviceIoControl', 'The parameter is incorrect.')


    Would appreciate any help

    Ty
     
    Andrew, May 23, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JROBINSON
    Replies:
    1
    Views:
    373
  2. Praveen

    CONfiguring TOMCAT to tun PHP

    Praveen, Apr 13, 2005, in forum: Java
    Replies:
    0
    Views:
    4,167
    Praveen
    Apr 13, 2005
  3. Andre
    Replies:
    1
    Views:
    370
  4. Jim
    Replies:
    2
    Views:
    589
  5. Marty Ryba
    Replies:
    6
    Views:
    604
    Marty Ryba
    Aug 19, 2008
Loading...

Share This Page