Bug 1469718 - ifaddresses() method disregards ipv4 link local addresses.
ifaddresses() method disregards ipv4 link local addresses.
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-netifaces (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Petr Vobornik
Namita Soman
Depends On:
  Show dependency treegraph
Reported: 2017-07-11 13:42 EDT by Andrei Stepanov
Modified: 2017-08-11 07:35 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Andrei Stepanov 2017-07-11 13:42:13 EDT
Documentations says:

        Obtain information about the specified network interface.
        Returns a dict whose keys are equal to the address family constants,
        e.g. netifaces.AF_INET, and whose values are a list of addresses in
        that family that are attached to the network interface.

There is a bug with this method. It ignores IP4LL addresses: https://en.wikipedia.org/wiki/Link-local_address#IPv4

rpm -qf /usr/lib64/python2.7/site-packages/netifaces.so

How reproducible: always.

Steps to Reproduce:
1. Assign to an interface ip4ll address.

You can assign ip4ll address in 2 ways:

Create connection with NetworkManager that has type "autoip" or you can install RPM package avahi-autoipd, and assign IP4LL address with next command:

avahi-autoipd --force-bind enp0s25
Found user 'avahi-autoipd' (UID 170) and group 'avahi-autoipd' (GID 170).
Successfully called chroot().
Successfully dropped root privileges.
Starting with address
Callout BIND, address on interface enp0s25
Successfully claimed IP address
(open other terminal)

2. Check with 'ip' command that interface has ip4ll address:

ip addr show dev enp0s25

2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 54:ee:75:37:4a:d6 brd ff:ff:ff:ff:ff:ff
    inet brd scope link enp0s25:avahi
       valid_lft forever preferred_lft forever
    inet 10.xx.xx.xx/24 brd scope global dynamic enp0s25
       valid_lft 69642sec preferred_lft 69642sec
    inet6 2620:52:0:2b0c:56ee:75ff:fe37:4ad6/64 scope global noprefixroute dynamic 
       valid_lft 2591541sec preferred_lft 604341sec
    inet6 fe80::56ee:75ff:fe37:4ad6/64 scope link 
       valid_lft forever preferred_lft forever

3. Get all addresses with netifaces.ifaddresses():

python -c 'import netifaces, pprint; pprint.pprint(netifaces.ifaddresses("enp0s25"));'
{2: [{'addr': '10.xx.xx.xx',
      'broadcast': '10.xx.xx.xx',
      'netmask': ''}],
 10: [{'addr': '2620:52:0:2b0c:56ee:75ff:fe37:4ad6',
       'netmask': 'ffff:ffff:ffff:ffff::'},
      {'addr': 'fe80::56ee:75ff:fe37:4ad6%enp0s25',
       'netmask': 'ffff:ffff:ffff:ffff::'}],
 17: [{'addr': '54:ee:75:37:4a:d6', 'broadcast': 'ff:ff:ff:ff:ff:ff'}]}

Actual results: As you can see list, there is no entry for address.

Expected results: must be in the dictionary.

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