diff options
-rw-r--r-- | usr/local/captiveportal/radius_authentication.inc | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/usr/local/captiveportal/radius_authentication.inc b/usr/local/captiveportal/radius_authentication.inc index da09fdc..cb21a23 100644 --- a/usr/local/captiveportal/radius_authentication.inc +++ b/usr/local/captiveportal/radius_authentication.inc @@ -41,6 +41,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 AUTHENTICATION --------------------- @@ -68,10 +95,7 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli $callingstationid = $clientip; 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']); + $calledstationid = getNasIP(); $callingstationid = $clientmac; break; } |