]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: addressvirtual: if system supports addr METRIC set skip route hack
authorJulien Fortin <julien@cumulusnetworks.com>
Mon, 18 Jun 2018 17:24:12 +0000 (19:24 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Tue, 19 Jun 2018 07:28:06 +0000 (09:28 +0200)
Now that some system support ip addr METRIC sets we dont have to do this
"fix_connected_route" hack. The hack was previously introduced to make
sure the primary address was the first in the routing table. Some events
could cause some issues like having the macvlan address first in the
routing table. In that case the macvlan needs to be flapped. This shouldn't
happen when we are able to set the address metric

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/addons/addressvirtual.py

index bf6531dcb35efb33330868e9b2be26c36c770c1d..1305e93e1c40ef9ce6edc2fd823ad5f907e37eb2 100644 (file)
@@ -258,8 +258,12 @@ class addressvirtual(moduleBase):
 
             # If link existed before, flap the link
             if not link_created:
-                self._fix_connected_route(ifaceobj, macvlan_ifacename,
-                                          ips[0])
+
+                if not self.ipcmd.addr_metric_support():
+                    # if the system doesn't support ip addr set METRIC
+                    # we need to do manually check the ordering of the ip4 routes
+                    self._fix_connected_route(ifaceobj, macvlan_ifacename, ips[0])
+
                 if update_mtu:
                     lower_iface_mtu = self.ipcmd.link_get_mtu(ifaceobj.name, refresh=True)
                     update_mtu = False