From: Keir Fraser Date: Tue, 31 Mar 2009 10:12:39 +0000 (+0100) Subject: xend: Disallow bogus MAC addresses when creating new VIF devices X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13989^2~73 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=92f9c55a94519ce3f175dc4bec98078799d9e6aa;p=xen.git xend: Disallow bogus MAC addresses when creating new VIF devices Signed-off-by: Michal Novotny --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index ea68657c88..91be00e729 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -723,6 +723,13 @@ class XendDomainInfo: dev_config_dict = self.info['devices'][dev_uuid][1] log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict)) + if dev_type == 'vif': + for x in dev_config: + if x != 'vif' and x[0] == 'mac': + if not re.match('^([0-9a-f]{2}:){5}[0-9a-f]{2}$', x[1], re.I): + log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1]) + raise VmError("Cannot create a new virtual network interface - MAC address is not valid!"); + if self.domid is not None: try: dev_config_dict['devid'] = devid = \