Bug 1261432 - net-dhcp-leases should return error when parse invalid mac
net-dhcp-leases should return error when parse invalid mac
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Ján Tomko
Virtualization Bugs
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-09 06:20 EDT by Shanzhi Yu
Modified: 2016-11-03 14:23 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:23:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Shanzhi Yu 2015-09-09 06:20:58 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:
Comment 1 Jaroslav Suchanek 2015-11-26 07:53:11 EST

*** This bug has been marked as a duplicate of bug 1281707 ***
Comment 2 Ján Tomko 2015-12-03 05:04:34 EST
Upstream patch:
https://www.redhat.com/archives/libvir-list/2015-December/msg00095.html
Comment 3 Ján Tomko 2015-12-03 07:55:32 EST
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
Comment 5 yalzhang@redhat.com 2016-02-23 04:07:10 EST
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
Comment 6 yalzhang@redhat.com 2016-02-26 05:31:31 EST
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
Comment 9 errata-xmlrpc 2016-11-03 14:23:50 EDT
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

Note You need to log in before you can comment on or make changes to this bug.