URL: https://github.com/freeipa/freeipa/pull/876
Author: MartinBasti
 Title: #876: python-netifaces: update to reflect upstream changes
Action: opened

PR body:
"""
python-netifaces now provides IPv6 netmask in format mask/prefix. It
breaks freeipa as it is unexpected format for python-netaddr. We must
split netmask and provide only prefix for netaddr.

https://pagure.io/freeipa/issue/7021
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/876/head:pr876
git checkout pr876
From f4d58ce97252eb891e1c8158927547b2e174edd8 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Fri, 16 Jun 2017 13:42:53 +0200
Subject: [PATCH] python-netifaces: update to reflect upstream changes

python-netifaces now provides IPv6 netmask in format mask/prefix. It
breaks freeipa as it is unexpected format for python-netaddr. We must
split netmask and provide only prefix for netaddr.

https://pagure.io/freeipa/issue/7021
---
 ipapython/ipautil.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index a277ed8747..02c32381ab 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -212,9 +212,14 @@ def get_matching_interface(self):
                 # errors in IPNetwork
                 ifaddr = ifdata['addr'].split(u'%', 1)[0]
 
+                # newer versions of netifaces provide IPv6 netmask in format
+                # 'ffff:ffff:ffff:ffff::/64'. We have to split and use prefix
+                # or the netmask with older versions
+                ifmask = ifdata['netmask'].split(u'/')[-1]
+
                 ifnet = netaddr.IPNetwork('{addr}/{netmask}'.format(
                     addr=ifaddr,
-                    netmask=ifdata['netmask']
+                    netmask=ifmask
                 ))
                 if ifnet == self._net or (
                                 self._net is None and ifnet.ip == self):
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to