]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
ifupdownmain: run up/down on manual interfaces, but ignore any errors. (closes #48)
authorJulien Fortin <julien@cumulusnetworks.com>
Wed, 20 Jun 2018 10:07:08 +0000 (12:07 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Wed, 20 Jun 2018 10:07:08 +0000 (12:07 +0200)
ifupdown changed its original behavior on "manual" address method:
https://salsa.debian.org/debian/ifupdown/commit/12d333d619013914aae7deafe45fb6191ff2fb2c

ifupdown2 needs to change it's behavior too.

Reported-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Co-authored-by: Alexandre Derumier <aderumier@odiso.com>
Co-authored-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
debian/changelog
ifupdown2/ifupdown/ifupdownmain.py

index 6aff7fe36ef7f0cecca7290d81ff51373067328f..e6570a486c90ce4605b5ce3cdc8e7657dae52dd8 100644 (file)
@@ -2,13 +2,13 @@ ifupdown2 (1.2.0) UNRELEASED; urgency=medium
   * Package architecture refactoring and cleanups
   * Package can be build/install as debian, pip or rpm package
   * Makefile to easily perform tasks (i.e.: install, build, test, upload..)
+  * Closes #48: Run up/down on "manual" interfaces, but ignore any errors.
   * Closes #58: ifupdown2.conf: vlan_aware_bridge_address_support on/off
   * Traditional bridge support for mstpctl attr: (portautoedge, portrestrrole)
   * Configuration for IPv6 link-local auto-generate mode, new attributes:
         ipv6-addrgen (address addon)
         address-virtual-ipv6-addrgen (addressvirtual addon)
 
-
  -- Julien Fortin <julien@cumulusnetworks.com>  Fri, 15 Jun 2018 13:05:40 +0200
 
 ifupdown2 (1.1.18) RELEASED; urgency=medium
index ed0e155b294f86bd7eb8c94bfa323008ffe0dbb6..0633dc36ceefaaf73de687a7bc2b6830fc68f26b 100644 (file)
@@ -97,11 +97,6 @@ class ifupdownMain(ifupdownBase):
             (ifaceobj.link_privflags & ifaceLinkPrivFlags.VRF_SLAVE)):
             self._keep_link_down(ifaceobj)
             return
-        # if not a logical interface and addr method is manual,
-        # ignore link admin state changes
-        if (ifaceobj.addr_method == 'manual' and
-            not ifaceobj.link_kind):
-            return
         if self._delay_admin_state:
             self._delay_admin_state_iface_queue.append(ifaceobj.name)
             return
@@ -115,7 +110,13 @@ class ifupdownMain(ifupdownBase):
             return
         if self._keep_link_down(ifaceobj):
             return
-        self.link_up(ifaceobj.name)
+        try:
+            self.link_up(ifaceobj.name)
+        except:
+            if ifaceobj.addr_method == 'manual':
+                pass
+            else:
+                raise
 
     def _keep_link_down(self, ifaceobj):
         if ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
@@ -134,11 +135,6 @@ class ifupdownMain(ifupdownBase):
         # there is no real interface behind it
         if ifaceobj.type == ifaceType.BRIDGE_VLAN:
             return
-        # if not a logical interface and addr method is manual,
-        # ignore link admin state changes
-        if (ifaceobj.addr_method == 'manual' and
-            not ifaceobj.link_kind):
-            return
         if self._delay_admin_state:
             self._delay_admin_state_iface_queue.append(ifaceobj.name)
             return
@@ -150,7 +146,13 @@ class ifupdownMain(ifupdownBase):
            return
         if not self.link_exists(ifaceobj.name):
            return
-        self.link_down(ifaceobj.name)
+        try:
+            self.link_down(ifaceobj.name)
+        except:
+            if ifaceobj.addr_method == 'manual':
+                pass
+            else:
+                raise
 
     # ifupdown object interface operation handlers
     ops_handlers = OrderedDict([('up', run_up),
@@ -525,13 +527,6 @@ class ifupdownMain(ifupdownBase):
         ifaceobj.role = role
 
     def _set_iface_role_n_kind(self, ifaceobj, upperifaceobj):
-
-        # If addr_method is set and link is not a logical interface,
-        # set flag KEEP_LINK_DOWN. addr_method == 'manual' only applies to
-        # logical interfaces.
-        if (ifaceobj.addr_method == 'manual' and not ifaceobj.link_kind):
-            ifaceobj.link_privflags |= ifaceLinkPrivFlags.KEEP_LINK_DOWN
-
         if (upperifaceobj.link_kind & ifaceLinkKind.BOND):
             self._set_iface_role(ifaceobj, ifaceRole.SLAVE, upperifaceobj)
             ifaceobj.link_privflags |= ifaceLinkPrivFlags.BOND_SLAVE