diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-11-12 15:37:52 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-11-12 15:37:52 +0000 |
commit | c27571f78e6f4515d0eb33fada0c40d394193b6d (patch) | |
tree | 12c5cf6ea0a458efa8737e184a685c60649335e4 | |
parent | 53a89ee6c1d1bf3ada5b1ba55b533d4ff2e61543 (diff) |
properly detect ipv6 addresses
svn path=/trunk/; revision=4850
-rw-r--r-- | rpkid/rpki/gui/app/forms.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rpkid/rpki/gui/app/forms.py b/rpkid/rpki/gui/app/forms.py index 80439b00..68bd0a3f 100644 --- a/rpkid/rpki/gui/app/forms.py +++ b/rpkid/rpki/gui/app/forms.py @@ -319,16 +319,16 @@ def AddNetForm(qsv4, qsv6): def clean_address_range(self): address_range = self.cleaned_data.get('address_range') try: - r = resource_range_ipv4.parse_str(address_range) - if not qsv4.filter(prefix_min__lte=r.min, prefix_max__gte=r.max).exists(): - raise forms.ValidationError('IP address range is not delegated to you') - except BadIPResource: - try: + if ':' in address_range: r = resource_range_ipv6.parse_str(address_range) if not qsv6.filter(prefix_min__lte=r.min, prefix_max__gte=r.max).exists(): raise forms.ValidationError('IP address range is not delegated to you') - except BadIPResource: - raise forms.ValidationError('invalid IP address range') + else: + r = resource_range_ipv4.parse_str(address_range) + if not qsv4.filter(prefix_min__lte=r.min, prefix_max__gte=r.max).exists(): + raise forms.ValidationError('IP address range is not delegated to you') + except BadIPResource: + raise forms.ValidationError('invalid IP address range') return str(r) return _wrapped |