diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-06-13 16:37:40 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-06-20 22:14:10 -0400 |
commit | c329a54c093f856d129cf74528d24d13d1792326 (patch) | |
tree | d7d92885a4248acc1c3ca16a6741e9a399434d26 /ipapython | |
parent | d0af8b28d7552b301d5d2c1af93ed1604dc5df8f (diff) | |
download | freeipa-c329a54c093f856d129cf74528d24d13d1792326.tar.gz freeipa-c329a54c093f856d129cf74528d24d13d1792326.tar.xz freeipa-c329a54c093f856d129cf74528d24d13d1792326.zip |
The IP address provided to ipa-server-install must be local
Compare the configured interfaces with the supplied IP address and
optional netmask to determine if the interface is available.
https://fedorahosted.org/freeipa/ticket/1175
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/ipautil.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index ed8f04af5..91d19e95f 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -66,7 +66,7 @@ def get_domain_name(): return domain_name class CheckedIPAddress(netaddr.IPAddress): - def __init__(self, addr, match_local=True, parse_netmask=True): + def __init__(self, addr, match_local=False, parse_netmask=True): if isinstance(addr, CheckedIPAddress): super(CheckedIPAddress, self).__init__(addr) self.prefixlen = addr.prefixlen @@ -117,11 +117,14 @@ class CheckedIPAddress(netaddr.IPAddress): continue ifnet = netaddr.IPNetwork(fields[3]) - if ifnet == net or ifnet.ip == addr: + if ifnet == net or (net is None and ifnet.ip == addr): net = ifnet iface = fields[1] break + if iface is None: + raise ValueError('No network interface matches the provided IP address and netmask') + if net is None: defnet = True if addr.version == 4: |