mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
bridge: check for invalid MAC in networkGetDHCPLeases
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
This commit is contained in:
parent
d2e5538b16
commit
1e6d87bdfc
@ -3648,9 +3648,16 @@ networkGetDHCPLeases(virNetworkPtr network,
|
|||||||
virNetworkDHCPLeasePtr lease = NULL;
|
virNetworkDHCPLeasePtr lease = NULL;
|
||||||
virNetworkDHCPLeasePtr *leases_ret = NULL;
|
virNetworkDHCPLeasePtr *leases_ret = NULL;
|
||||||
virNetworkObjPtr obj;
|
virNetworkObjPtr obj;
|
||||||
|
virMacAddr mac_addr;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
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)))
|
if (!(obj = networkObjFromNetwork(network)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user