summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@pfSense.org>2014-02-18 07:15:06 -0300
committerRenato Botelho <garga@pfSense.org>2014-02-18 07:15:06 -0300
commit9305e21931f957184fc65d67e9798cb7fd730d2b (patch)
tree6103ac1bf7baeb5f2cd4c7a62dd7e668853bd711
parentadf1c3fa27450d7edb55752545d07ed89a926235 (diff)
parentd460371416d4e2cfef976d5a7616f63f6faa203f (diff)
downloadpfsense-9305e21931f957184fc65d67e9798cb7fd730d2b.zip
pfsense-9305e21931f957184fc65d67e9798cb7fd730d2b.tar.gz
Merge pull request #904 from dv-user1/master
Replaced gethostbyname() with gethostbynamel() to get a list of all IPs ...
-rw-r--r--etc/inc/captiveportal.inc22
1 files changed, 12 insertions, 10 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index fc813ad..9713e97 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1028,13 +1028,13 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) {
*/
if ($ishostname === true) {
if (!$g['booting']) {
- $ipaddress = gethostbyname($ipent['hostname']);
- if (!is_ipaddr($ipaddress))
+ $ipaddress = gethostbynamel($ipent['hostname']);
+ if(!is_array($ipaddress) || empty($ipaddress))
return;
- } else
- $ipaddress = "";
- } else
- $ipaddress = $ipent['ip'];
+ } else
+ $ipaddress = array();
+ } else
+ $ipaddress = array($ipent['ip']);
$rules = "";
$cp_filterdns_conf = "";
@@ -1048,15 +1048,17 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) {
if ($ishostname === true) {
$cp_filterdns_conf .= "ipfw {$ipent['hostname']} 3 pipe {$pipeno}\n";
$cp_filterdns_conf .= "ipfw {$ipent['hostname']} 4 pipe {$pipedown}\n";
- if (!is_ipaddr($ipaddress))
+ if (empty($ipaddress))
return array("", $cp_filterdns_conf);
}
$subnet = "";
if (!empty($ipent['sn']))
$subnet = "/{$ipent['sn']}";
- $rules .= "table 3 add {$ipaddress}{$subnet} {$pipeno}\n";
- $rules .= "table 4 add {$ipaddress}{$subnet} {$pipedown}\n";
-
+ foreach($ipaddress AS $one_address) {
+ $rules .= "table 3 add {$one_address}{$subnet} {$pipeno}\n";
+ $rules .= "table 4 add {$one_address}{$subnet} {$pipedown}\n";
+ }
+
if ($ishostname === true)
return array($rules, $cp_filterdns_conf);
else
OpenPOWER on IntegriCloud