Opened 6 years ago

Closed 5 weeks 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)

charite-mgojowy.log (5.5 KB) - added by hildeb 6 years ago.
Log file

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by hildeb

Attachment: charite-mgojowy.log added

Log file

comment:1 Changed 6 years ago by Gert Döring

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 6 years ago by Selva Nair

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:3 Changed 6 years ago by tct

CC

comment:4 Changed 5 weeks ago by Gert Döring

Milestone: release 2.5
Resolution: fixed
Status: newclosed

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").

Note: See TracTickets for help on using tickets.