summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-02-13 11:06:22 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-02-13 11:06:22 -0200
commitcb2b59b89b4d7fb6449c0f45d142302dd2029373 (patch)
tree42d510039538199b718b0f4cd01e2c8291010931
parent96ccd0095e6b7258abf6fa39b262321b65508f48 (diff)
downloadpfsense-cb2b59b89b4d7fb6449c0f45d142302dd2029373.zip
pfsense-cb2b59b89b4d7fb6449c0f45d142302dd2029373.tar.gz
Deal correct with /32 subnet mask for ipv6 addresses. If fixes #2451
-rwxr-xr-xusr/local/www/firewall_rules_edit.php6
-rwxr-xr-xusr/local/www/guiconfig.inc17
2 files changed, 18 insertions, 5 deletions
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");
<?php
$sel = is_specialnet($pconfig['src']); ?>
<option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>><?=gettext("any");?></option>
- <option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>><?=gettext("Single host or alias");?></option>
+ <option value="single" <?php
+ if (!$sel &&
+ ((is_ipaddrv6($pconfig['src']) && ($pconfig['srcmask'] == 128)) ||
+ (is_ipaddrv4($pconfig['src']) && ($pconfig['srcmask'] == 32)))
+ ) { echo "selected"; $sel = 1; } ?>> <?=gettext("Single host or alias");?></option>
<option value="network" <?php if (!$sel) echo "selected"; ?>><?=gettext("Network");?></option>
<?php if(have_ruleint_access("pptp")): ?>
<option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>><?=gettext("PPTP clients");?></option>
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)
OpenPOWER on IntegriCloud