mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Add hack to flap macvlan dev if it already exists and if the route to
the vrr network is pointing to it Ticket: CM-4639 Reviewed By: Testing Done: Tested with interfaces file and steps from the bug This is a Hack to make sure the primary address is the first in the routing table. Its not a full proof solution. We use `ip route get` on the vrr network to see which device the kernel returns. if it is the mac vlan device, flap the macvlan device to adjust the routing table entry. flapping the macvlan device makes sure the macvlan connected route goes through delete + add, hence adjusting the order in the routing table.
This commit is contained in:
@@ -685,3 +685,16 @@ class iproute2(utilsBase):
|
||||
ret = False
|
||||
pass
|
||||
return ret
|
||||
|
||||
def ip_route_get_dev(self, prefix):
|
||||
try:
|
||||
output = self.exec_command('ip route get %s' %prefix)
|
||||
if output:
|
||||
rline = output.splitlines()[0]
|
||||
if rline:
|
||||
rattrs = rline.split()
|
||||
return rattrs[rattrs.index('dev') + 1]
|
||||
except Exception, e:
|
||||
self.logger.debug('ip_route_get_dev: failed .. %s' %str(e))
|
||||
pass
|
||||
return None
|
||||
|
Reference in New Issue
Block a user