By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,270 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,270 IT Pros & Developers. It's quick & easy.

Tun/Tap Driver using OpenVPN and DeviceIoControl

P: n/a
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\\drive rs\\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
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.