From cb2b59b89b4d7fb6449c0f45d142302dd2029373 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 13 Feb 2013 11:06:22 -0200 Subject: Deal correct with /32 subnet mask for ipv6 addresses. If fixes #2451 --- usr/local/www/firewall_rules_edit.php | 6 +++++- usr/local/www/guiconfig.inc | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'usr') diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 3bec648..2cdcdbb 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -900,7 +900,11 @@ include("head.inc"); - + diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index e2829d0..cb16f96 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -658,8 +658,12 @@ function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendp $padr = $adr['network']; else if ($adr['address']) { list($padr, $pmask) = explode("/", $adr['address']); - if (!$pmask) - $pmask = 32; + if (!$pmask) { + if (is_ipaddrv6($padr)) + $pmask = 128; + else + $pmask = 32; + } } if (isset($adr['not'])) @@ -686,8 +690,13 @@ function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $p $adr['network'] = $padr; else { $adr['address'] = $padr; - if ($pmask != 32) - $adr['address'] .= "/" . $pmask; + if (is_ipaddrv6($padr)) { + if ($pmask != 128) + $adr['address'] .= "/" . $pmask; + } else { + if ($pmask != 32) + $adr['address'] .= "/" . $pmask; + } } if ($pnot) -- cgit v1.1