RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1261432 - net-dhcp-leases should return error when parse invalid mac
Summary: net-dhcp-leases should return error when parse invalid mac
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-09 10:20 UTC by Shanzhi Yu
Modified: 2016-11-03 18:23 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:23:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Shanzhi Yu 2015-09-09 10:20:58 UTC
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 12:53:11 UTC

*** This bug has been marked as a duplicate of bug 1281707 ***

Comment 2 Ján Tomko 2015-12-03 10:04:34 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2015-December/msg00095.html

Comment 3 Ján Tomko 2015-12-03 12:55:32 UTC
Fixed upstream by:
commit 1e6d87bdfc801d2c006a17054bd19273430dce14
Author:     Ján Tomko <jtomko>
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 09:07:10 UTC
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 10:31:31 UTC
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 18:23:50 UTC
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.