From b6aa1e7f3fb40cea11813dad53b50aeeb28fc74e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 16 Feb 2020 10:15:36 +0100 Subject: bond: T2030: fix incorrect delta calculation on member interfaces THe delta check/calculation always returned False on system startup leading to a non functioning bond interface after a reboot as no physical interface actually enslaved. This was fixed by not calculating the current enslaved interfaces from the existing config but rather retrieving the interfaces from sysfs. --- python/vyos/ifconfig.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'python/vyos/ifconfig.py') diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index b1f512785..b3683dc57 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1538,9 +1538,15 @@ class BondIf(VLANIf): >>> BondIf('bond0').get_slaves() ['eth1', 'eth2'] """ - slaves = self._read_sysfs('/sys/class/net/{}/bonding/slaves' - .format(self._ifname)) - return list(map(str, slaves.split())) + enslaved_ifs = [] + # retrieve real enslaved interfaces from OS kernel + sysfs_bond = '/sys/class/net/{}'.format(self._ifname) + if os.path.isdir(sysfs_bond): + for directory in os.listdir(): + if 'lower_' in directory: + enslaved_ifs.append(directory.replace('lower_','')) + + return enslaved_ifs def set_primary(self, interface): -- cgit v1.2.3