Opened 7 years ago
Closed 21 months ago
#875 closed Bug / Defect (fixed)
ERROR: netsh command failed: returned error code 1
Reported by: | hildeb | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | release 2.5 |
Component: | Generic / unclassified | Version: | OpenVPN 2.4.0 (Community Ed) |
Severity: | Not set (select this one, unless your'e a OpenVPN developer) | Keywords: | 2.4.1 netsh.exe |
Cc: | Selva Nair |
Description
I haven't seen this bug before. Connection is being established, but in the end I'm getting:
Thu Apr 13 15:23:43 2017 NETSH: C:\Windows\system32\netsh.exe interface ip set address LAN-Verbindung 3 dhcp
Thu Apr 13 15:23:43 2017 ERROR: netsh command failed: returned error code 1
Three times ("LAN-Verbindung 3" meaning "LAN Connection 3" in english). Whole log attached.
Attachments (1)
Change History (5)
Changed 7 years ago by
Attachment: | charite-mgojowy.log added |
---|
comment:1 Changed 7 years ago by
Cc: | Selva Nair added |
---|
You have a knack for finding interesting (and well-hidden) spider-webs... :-)
This code is run if OpenVPN notices that the tap adapter is not set to use DHCP, to re-enable DHCP (and then poke the to-be-set IP address into the TAP adapter, so it can play DHCP server).
Without checking very closely, I assume that openvpn is run with interactive service, so openvpn.exe does not have the necessary privileges to do what it tries, and thus fails. (I dimly remember that we've had this before in another ticket, but can't remember the details... @selva, can you?)
comment:2 Changed 7 years ago by
Yes, this has to be due to dhcp disabled in the adapter and openvpn started using interactive service. As @cron2 said, it did come up in the past: See Trac #823
As suggested there we better implement dhcp mode setting through interactive service. Though not relevant here, also mutate --ip-win32 netsh to ipapi so that a run as admin with that option will not disable dhcp.
As a quick fix, set the adapter to use dhcp and reconnect:
netsh.exe int ip set addr "LAN-Verbindung 3" dhcp
from an elevated cmd prompt will do it.
comment:4 Changed 21 months ago by
Milestone: | → release 2.5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
so what's the state of affairs with this one? Have we moved this "re-enable DHCP" functionality to iservice, or does it still require openvpn.exe to run as admin?
My git log finds this commit
commit b4fc8bbd6b1d0211dd6982c4accedfbe4ae7e3ed
Author: Selva Nair <selva.nair@…>
Date: Tue Oct 2 16:01:13 2018 -0400
Enable dhcp on tap adapter using interactive service
Currently, if dhcp on the TAP interface is disabled, OpenVPN
on Windows tries to enable it using netsh but that succeeds only when
run with admin privileges.
When interactive service is available, delegate this task to the
service.
... so I claim this bug has been fixed :-) (git tag says "this is in 2.5.0 and up").
Log file