Skip to contentSkip to conversation

bug with "ip-win32 netsh"

Openvpn-devel David TAILLANDIER 2 participants 2 messages Dec 6, 2012 – Dec 11, 2012

lore
Share & tools
lore
#0 lore raw

Windows 7 64bit OpenVPN 2.3_rc1 x86_64-w64-mingw32

If the client configuration file contains "ip-win32 netsh", OpenVPN issue the following system command :
c:\windows\system32\netsh.exe interface ip set address Local Area Connection 2 static 10.8.0.6 255.255.255.252

The command fails when the interface name contains spaces, so it must be surrounded by double-quotes : "Local Area Connection 2"

Workaround : rename the interface to something without spaces.

#1 lore raw

Hi,

Quoted 9 lines · David TAILLANDIER

Windows 7 64bit OpenVPN 2.3_rc1 x86_64-w64-mingw32

If the client configuration file contains "ip-win32 netsh", OpenVPN issue the following system command :
c:\windows\system32\netsh.exe interface ip set address Local Area Connection 2 static 10.8.0.6 255.255.255.252

The command fails when the interface name contains spaces, so it must be surrounded by double-quotes : "Local Area Connection 2"

Have you actually seen this fail *in openvpn's log*, or have you tried the command show in the log in cmd.exe, and seen it fail there?

The openvpn argv_printf/execve mechanics is... magic, so the interface name ends up in its own argv[] parameter towards netsh.exe, and quotes are not(!) needed - to the contrary, if you add quotes there, they become part of the interface name, and netsh will complain. Copy-pasting the command from the log to cmd.exe will not work, as cmd.exe would indeed need the quotes.

I've just checked the code - while I never used "ip-win32 netsh", I did the netsh calls for IPv6 routing, and they do not quotes either - and work great for interface names with blanks in them (my test system uses "My Tap Adapter").

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...