]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: dhcp: Policy to wait for IPv6 link local address to be available
authorRajendra Dendukuri <rajendra.dendukuri@broadcom.com>
Tue, 11 Jun 2019 10:29:43 +0000 (06:29 -0400)
committerRajendra Dendukuri <rajendra.dendukuri@broadcom.com>
Tue, 11 Jun 2019 10:29:43 +0000 (06:29 -0400)
Rename the policy attribute as dhcp6-ll-wait.
Changed logic to reuse existing timeout variable to store user provided value.

ifupdown2/addons/dhcp.py

index c3c125ca1d79749c3f187b8550ecacef5ba82570..4d87f7cd7efd27dbd24dbfa0e4be12c0fa5fe8e9 100644 (file)
@@ -61,12 +61,12 @@ class dhcp(moduleBase):
             dhcp_wait = policymanager.policymanager_api.get_attr_default(
                 module_name=self.__class__.__name__, attr='dhcp-wait')
             wait = not str(dhcp_wait).lower() == "no"
-            inet6_ll_wait = policymanager.policymanager_api.get_iface_default(module_name=self.__class__.__name__, \
-                ifname=ifaceobj.name, attr='inet6-ll-wait')
+            dhcp6_ll_wait = policymanager.policymanager_api.get_iface_default(module_name=self.__class__.__name__, \
+                ifname=ifaceobj.name, attr='dhcp6-ll-wait')
             try:
-                ll_wait_time = int(inet6_ll_wait)
+                timeout = int(dhcp6_ll_wait)+1
             except:
-                ll_wait_time = 10
+                timeout = 10
                 pass
 
             vrf = ifaceobj.get_attr_value_first('vrf')
@@ -108,11 +108,8 @@ class dhcp(moduleBase):
                             pass
                     #add delay before starting IPv6 dhclient to
                     #make sure the configured interface/link is up.
-                    if ll_wait_time:
-                       timeout = ll_wait_time
+                    if timeout > 1:
                        time.sleep(1)
-                    else:
-                       timeout = ll_wait_time+1
 
                     while timeout:
                         addr_output = utils.exec_command('%s -6 addr show %s'