From 214af997817f1856c8297a33b0b6ac3f7fb628b3 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 26 Sep 2019 21:40:57 +0200 Subject: openvpn: T1691: add artifical abort when waiting on interface --- src/conf_mode/interface-openvpn.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/conf_mode/interface-openvpn.py b/src/conf_mode/interface-openvpn.py index 57d565749..c91bc3900 100755 --- a/src/conf_mode/interface-openvpn.py +++ b/src/conf_mode/interface-openvpn.py @@ -903,8 +903,19 @@ def apply(openvpn): # better late then sorry ... but we can only set interface alias after # OpenVPN has been launched and created the interface + cnt = 0 while openvpn['intf'] not in interfaces(): - sleep(0.250) # 250ms + # If VPN tunnel can't be established because the peer/server isn't + # (temporarily) available, the vtun interface never becomes registered + # with the kernel, and the commit would hang if there is no bail out + # condition + cnt += 1 + if cnt == 50: + break + + # sleep 250ms + sleep(0.250) + Interface(openvpn['intf']).set_alias(openvpn['description']) return None -- cgit v1.2.3