Red Hat Bugzilla – Bug 1261432
net-dhcp-leases should return error when parse invalid mac
Last modified: 2016-11-03 14:23:50 EDT
Description of problem: net-dhcp-leases should return error when parse invalid mac Version-Release number of selected component (if applicable): libvirt-1.2.17-8.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. # virsh net-dhcp-leases default Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2015-09-09 19:07:34 52:54:00:18:95:1f ipv4 192.168.122.147/24 - - 2015-09-09 19:07:41 52:54:00:40:2b:42 ipv4 192.168.122.217/24 test - 2. # virsh net-dhcp-leases default --mac invalid Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 3. Actual results: as in step 2 Expected results: return error when pass invalid mac address to option "--mac" Additional info:
*** This bug has been marked as a duplicate of bug 1281707 ***
Upstream patch: https://www.redhat.com/archives/libvir-list/2015-December/msg00095.html
Fixed upstream by: commit 1e6d87bdfc801d2c006a17054bd19273430dce14 Author: Ján Tomko <jtomko@redhat.com> CommitDate: 2015-12-03 10:15:22 +0100 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 git describe: v1.3.0-rc1-3-g1e6d87b
verified on libvirt-1.3.1-1.el7.x86_64, the result is as expected. [root@work tmp]# virsh net-dhcp-leases default Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2016-02-23 17:55:31 52:54:00:1b:6f:e5 ipv4 192.168.122.159/24 - - 2016-02-23 17:32:43 52:54:00:ed:89:bc ipv4 192.168.122.176/24 yalan-PC 01:52:54:00:ed:89:bc [root@work tmp]# virsh net-dhcp-leases default --mac invalid error: Failed to get leases info for default error: invalid MAC address: invalid
Tried more invalid mac address, the result is as expected. The mac should be dotted hexadecimal and 16 characters in all. [root@work tmp]# virsh net-dhcp-leases default '52:54:00:ed:89:fg' error: Failed to get leases info for default error: invalid MAC address: 52:54:00:ed:89:fg [root@work tmp]# virsh net-dhcp-leases default --mac " 52:54:00:ed:89:bc" error: Failed to get leases info for default error: invalid MAC address: 52:54:00:ed:89:bc [root@work tmp]# virsh net-dhcp-leases default --mac 52-54-00-ed-89-bc error: Failed to get leases info for default error: invalid MAC address: 52-54-00-ed-89-bc [root@work tmp]# virsh net-dhcp-leases default --mac 52:54:00:ed:89 error: Failed to get leases info for default error: invalid MAC address: 52:54:00:ed:89 check a valid mac: [root@work tmp]# virsh net-dhcp-leases default --mac "52:54:00:ed:89:bc" Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2016-02-23 18:29:59 52:54:00:ed:89:bc ipv4 192.168.122.176/24 yalan-PC 01:52:54:00:ed:89:bc
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html