diff options
author | Ermal <eri@pfsense.org> | 2012-01-20 12:25:15 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-01-20 12:25:15 +0000 |
commit | 33266794774e972c4f9ed7e34f7748bcf85aa766 (patch) | |
tree | 6956ac3884f0457486ad6c8e3e054433c1d0c4fc /usr/local/captiveportal | |
parent | a237d9b2756d59e811acb06e3702d427876a53f4 (diff) | |
download | pfsense-33266794774e972c4f9ed7e34f7748bcf85aa766.zip pfsense-33266794774e972c4f9ed7e34f7748bcf85aa766.tar.gz |
Correct the Called-Station-Id attribute setting to be the same on STOP/START packets
Diffstat (limited to 'usr/local/captiveportal')
-rw-r--r-- | usr/local/captiveportal/radius_accounting.inc | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index 704c229..72c8a67 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -42,6 +42,33 @@ 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 ACCOUNTING START ----------------------- @@ -67,12 +94,9 @@ function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers, break; default: - if (is_ipaddr($config['captiveportal']['radiussrcip_attribute'])) - $calledstationid = $config['captiveportal']['radiussrcip_attribute']; - else - $calledstationid = get_interface_ip($config['captiveportal']['radiussrcip_attribute']); - $callingstationid = $clientmac; + $calledstationid = getNasIP(); $callingstationid = $clientmac; + break; } // Create our instance @@ -189,8 +213,9 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius break; default: - $calledstationid = get_interface_ip("wan"); + $calledstationid = getNasIP(); $callingstationid = $clientmac; + break; } // Create our instance, see if we should use Accounting Interim Updates or Accounting STOP messages |