#7021 ipa-server-install failure on checking matching interfaces - invalid format of netmas
Closed: fixed 6 years ago Opened 6 years ago by pvoborni.

Installation of ipa-4-5 branch failed for me on F26 with

  File "/usr/lib/python2.7/site-packages/ipaserver/install/server/install.py", line 611, in install_check
    dns.install_check(False, api, False, options, host_name)
  File "/usr/lib/python2.7/site-packages/ipaserver/install/dns.py", line 269, in install_check
    util.no_matching_interface_for_ip_address_warning(ip_addresses)
  File "/usr/lib/python2.7/site-packages/ipalib/util.py", line 1135, in no_matching_interface_for_ip_address_warning
    if not ip.get_matching_interface():
  File "/usr/lib/python2.7/site-packages/ipapython/ipautil.py", line 217, in get_matching_interface
    netmask=ifdata['netmask']
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 933, in __init__
    implicit_prefix, flags)
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 810, in parse_ip_network
    mask = IPAddress(val2, module.version, flags=INET_PTON)
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 280, in __init__
    % self.__class__.__name__)

2017-06-16T07:36:25Z DEBUG The ipa-server-install command failed, exception: ValueError: IPAddress() does not support netmasks or subnet prefixes! See documentation for details.
2017-06-16T07:36:25Z ERROR IPAddress() does not support netmasks or subnet prefixes! See documentation for details.
2017-06-16T07:36:25Z ERROR The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information

after following patch, it completed successfully:

diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index a277ed8..2e3da15 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -205,17 +205,23 @@ class CheckedIPAddress(UnsafeIPAddress):
             )

         iface = None
+        root_logger.debug('Checking network interfaces')
         for interface in netifaces.interfaces():
             for ifdata in netifaces.ifaddresses(interface).get(family, []):
-
+                root_logger.debug(ifdata['addr'])
                 # link-local addresses contain '%suffix' that causes parse
                 # errors in IPNetwork
                 ifaddr = ifdata['addr'].split(u'%', 1)[0]

-                ifnet = netaddr.IPNetwork('{addr}/{netmask}'.format(
+                root_logger.debug(ifdata['netmask'])
+                netmask = ifdata['netmask'].split(u"/")[-1]
+
+                network = '{addr}/{netmask}'.format(
                     addr=ifaddr,
-                    netmask=ifdata['netmask']
-                ))
+                    netmask=netmask
+                )
+                root_logger.debug(network)
+                ifnet = netaddr.IPNetwork(network)
                 if ifnet == self._net or (
                                 self._net is None and ifnet.ip == self):
                     self._net = ifnet

seems that previous code failed on the fact that:
ifdata['addr'] was ::1
ifdata['netmask'] was ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128

which created invalid network address: ::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128

sounds to me as bug in python-netifaces, but let's evaluate first and probably IPA should handle this bug as well.

$ rpm -q python2-netifaces python-netaddr
python2-netifaces-0.10.5-5.fc26.x86_64
python-netaddr-0.7.19-2.fc26.noarch

python-netifaces package changed behavior, output from netifaces.ifaddresses(INTF)

python-netifaces-0.10.4-5.fc25.x86_64

{'addr': '2620:52:0:xxxx:xxxx:xxxx:xxxx:2c62',
       'netmask': 'ffff:ffff:ffff:ffff::'},

python2-netifaces-0.10.5-5.fc26.x86_64

{'addr': '2620:52:0:xxxx:xxxx:xxxx:xxxx:169a',
   'netmask': 'ffff:ffff:ffff:ffff::/64'},  <---- see extra "/64" in netmask

We should workaround this on the FreeIPA side

Metadata Update from @mbasti:
- Issue set to the milestone: FreeIPA 4.5.2

6 years ago

Metadata Update from @mbasti:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1462155

6 years ago

Metadata Update from @tkrizek:
- Issue set to the milestone: FreeIPA 4.5.3 (was: FreeIPA 4.5.2)

6 years ago

master:

  • 52b43c7 python-netifaces: update to reflect upstream changes

ipa-4-5:

  • 56d04b3 python-netifaces: update to reflect upstream changes

Metadata Update from @mbabinsk:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

6 years ago

Login to comment on this ticket.

Metadata