Bug 1588336
| Summary: | "domifaddr --source arp" can not show correct netmask | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yalzhang <yalzhang> |
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
| Status: | CLOSED ERRATA | QA Contact: | chhu |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.6 | CC: | chhu, fjin, laine, lmen, xuzhang |
| Target Milestone: | rc | Keywords: | Upstream |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-4.5.0-1.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-10-30 09:55:54 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Not sure if this is a bug. The documentation says '--source arp' parses ARP table. However, ARP does not have any sense of netmask. Just try 'cat /proc/net/arp'. So maybe we only need to document that not every method is capable of fetching all data. I came here to say essentially what Michal just said above. There is one possibility for getting the info, but it could be a bit involed - from the arp table you can learn the interface where the MAC is reachable. If you then search through the IP addresses configured for that interface and find the one that "contains" the IP in the ARP entry within its network, you'll have the proper prefix/netmask. (Not saying we *should* go to all that trouble for a piece of information that will almost certainly never be used, but we *could*. Changing the documentation is much simpler, and probably of just as much value to the users). Yeah, since I don't think ARP source is that valuable/accurate as the other two sources (leases file and agent) I don't think it's worth fixing any more than documentation. Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2018-June/msg00931.html I've pushed the patch upstream:
commit d1605b5d99e847450a6cbbf752ae5dd76239b46f
Author: Michal Privoznik <mprivozn>
AuthorDate: Tue Jun 12 13:13:06 2018 +0200
Commit: Michal Privoznik <mprivozn>
CommitDate: Wed Jun 13 09:12:59 2018 +0200
lib: Document limitation of virDomainInterfaceAddresses
https://bugzilla.redhat.com/show_bug.cgi?id=1588336
This API takes @source argument which tells it where to get
domain IP addresses from. However, not all sources are capable of
providing all the information we report, for instance ARP table
has no notion of IP address prefixes. Document this limitation.
Signed-off-by: Michal Privoznik <mprivozn>
Reviewed-by: Laine Stump <laine>
v4.4.0-234-gd1605b5d99
Verified on packages: libvirt-4.5.0-9.el7.x86_64 libvirt-debuginfo-4.5.0-9.el7.x86_64 Test steps: 1. Install libvirt-debuginfo package 2. Check the libvirt source file: libvirt-domain.c line: 11805-11807 include the patch # cd /usr/src/debug/libvirt-4.5.0/src/ # grep -rn VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP * libvirt-domain.c:11799: * If @source is VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP, the host libvirt-domain.c:11806: * might be unset (e.g. VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP does not qemu/qemu_driver.c:20680: case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP: Set the bug status to "VERIFIED" 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://access.redhat.com/errata/RHSA-2018:3113 |
Description of problem: "domifaddr --source arp" can not show correct netmask Version-Release number of selected component (if applicable): libvirt-4.3.0-1.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. Start a vm with interface as below: <interface type='network'> <source network='default'/> </interface> # virsh start rhel 2. check the vm's ip address, it shows the netmask as "/0" which is not correct # virsh domifaddr rhel --source arp Name MAC address Protocol Address ------------------------------------------------------------------------------- vnet0 52:54:00:03:fa:7d ipv4 192.168.122.64/0 Actual results: "domifaddr --source arp" can not show the netmask as "/0", should be "/24" Expected results: should show the Address as "192.168.122.64/24" Additional info: # virsh domifaddr rhel --source lease Name MAC address Protocol Address ------------------------------------------------------------------------------- vnet0 52:54:00:03:fa:7d ipv4 192.168.122.64/24