From: Stefan Berger Subject: [PATCH] [ACM/Xend] Catch bad vlan identifiers Date: Mon, 22 Sep 2008 15:33:18 -0400 Message-ID: <1222111998.7382.2.camel@gsal-3.watson.ibm.com> Reply-To: stefanb@us.ibm.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-J9oKi9V95/qgxbFp36H5" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-J9oKi9V95/qgxbFp36H5 Content-Type: text/plain Content-Transfer-Encoding: 7bit I am adding code to intercept badly formatted VLAN identifiers or those that are out of range. Signed-off-by: Stefan Berger --=-J9oKi9V95/qgxbFp36H5 Content-Disposition: attachment; filename=catch_vlan_out_of_range.diff Content-Type: text/x-patch; name=catch_vlan_out_of_range.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py +++ 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": --=-J9oKi9V95/qgxbFp36H5 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-J9oKi9V95/qgxbFp36H5--