From 6bfea931ff290cb3cd100d872a96d7cebd7a6ee9 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Thu, 17 Nov 2016 18:52:29 +0100 Subject: [PATCH] batman_adv: Ignore non-existing batman interface when setting up batman iface. Previously a single non existing batman member interface could prevent the configuration of the batman interface. This patch makes sure only existing member interfaces will be considered when setting up the interface. Signed-off-by: Maximilian Wilhelm --- addons/batman_adv.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/batman_adv.py b/addons/batman_adv.py index 5b40381..18bb5f5 100644 --- a/addons/batman_adv.py +++ b/addons/batman_adv.py @@ -125,14 +125,20 @@ class batman_adv (moduleBase): def _up (self, ifaceobj): - batman_ifaces = self._get_batman_ifaces (ifaceobj) - if batman_ifaces == None: + if self._get_batman_ifaces (ifaceobj) == None: raise Exception ('could not determine batman interfacaes') # Verify existance of batman interfaces (should be present already) - for iface in batman_ifaces: + batman_ifaces = [] + for iface in self._get_batman_ifaces (ifaceobj): if not self.ipcmd.link_exists (iface): - raise Exception ('batman iface %s not present' % iface) + self.logger.warn ('batman iface %s not present' % iface) + continue + + batman_ifaces.append (iface) + + if len (batman_ifaces) == 0: + raise Exception ("None of the configured batman interfaces are available!") if_ignore_re = self._get_batman_ifaces_ignore_regex (ifaceobj) # Is the batman main interface already present?