Skip to contentSkip to conversation

Catch bad vlan identifiers

PATCH New Stefan Berger 1 participant 1 message Sep 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Catch bad vlan identifiers

I am adding code to intercept badly formatted VLAN identifiers or those that are out of range.

xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py +9 -0
Index: root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py
===================================================================
@@ -862,6 +862,15 @@ def unify_resname(resource, mustexist=Tr
         if mustexist and not os.path.isfile(resfile):
             err("Invalid resource")
 
+    if typ == "vlan":
+        try:
+            vlan = int(resfile)
+            if vlan < 1 or vlan > 4095:
+                err("VLAN ID %d out of range." % vlan)
+        except Exception, e:
+            err("Invalid VLAN : %s" % resfile)
+
+
     #file: resources must be specified with absolute path
     #vlan resources don't start with '/'
     if typ != "vlan":

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel