aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2014-12-08 14:43:00 +0000
committerSteve McIntyre <steve.mcintyre@linaro.org>2014-12-08 14:43:00 +0000
commit57f459161350750714aad124213d0994900ce1b7 (patch)
tree64baf9bd3210e416176d6496efc62a0ec8952ba7 /db
parent9cd6c3ded5f25d54df06eeb674a2548d73651d45 (diff)
Validate VLAN tags on VLAN creation
Change-Id: Ic7a498cf6cf8c8f765691f4a495abec79bc960fb
Diffstat (limited to 'db')
-rw-r--r--db/db.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/db/db.py b/db/db.py
index 3e33133..b09cc0a 100644
--- a/db/db.py
+++ b/db/db.py
@@ -105,8 +105,13 @@ class VlanDB:
#
# Constraints:
# Names and tags must be unique
+ # Tags must be in the range 1-4095 (802.1q spec)
+ #
def create_vlan(self, name, tag, is_base_vlan):
+ if int(tag) < 1 or int(tag) > 4095:
+ raise InputError("VLAN tag %d is outside of the valid range (1-4095)" % int(tag)
+
vlan_id = self.get_vlan_id_by_name(name)
if vlan_id is not None:
raise InputError("VLAN name %s is already in use" % name)