summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-01-20 12:21:19 +0000
committerErmal <eri@pfsense.org>2012-01-20 12:21:19 +0000
commitcff5204a17992f77de04544f75f939ddcfabf84c (patch)
tree1d490b89a09436c669e1a7c11674cd0b0fb9815e /usr
parent26275879e9a7ad2c39dae86579a10547290f16af (diff)
downloadpfsense-cff5204a17992f77de04544f75f939ddcfabf84c.zip
pfsense-cff5204a17992f77de04544f75f939ddcfabf84c.tar.gz
Correct the Called-Station-Id attribute setting to be the same on STOP/START packets
Diffstat (limited to 'usr')
-rw-r--r--usr/local/captiveportal/radius_accounting.inc38
1 files changed, 32 insertions, 6 deletions
diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc
index 1f24e65..0a1300c 100644
--- a/usr/local/captiveportal/radius_accounting.inc
+++ b/usr/local/captiveportal/radius_accounting.inc
@@ -42,6 +42,34 @@
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 +95,9 @@ function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers,
break;
default:
- if (is_ipaddr($config['captiveportal'][$cpzone]['radiussrcip_attribute']))
- $calledstationid = $config['captiveportal'][$cpzone]['radiussrcip_attribute'];
- else
- $calledstationid = get_interface_ip($config['captiveportal'][$cpzone]['radiussrcip_attribute']);
- $callingstationid = $clientmac;
+ $calledstationid = getNasIP();
$callingstationid = $clientmac;
+ break;
}
// Create our instance
@@ -189,8 +214,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
OpenPOWER on IntegriCloud