summaryrefslogtreecommitdiffstats
path: root/usr/local/captiveportal
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-05-21 21:44:38 +0000
committerErmal Luçi <eri@pfsense.org>2009-05-21 21:44:58 +0000
commitf8b1131038f1a8ced102c79ed6c72ef9dc05e6f1 (patch)
treeaf5965311271a555f903685cbb586a40aed64ff9 /usr/local/captiveportal
parent868a5b990ab32dbea625c254a6daa264086fd08b (diff)
downloadpfsense-f8b1131038f1a8ced102c79ed6c72ef9dc05e6f1.zip
pfsense-f8b1131038f1a8ced102c79ed6c72ef9dc05e6f1.tar.gz
Make CP multi-interface capable.
Diffstat (limited to 'usr/local/captiveportal')
-rwxr-xr-xusr/local/captiveportal/index.php31
1 files changed, 24 insertions, 7 deletions
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index eab9763..3771bf9 100755
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -49,8 +49,13 @@ if (!$clientip) {
if (isset($config['captiveportal']['httpslogin']))
$ourhostname = $config['captiveportal']['httpsname'] . ":8001";
-else
- $ourhostname = get_interface_ip($config['captiveportal']['interface']) . ":8000";
+else {
+ $ifip = portal_ip_from_client_ip($clientip);
+ if (!$ifip)
+ $ourhostname = $config['system']['hostname'] . ":8000";
+ else
+ $ourhostname = "{$ifip}:8000";
+}
if ($orig_host != $ourhostname) {
/* the client thinks it's connected to the desired web server, but instead
@@ -84,7 +89,7 @@ if (!$clientmac && $macfilter) {
/* find out if we need RADIUS + RADIUSMAC or not */
if (file_exists("{$g['vardb_path']}/captiveportal_radius.db")) {
$radius_enable = TRUE;
- if ($radius_enable && isset($config['captiveportal']['radmac_enable']))
+ if (isset($config['captiveportal']['radmac_enable']))
$radmac_enable = TRUE;
}
@@ -167,8 +172,14 @@ function portal_reply_page($redirurl, $type = null, $message = null, $clientmac
/* substitute other variables */
if (isset($config['captiveportal']['httpslogin']))
$htmltext = str_replace("\$PORTAL_ACTION\$", "https://{$config['captiveportal']['httpsname']}:8001/", $htmltext);
- else
- $htmltext = str_replace("\$PORTAL_ACTION\$", "http://" . get_interface_ip($config['captiveportal']['interface']) . ":8000/", $htmltext);
+ else {
+ $ifip = portal_ip_from_client_ip($clientip);
+ if (!$ifip)
+ $ourhostname = $config['system']['hostname'] . ":8000";
+ else
+ $ourhostname = "{$ifip}:8000";
+ $htmltext = str_replace("\$PORTAL_ACTION\$", "http://{$ourhostname}/", $htmltext);
+ }
$htmltext = str_replace("\$PORTAL_REDIRURL\$", htmlspecialchars($redirurl), $htmltext);
$htmltext = str_replace("\$PORTAL_MESSAGE\$", htmlspecialchars($message), $htmltext);
@@ -320,8 +331,14 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
if (isset($config['captiveportal']['httpslogin']))
$logouturl = "https://{$config['captiveportal']['httpsname']}:8001/";
- else
- $logouturl = "http://" . get_interface_ip($config['captiveportal']['interface']) . ":8000/";
+ else {
+ $ifip = portal_ip_from_client_ip($clientip);
+ if (!$ifip)
+ $ourhostname = $config['system']['hostname'] . ":8000";
+ else
+ $ourhostname = "{$ifip}:8000";
+ $logouturl = "http://{$ourhostname}/";
+ }
echo <<<EOD
<HTML>
OpenPOWER on IntegriCloud