Instead of comparing garbage strings against real MAC addresses, introduce an error mesage for unparsable ones: $ virsh net-dhcp-leases default --mac t12 error: Failed to get leases info for default error: invalid MAC address: t12 https://bugzilla.redhat.com/show_bug.cgi?id=1261432 --- src/network/bridge_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a0f6494..362e294 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3648,9 +3648,16 @@ networkGetDHCPLeases(virNetworkPtr network, virNetworkDHCPLeasePtr lease = NULL; virNetworkDHCPLeasePtr *leases_ret = NULL; virNetworkObjPtr obj; + virMacAddr mac_addr; virCheckFlags(0, -1); + /* only to check if the MAC is valid */ + if (mac && virMacAddrParse(mac, &mac_addr) < 0) { + virReportError(VIR_ERR_INVALID_MAC, "%s", mac); + return -1; + } + if (!(obj = networkObjFromNetwork(network))) return -1; -- 2.4.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list