diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/freeradius.xml | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/packages/freeradius.xml b/packages/freeradius.xml index cf87a370..ac8604a9 100644 --- a/packages/freeradius.xml +++ b/packages/freeradius.xml @@ -42,6 +42,16 @@ <fielddescr>Description</fielddescr> <fieldname>description</fieldname> </columnitem> + <columnitem> + <fielddescr>Upload bandwidth</fielddescr> + <fieldname>uploadbw</fieldname> + <suffix> Kbit/s</suffix> + </columnitem> + <columnitem> + <fielddescr>Download bandwidth</fielddescr> + <fieldname>downloadbw</fieldname> + <suffix> Kbit/s</suffix> + </columnitem> </adddeleteeditpagefields> <fields> <field> @@ -62,6 +72,24 @@ <description>Enter the description of the user here</description> <type>input</type> </field> + <field> + <fielddescr>Enable bandwidth restriction</fielddescr> + <fieldname>bwrestriction</fieldname> + <description>If this option is set, the captive portal will restrict this user to the bandwidth defined below.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Upload bandwidth</fielddescr> + <fieldname>uploadbw</fieldname> + <description>Enter the desired upload bandwidth cap for this user in Kbit/s.</description> + <type>input</type> + </field> + <field> + <fielddescr>Download bandwidth</fielddescr> + <fieldname>downloadbw</fieldname> + <description>Enter the desired download bandwidth cap for this user in Kbit/s.</description> + <type>input</type> + </field> </fields> <custom_php_install_command> global $config; @@ -79,8 +107,7 @@ mwexec("/usr/local/etc/rc.d/radiusd.sh"); </custom_php_install_command> <custom_php_command_before_form> - function sync_package_freeradius() - { + function sync_package_freeradius() { conf_mount_rw(); config_lock(); global $config; @@ -88,7 +115,17 @@ fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); if($config['installedpackages']['freeradius']['config'] != "") { foreach($config['installedpackages']['freeradius']['config'] as $rowhelper) { - fwrite($fout, $rowhelper['username'] . " User-Password == \"" . $rowhelper['password'] . "\"\n"); + fwrite($fout, $rowhelper['username'] . "\tUser-Password == \"" . $rowhelper['password'] . "\"\n"); + if ($rowhelper['bwrestriction'] == "on") { + if (($rowhelper['uploadbw'] != "") and ($rowhelper['downloadbw'] != "")) { + fwrite($fout, "\tNomadix-Bw-Up = " . $rowhelper['uploadbw'] . ",\n"); + fwrite($fout, "\tNomadix-Bw-Down = " . $rowhelper['downloadbw'] . "\n\n"); + } elseif ($rowhelper['uploadbw'] != "") { + fwrite($fout, "\tNomadix-Bw-Up = " . $rowhelper['uploadbw'] . "\n\n"); + } elseif ($rowhelper['downloadbw'] != "") { + fwrite($fout, "\tNomadix-Bw-Down = " . $rowhelper['downloadbw'] . "\n\n"); + } + } } } fclose($fout); @@ -97,8 +134,10 @@ system("/usr/bin/killall -HUP radiusd"); } </custom_php_command_before_form> + <custom_php_resync_config_command> + sync_package_freeradius(); + </custom_php_resync_config_command> <custom_add_php_command> sync_package_freeradius(); </custom_add_php_command> </packagegui> - |