summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <ermal.luci@gmail.com>2012-12-17 11:14:29 -0800
committerErmal Luçi <ermal.luci@gmail.com>2012-12-17 11:14:29 -0800
commitf90b8b00edd12a50b57448c1a08cf03962305790 (patch)
treea6a9affcf3ca9c113cfcef348f8d626783cedfd4
parent38d41bb041e4df3e39a7399bb3f37b33a9159ce4 (diff)
parente7bd2578747b0ed4e6f505d974173a2331056ec7 (diff)
downloadpfsense-f90b8b00edd12a50b57448c1a08cf03962305790.zip
pfsense-f90b8b00edd12a50b57448c1a08cf03962305790.tar.gz
Merge pull request #285 from bcyrill/cp_v6
Improve future IPv6 compatibility for CP
-rw-r--r--etc/inc/captiveportal.inc10
-rwxr-xr-xusr/local/captiveportal/index.php10
2 files changed, 14 insertions, 6 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index fd50c07..ce3aa29 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1588,10 +1588,14 @@ function portal_reply_page($redirurl, $type = null, $message = null, $clientmac
} else {
$httpport = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : $cpcfg['zoneid'];
$ifip = portal_ip_from_client_ip($clientip);
- if (!$ifip)
+ if (!$ifip) {
$ourhostname = $config['system']['hostname'] . ":{$httpport}";
- else
- $ourhostname = "{$ifip}:{$httpport}";
+ } else {
+ if (is_ipaddrv6($ifip))
+ $ourhostname = "[{$ifip}]:{$httpport}";
+ else
+ $ourhostname = "{$ifip}:{$httpport}";
+ }
$htmltext = str_replace("\$PORTAL_ACTION\$", "http://{$ourhostname}/", $htmltext);
$htmltext = str_replace("#PORTAL_ACTION#", "http://{$ourhostname}/", $htmltext);
}
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index 5858174..0b86e84 100755
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -69,10 +69,14 @@ if (isset($cpcfg['httpslogin']))
$ourhostname = $cpcfg['httpsname'] . ":" . $listenporthttps;
else {
$ifip = portal_ip_from_client_ip($clientip);
- if (!$ifip)
+ if (!$ifip) {
$ourhostname = "{$config['system']['hostname']}.{$config['system']['domain']}:{$listenporthttp}";
- else
- $ourhostname = "{$ifip}:{$listenporthttp}";
+ } else {
+ if (is_ipaddrv6($ifip))
+ $ourhostname = "[{$ifip}]:{$listenporthttp}";
+ else
+ $ourhostname = "{$ifip}:{$listenporthttp}";
+ }
}
if ($orig_host != $ourhostname) {
OpenPOWER on IntegriCloud