summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-02-16 10:15:36 +0100
committerChristian Poessinger <christian@poessinger.com>2020-02-16 10:57:49 +0100
commitb6aa1e7f3fb40cea11813dad53b50aeeb28fc74e (patch)
treec78369e5260b119057fe4ea750b77ec597c5b310
parenteab44d2757b67fa8801e9bb147ccacd01b081f7d (diff)
downloadvyos-1x-b6aa1e7f3fb40cea11813dad53b50aeeb28fc74e.tar.gz
vyos-1x-b6aa1e7f3fb40cea11813dad53b50aeeb28fc74e.zip
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.
-rw-r--r--python/vyos/ifconfig.py12
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py9
2 files changed, 16 insertions, 5 deletions
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):
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index 81574515f..6cdfb764c 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -208,8 +208,13 @@ def get_config():
# determine bond member interfaces (currently configured)
if conf.exists('member interface'):
bond['member'] = conf.return_values('member interface')
- eff_member = conf.return_effective_values('member interface')
- if not (bond['member'] == eff_member):
+
+ # We can not call conf.return_effective_values() as it would not work
+ # on reboots. Reboots/First boot will return that running config and
+ # saved config is the same, thus on a reboot the bond members will
+ # not be added all (https://phabricator.vyos.net/T2030)
+ live_members = BondIf(bond['intf']).get_slaves()
+ if not (bond['member'] == live_members):
bond['shutdown_required'] = True
# Primary device interface