483b06
From 935029c3192221c480c88b870a507cfac4c4b954 Mon Sep 17 00:00:00 2001
483b06
From: Martin Basti <mbasti@redhat.com>
483b06
Date: Tue, 13 Jun 2017 17:03:30 +0200
483b06
Subject: [PATCH] Fix local IP address validation
483b06
483b06
Previously bf9886a84393d1d1546db7e49b102e08a16a83e7 match_local has
483b06
undesirable side effect that CheckedIPAddress object has set self._net
483b06
from local interface.
483b06
483b06
However with the recent changes, match_local is usually set to False,
483b06
thus this side effect stops happening and default mask per address class
483b06
is used. This causes validation error because mask on interface and mask
483b06
used for provided IP addresses differ (reporducible only with classless
483b06
masks).
483b06
483b06
FreeIPA should compare only IP addresses with local addresses without masks
483b06
483b06
https://pagure.io/freeipa/issue/4317
483b06
483b06
Reviewed-By: David Kupka <dkupka@redhat.com>
483b06
---
483b06
 ipapython/ipautil.py | 6 +++---
483b06
 1 file changed, 3 insertions(+), 3 deletions(-)
483b06
483b06
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
483b06
index a277ed87473f3c591f34fcc00e1159f3bbfe3e9b..647ee833ae33f246de6d6b13703fac6e20eef7bc 100644
483b06
--- a/ipapython/ipautil.py
483b06
+++ b/ipapython/ipautil.py
483b06
@@ -216,10 +216,10 @@ class CheckedIPAddress(UnsafeIPAddress):
483b06
                     addr=ifaddr,
483b06
                     netmask=ifdata['netmask']
483b06
                 ))
483b06
-                if ifnet == self._net or (
483b06
-                                self._net is None and ifnet.ip == self):
483b06
-                    self._net = ifnet
483b06
+
483b06
+                if ifnet.ip == self:
483b06
                     iface = interface
483b06
+                    self._net = ifnet
483b06
                     break
483b06
 
483b06
         return iface
483b06
-- 
483b06
2.9.4
483b06