ia64/xen-unstable

changeset 19437:f86ebd7f887a

xend: Disallow bogus MAC addresses when creating new VIF devices

Signed-off-by: Michal Novotny <minovotn@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 11:12:39 2009 +0100 (2009-03-31)
parents 1f8e6aca0868
children 453ebb3279e8
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 31 11:10:06 2009 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 31 11:12:39 2009 +0100
     1.3 @@ -723,6 +723,13 @@ class XendDomainInfo:
     1.4          dev_config_dict = self.info['devices'][dev_uuid][1]
     1.5          log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
     1.6  
     1.7 +        if dev_type == 'vif':
     1.8 +            for x in dev_config:
     1.9 +                if x != 'vif' and x[0] == 'mac':
    1.10 +                    if not re.match('^([0-9a-f]{2}:){5}[0-9a-f]{2}$', x[1], re.I):
    1.11 +                        log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1])
    1.12 +                        raise VmError("Cannot create a new virtual network interface - MAC address is not valid!");
    1.13 +
    1.14          if self.domid is not None:
    1.15              try:
    1.16                  dev_config_dict['devid'] = devid = \