Re: [et-mgmt-tools] [PATCH] check a MAC address format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Saori Fukuta wrote:
Hi,

When I install by virt-intall with invalid MAC address(e.g."--mac=AA:"),
virt-install get an error message that says "unable to connect to
host:Connection refused(111)".

So, here's the patch adds to check a MAC address with following format:
    xx:xx:xx:xx:xx:xx ( xx should be in hexadecimal )

Signed-off-by: Saori Fukuta <fukuta.saori@xxxxxxxxxxxxxx>

Thanks,
Saori Fukuta.

Index: virtinst-0.101.0/virtinst/Guest.py
===================================================================
--- Guest.py    2007-02-21 05:26:23.000000000 +0900
+++ Guest.py.mac        2007-02-26 11:54:51.000000000 +0900
@@ -141,6 +141,10 @@ class XenDisk(VirtualDisk):

 class VirtualNetworkInterface:
     def __init__(self, macaddr = None, bridge = None):
+        if macaddr is not None:
+            form = re.match("^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$",macaddr)
+            if form is None:
+                raise ValueError, "Invalid value for MAC address"
         self.macaddr = macaddr
         self.bridge = bridge


I have applied this, thanks!
--Hugh

--
Red Hat Virtualization Group http://redhat.com/virtualization
Hugh Brock           | virt-manager http://virt-manager.org
hbrock@xxxxxxxxxx    | virtualization library http://libvirt.org


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux