From 5859b3228e063aacff3ca159605652b9f4799400 Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Fri, 19 Aug 2016 11:09:57 -0700 Subject: [PATCH] addons: bridge: fix running_vids value when cache is stale Ticket: CM-12552 Reviewed By: julien, nikhil Testing Done: tested with failing config with bridge-access 1 This is similar to the fix done in the below commit for pvid: "5061730ea5bf ("addons: bridge: fix default pvid handling in cases where cache is stale")" easier steps to reproduce: - have a vlan aware bridge with more than one ports - add 'bridge-access 1' to one of the ports - boot the box with the config - check that the vlans are fine - ifdown - ifreload -a - the interface with bridge_access 1 does not have the pvid flag on vlan 1 This patch makes sure we assume the right running vid and pvid value ie [1] and 1 if the cache returns no values. vid = [1] and pvid = 1 are the kernel default/initial values for a port. Signed-off-by: Roopa Prabhu --- addons/bridge.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/bridge.py b/addons/bridge.py index a3d0519..85db316 100644 --- a/addons/bridge.py +++ b/addons/bridge.py @@ -882,17 +882,21 @@ class bridge(moduleBase): (running_vids, running_pvid) = self._get_running_vids_n_pvid( bportifaceobj.name) - if running_vids: - (vids_to_del, vids_to_add) = \ - self._diff_vids(vids_to_add, running_vids) - - if not running_pvid: + if not running_vids and not running_pvid: # There cannot be a no running pvid. # It might just not be in our cache: # this can happen if at the time we were # creating the bridge vlan cache, the port - # was not part of the bridge + # was not part of the bridge. And we need + # to make sure both vids and pvid is not in + # the cache, to declare that our cache may + # be stale. running_pvid = 1 + running_vids = [1] + + if running_vids: + (vids_to_del, vids_to_add) = \ + self._diff_vids(vids_to_add, running_vids) if running_pvid: if running_pvid != pvid_int and running_pvid != 0: