diff --git a/admin/src/Table/AllowTable.php b/admin/src/Table/AllowTable.php index 00af5bf..d63ecc6 100644 --- a/admin/src/Table/AllowTable.php +++ b/admin/src/Table/AllowTable.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; +use Codeling\Plugin\System\Bfstop\Helper\IpHelper; use Joomla\CMS\Table\Table; use Joomla\Database\DatabaseDriver; @@ -30,6 +31,14 @@ public function check() { $this->id = 0; } + // addresses and networks are looked up by their canonical spelling, see + // IpHelper::canonicalEntry() ("2001:DB8::1" and "203.0.113.5/24" are + // kept as "2001:db8::1" and "203.0.113.0/24") + $canonical = IpHelper::canonicalEntry($this->ipaddress); + if ($canonical !== null) + { + $this->ipaddress = $canonical; + } return parent::check(); } } diff --git a/admin/src/Table/BlockTable.php b/admin/src/Table/BlockTable.php index 0f6668f..0301094 100644 --- a/admin/src/Table/BlockTable.php +++ b/admin/src/Table/BlockTable.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; +use Codeling\Plugin\System\Bfstop\Helper\IpHelper; use Joomla\CMS\Table\Table; use Joomla\Database\DatabaseDriver; @@ -30,6 +31,14 @@ public function check() { $this->id = 0; } + // addresses and networks are looked up by their canonical spelling, see + // IpHelper::canonicalEntry() ("2001:DB8::1" and "203.0.113.5/24" are + // kept as "2001:db8::1" and "203.0.113.0/24") + $canonical = IpHelper::canonicalEntry($this->ipaddress); + if ($canonical !== null) + { + $this->ipaddress = $canonical; + } return parent::check(); } }