mbasti-rh's pull request #55: "Fix parse errors with link-local addresses" was opened
PR body: """ Link-local addresses received from netifaces contains '%suffix' that causes parse error in IPNetwork class. We must remove %suffix before it us used in IPNetwork objects. https://fedorahosted.org/freeipa/ticket/6296 """ See the full pull-request at https://github.com/freeipa/freeipa/pull/55 ... or pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/55/head:pr55 git checkout pr55
From 07d92bd96d30cf628729edfbae931e66e0c4b554 Mon Sep 17 00:00:00 2001 From: Martin Basti <mba...@redhat.com> Date: Mon, 5 Sep 2016 14:33:58 +0200 Subject: [PATCH] Fix parse errors with link-local addresses Link-local addresses received from netifaces contains '%suffix' that causes parse error in IPNetwork class. We must remove %suffix before it us used in IPNetwork objects. https://fedorahosted.org/freeipa/ticket/6296 --- ipapython/ipautil.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 9536543..c918c34 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -173,8 +173,13 @@ def __init__(self, addr, match_local=False, parse_netmask=True, iface = None for interface in netifaces.interfaces(): for ifdata in netifaces.ifaddresses(interface).get(family, []): + + # link-local addresses contain '%suffix' that causes parse + # errors in IPNetwork + addr = ifdata['addr'].split(u'%', 1)[0] + ifnet = netaddr.IPNetwork('{addr}/{netmask}'.format( - addr=ifdata['addr'], + addr=addr, netmask=ifdata['netmask'] )) if ifnet == self._net or (
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code