Captive Portal RADIUS NAS IP Attribute not being set properly
-
I'm running the latest snapshot as of this posting (2.3.b.20160302.0533) and have run a gitsync as well.
No matter what is selected in the RADIUS NAS IP Attribute field (configured on page https://pfsense.localdomain/services_captiveportal.php?zone=cpzone, where cpzone is an existing zone in the captive portal), the RADIUS server receives the requests with a NAS IP of 0.0.0.0. Looking at the file /usr/local/www/services_captiveportal.php and running some developer shell commands revealed to me that the radiussrcip_attribute, which contains the name of the interface (e.g., LAN) gets stored in /conf/config.xml in uppercase when it should be lowercase.
The captiveportal code needs to either write the interface name to the configuration file in lowercase (e.g., lan instead of LAN), or it needs lowercase it when read from the configuration file.
I wrote a quick patch, which runs the post data through strtolower() when writing to the configuration. This may or may not be the right fix for it though:
--- /usr/local/www/services_captiveportal.php 2016-02-15 03:09:32.000000000 +0000 +++ /usr/local/www/services_captiveportal.php 2016-02-15 03:09:32.000000000 +0000 @@ -457,7 +457,7 @@ $newcp['radiuskey4'] = $_POST['radiuskey4']; $newcp['radiusvendor'] = $_POST['radiusvendor'] ? $_POST['radiusvendor'] : false; $newcp['radiussession_timeout'] = $_POST['radiussession_timeout'] ? true : false; - $newcp['radiussrcip_attribute'] = $_POST['radiussrcip_attribute']; + $newcp['radiussrcip_attribute'] = strtolower($_POST['radiussrcip_attribute']); $newcp['passthrumacadd'] = $_POST['passthrumacadd'] ? true : false; $newcp['passthrumacaddusername'] = $_POST['passthrumacaddusername'] ? true : false; $newcp['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false;
-
Thanks, fixed.
https://redmine.pfsense.org/issues/5946 -
Looks good. Thanks!