summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index d4b1a73c1..4ac605b54 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -293,7 +293,21 @@ class Interface:
# Assemble command executed on system. Unfortunately there is no way
# to up/down an interface via sysfs
cmd = 'ip link set dev {} {}'.format(self._ifname, state)
- return self._cmd(cmd)
+ tmp = self._cmd(cmd)
+
+ # better safe then sorry - wait until the interface is really up
+ # but only for a given period of time to avoid potential deadlocks!
+ cnt = 0
+ while self.get_state() != state:
+ cnt += 1
+ if cnt == 50:
+ print('Interface {} could not be brought up in time ...'.format(self._ifname))
+ break
+
+ # sleep 250ms
+ sleep(0.250)
+
+ return tmp
def set_proxy_arp(self, enable):
"""