Opened 13 years ago

Closed 9 years ago

#93 closed Bug / Defect (fixed)

"up-restart" incomplete environment variables

Reported by: dandu Owned by: Samuli Seppänen
Priority: major Milestone: release 2.3.7
Component: Generic / unclassified Version: OpenVPN 2.3.2 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords: up restart scripts
Cc: JJK

Description

The "up-restart" script is called with some of the environment variables missing compared to what the "up" script is called with. Most important missing variables would be "ifconfig_local", "ifconfig_remote". Others are missing too in my tests, like "route_gateway", "route_net_gateway", "route_netmask" and "route_vpn_gateway", but with more complex server configs there could be others too.

Change History (10)

comment:1 Changed 13 years ago by JJK

Keywords: up up-restart added

I can confirm this bug. It seems caused by the fact that 'close_instance' is called during the restart process. This function cleans up the existing env vars before restarting. The ifconfig_* vars are not set again when openvpn comes up. Affected env vars (at least):

ifconfig_local
ifconfig_remote
ifconfig_netmask
ifconfig_broadcast

OpenVPN 2.1.4 is also affected by this.

comment:2 Changed 11 years ago by Samuli Seppänen

Keywords: restart scripts added; up-restart removed

In all likeliness this issue still persists in 2.3.1. Can somebody reproduce this?

comment:3 Changed 10 years ago by fredrik_wendt

I can confirm that I'm affected by this bug, which is marked as an upstream bug in Ubuntu's Launchpad: https://bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/280160

The workaround is to apply the short script supplied in comment 19 in the Launchpad bug report.

openvpn --version
OpenVPN 2.3.2 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Jul 12 2013

comment:4 Changed 10 years ago by Samuli Seppänen

Version: 2.1.0 / 2.1.12.3.2

comment:5 Changed 10 years ago by Gert Döring

Cc: JJK added
Milestone: release 2.3.3

Janjust, can you come up with a patch? (Since you already investigated...)

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

Milestone: release 2.3.3release 2.3.5

Patch?

comment:7 Changed 9 years ago by Gert Döring

Milestone: release 2.3.5release 2.3.7

comment:8 Changed 9 years ago by Gert Döring

Owner: set to Samuli Seppänen
Status: newassigned

nobody volunteered to actually look into the code, samuli was volunteered to poke janjust, and then maybe bump to 2.3.8...

comment:9 Changed 9 years ago by JJK

Problem still persists in 2.3/git. Working on a patch, will post it on the openvpn-devel list Real Soon Now (tm).

comment:10 Changed 9 years ago by Gert Döring

Resolution: fixed
Status: assignedclosed

After a bit of discussion on the list, we've decided on a dual approach:

  • ifconfig_* variables will be provided to --up-restart script
  • route/gateway related variables will not (because the benefit is questionable, and the implementation would not be trivial - the reason why they are not there is that the whole "add route" machinery is not run on restart, and the --up env-set is cleared after the initial run)
  • the differences between initial and restart runs are better documented in the man page

commit db950be85d37eab40d8fffe0bc2060059f8a7e10 (master)
commit 30256bede8f7ef6c82f1c2ed0d9f6c2177002926 (release/2.3)

Author: Jan Just Keijser
Date: Wed May 20 04:33:20 2015 +0200

patch for bug #93: up-restart env vars

has been pushed to git, and will be part of the upcoming 2.3.7 release.

Thanks, JanJust? for the code fix.

Note: See TracTickets for help on using tickets.