- public static function isValidBlock( $ipblock ) {
- return ( preg_match( '/^' . RE_IPV6_BLOCK . '$/', $ipblock )
- || preg_match( '/^' . RE_IP_BLOCK . '$/', $ipblock ) );
+ public static function isValidBlock( $ipRange ) {
+ return self::isValidRange( $ipRange );
+ }
+
+ /**
+ * Validate an IP range (valid address with a valid CIDR prefix).
+ * SIIT IPv4-translated addresses are rejected.
+ * @note canonicalize() tries to convert translated addresses to IPv4.
+ *
+ * @param string $ipRange
+ * @return bool True if it is valid
+ * @since 1.30
+ */
+ public static function isValidRange( $ipRange ) {
+ return ( preg_match( '/^' . RE_IPV6_RANGE . '$/', $ipRange )
+ || preg_match( '/^' . RE_IP_RANGE . '$/', $ipRange ) );