From 8ad84ebb49f86e791427110233382bd5e804d503 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 27 Sep 2013 10:25:29 -0300 Subject: Remove redundant copies of getNasIP(), it should fix #3234 --- usr/local/captiveportal/radius_accounting.inc | 29 ++--------------------- usr/local/captiveportal/radius_authentication.inc | 29 ++--------------------- 2 files changed, 4 insertions(+), 54 deletions(-) diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index e43a188..d2b4d50 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -44,33 +44,6 @@ define('GIGAWORDS_RIGHT_OPERAND', '4294967296'); // 2^32 -/** - * Get the NAS-IP-Address based on the current wan address - * - * Use functions in interfaces.inc to find this out - * - */ -if (!function_exists('getNasIP')) { - function getNasIP() - { - global $config, $cpzone; - - if (empty($config['captiveportal'][$cpzone]['radiussrcip_attribute'])) { - $nasIp = get_interface_ip(); - } else { - if (is_ipaddr($config['captiveportal'][$cpzone]['radiussrcip_attribute'])) - $nasIp = $config['captiveportal'][$cpzone]['radiussrcip_attribute']; - else - $nasIp = get_interface_ip($config['captiveportal'][$cpzone]['radiussrcip_attribute']); - } - - if(!is_ipaddr($nasIp)) - $nasIp = "0.0.0.0"; - - return $nasIp; - } -} - /* RADIUS ACCOUNTING START ----------------------- @@ -96,6 +69,8 @@ function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers, break; default: + if (!function_exists('getNasIP')) + require_once("captiveportal.inc"); $calledstationid = getNasIP(); $callingstationid = $clientmac; break; diff --git a/usr/local/captiveportal/radius_authentication.inc b/usr/local/captiveportal/radius_authentication.inc index 8727815..5f24506 100644 --- a/usr/local/captiveportal/radius_authentication.inc +++ b/usr/local/captiveportal/radius_authentication.inc @@ -41,33 +41,6 @@ pfSense_MODULE: captiveportal */ -/** - * Get the NAS-IP-Address based on the current wan address - * - * Use functions in interfaces.inc to find this out - * - */ -if (!function_exists('getNasIP')) { - function getNasIP() - { - global $config, $cpzone; - - if (empty($config['captiveportal'][$cpzone]['radiussrcip_attribute'])) { - $nasIp = get_interface_ip(); - } else { - if (is_ipaddr($config['captiveportal'][$cpzone]['radiussrcip_attribute'])) - $nasIp = $config['captiveportal'][$cpzone]['radiussrcip_attribute']; - else - $nasIp = get_interface_ip($config['captiveportal'][$cpzone]['radiussrcip_attribute']); - } - - if(!is_ipaddr($nasIp)) - $nasIp = "0.0.0.0"; - - return $nasIp; - } -} - /* RADIUS AUTHENTICATION --------------------- @@ -95,6 +68,8 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli $callingstationid = $clientip; break; default: + if (!function_exists('getNasIP')) + require_once("captiveportal.inc"); $calledstationid = getNasIP(); $callingstationid = $clientmac; break; -- cgit v1.1