diff options
author | Martin Kosek <mkosek@redhat.com> | 2012-09-05 09:56:27 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-09-19 17:32:02 +0200 |
commit | ef7b8ab764420baa4e959c0bf060e390b314c18f (patch) | |
tree | 5c1bb869799928ea5aebfb3ed88fa88eced8da35 /ipaserver | |
parent | 26166deb0c3a9938eeb94725705d49d259aa6e70 (diff) | |
download | freeipa-ef7b8ab764420baa4e959c0bf060e390b314c18f.tar.gz freeipa-ef7b8ab764420baa4e959c0bf060e390b314c18f.tar.xz freeipa-ef7b8ab764420baa4e959c0bf060e390b314c18f.zip |
Use default reverse zone consistently
When a new reverse zone is to be generated based on an IP address without
a network prefix length, we need to use some default value. While netaddr
library default ones (32b for IPv4 and 128b for IPv6) are not very sensible
we should use the defaults already applied in installers. That is 24b for
IPv6 and 64 for IPv6.
Test case has been added to cover the new default.
https://fedorahosted.org/freeipa/ticket/2461
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/install/bindinstance.py | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py index 8284f3eaa..c2c4a86b4 100644 --- a/ipaserver/install/bindinstance.py +++ b/ipaserver/install/bindinstance.py @@ -33,7 +33,8 @@ from ipapython import sysrestore from ipapython import ipautil from ipalib.parameters import IA5Str from ipalib.util import (validate_zonemgr, normalize_zonemgr, - get_dns_forward_zone_update_policy, get_dns_reverse_zone_update_policy) + get_dns_forward_zone_update_policy, get_dns_reverse_zone_update_policy, + normalize_zone, get_reverse_zone_default) from ipapython.ipa_log_manager import * from ipalib.text import _ @@ -72,12 +73,6 @@ def check_inst(unattended): return True -def normalize_zone(zone): - if zone[-1] != '.': - return zone + '.' - else: - return zone - def create_reverse(): return ipautil.user_input("Do you want to configure the reverse zone?", True) @@ -231,17 +226,6 @@ def verify_reverse_zone(zone, ip_address): return True -def get_reverse_zone_default(ip_address): - ip = netaddr.IPAddress(ip_address) - items = ip.reverse_dns.split('.') - - if ip.version == 4: - items = items[1:] # /24 for IPv4 - elif ip.version == 6: - items = items[16:] # /64 for IPv6 - - return normalize_zone('.'.join(items)) - def find_reverse_zone(ip_address): ip = netaddr.IPAddress(ip_address) zone = normalize_zone(ip.reverse_dns) |