]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
datamodel: custom type: network /96: added special error message for entering /128
authorVasek Sraier <git@vakabus.cz>
Mon, 13 Sep 2021 08:54:48 +0000 (10:54 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:52 +0000 (16:17 +0200)
manager/knot_resolver_manager/datamodel/types.py

index 17aed46da75226e1818405fcfba72eb7b07ec5f1..9f87e47c0c908e6c468458e15d12807ee5853067 100644 (file)
@@ -223,9 +223,17 @@ class IPv6Network96(CustomValueType):
             except ValueError as e:
                 raise DataValidationException("Failed to parse IPv6 /96 network.", object_path) from e
 
+            if self._value.prefixlen == 128:
+                raise DataValidationException(
+                    "Expected IPv6 network address with /96 prefix length."
+                    " Submitted address has been interpreted as /128."
+                    " Maybe, you forgot to add /96 after the base address?",
+                    object_path,
+                )
+
             if self._value.prefixlen != 96:
                 raise DataValidationException(
-                    "Expected IPv6 network address with /96 prefix lenght."
+                    "Expected IPv6 network address with /96 prefix length."
                     f" Got prefix lenght of {self._value.prefixlen}",
                     object_path,
                 )