]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: bridge: bridge-access + bridge-vids on the same intf give a warning
authorJulien Fortin <julien@cumulusnetworks.com>
Mon, 31 Oct 2016 00:24:31 +0000 (01:24 +0100)
committerJulien Fortin <julien@cumulusnetworks.com>
Wed, 23 Nov 2016 03:54:38 +0000 (04:54 +0100)
Ticket: CM-12234
Reviewed By: Roopa, Nikhil G, Daniel
Testing Done:

auto tap0
iface tap0
      bridge-access 20
      bridge-vids 20

$ ifreload -a -s
warning: tap0: `bridge-access` and `bridge-vids` are not allowed on the same interface
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
addons/bridge.py

index 885300d977890e8f7035c0faa5a35a7f7f1ae401..51df0a7301831b6f81c533da7fe17d5cd9023e7f 100644 (file)
@@ -270,7 +270,16 @@ class bridge(moduleBase):
         self.warn_on_untagged_bridge_absence = should_warn == 'yes'
 
     def syntax_check(self, ifaceobj, ifaceobj_getfunc):
-        return self.check_bridge_vlan_aware_port(ifaceobj, ifaceobj_getfunc)
+        return (self.check_bridge_vlan_aware_port(ifaceobj, ifaceobj_getfunc)
+                and self.check_bridge_conflict_access_vids(ifaceobj))
+
+    def check_bridge_conflict_access_vids(self, ifaceobj):
+        if (ifaceobj.get_attr_value('bridge-access')
+                and ifaceobj.get_attr_value('bridge-vids')):
+            self.logger.warning('%s: `bridge-access` and `bridge-vids` are not '
+                                'allowed on the same interface' % ifaceobj.name)
+            return False
+        return True
 
     def check_bridge_vlan_aware_port(self, ifaceobj, ifaceobj_getfunc):
         if ifaceobj.link_privflags & ifaceLinkPrivFlags.BRIDGE_VLAN_AWARE: