diff options
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/services_captiveportal.php | 38 | ||||
-rwxr-xr-x | usr/local/www/wizard.php | 7 |
2 files changed, 42 insertions, 3 deletions
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php index 5206535..fc5a1a9 100755 --- a/usr/local/www/services_captiveportal.php +++ b/usr/local/www/services_captiveportal.php @@ -98,6 +98,7 @@ $pconfig['radiuskey'] = $config['captiveportal']['radiuskey']; $pconfig['radiuskey2'] = $config['captiveportal']['radiuskey2']; $pconfig['radiusvendor'] = $config['captiveportal']['radiusvendor']; $pconfig['radiussession_timeout'] = isset($config['captiveportal']['radiussession_timeout']); +$pconfig['radiussrcip_attribute'] = $config['captiveportal']['radiussrcip_attribute']; $pconfig['passthrumacadd'] = isset($config['captiveportal']['passthrumacadd']); $pconfig['passthrumacaddusername'] = isset($config['captiveportal']['passthrumacaddusername']); $pconfig['radmac_format'] = $config['captiveportal']['radmac_format']; @@ -200,6 +201,7 @@ if ($_POST) { $config['captiveportal']['radiuskey2'] = $_POST['radiuskey2']; $config['captiveportal']['radiusvendor'] = $_POST['radiusvendor'] ? $_POST['radiusvendor'] : false; $config['captiveportal']['radiussession_timeout'] = $_POST['radiussession_timeout'] ? true : false; + $config['captiveportal']['radiussrcip_attribute'] = $_POST['radiussrcip_attribute']; $config['captiveportal']['passthrumacadd'] = $_POST['passthrumacadd'] ? true : false; $config['captiveportal']['passthrumacaddusername'] = $_POST['passthrumacaddusername'] ? true : false; $config['captiveportal']['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false; @@ -263,6 +265,7 @@ function enable_change(enable_change) { document.iform.noconcurrentlogins.disabled = endis; document.iform.radiusvendor.disabled = radius_endis; document.iform.radiussession_timeout.disabled = radius_endis; + document.iform.radiussrcip_attribute.disabled = radius_endis; document.iform.htmlfile.disabled = endis; document.iform.errfile.disabled = endis; document.iform.logoutfile.disabled = endis; @@ -528,6 +531,41 @@ value="<?=htmlspecialchars($pconfig['radiuskey2']);?>"></td> </tr> <tr> + <td class="vncell" valign="top">Radius ip attribute</td> + <td> + <select name="radiussrcip_attribute" id="radiussrcip_attribute"> + <?php $iflist = get_configured_interface_with_descr(); + foreach ($iflist as $ifdesc => $ifdescr) { + $ipaddr = get_interface_ip($ifdesc); + if (is_ipaddr($ipaddr)) { + $selected = ""; + if ($ipaddr == $pconfig['radiussrcip_attribute']) + $ifdesc = "selected"; + echo "<option value='{$ifdesc}' {$selected}>{$ifdescr} - {$ipaddr}</option>\n"; + } + } + if (is_array($config['virtualip']['vip'])) { + foreach ($config['virtualip']['vip'] as $sn) { + if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") { + $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits'])); + $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits'])); + $len = $end - $start; + + for ($i = 0; $i <= $len; $i++) { + $snip = long2ip32($start+$i); + echo "<option value='{$snip}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$snip}") . "></option>\n"; + } + } else + echo "<option value='{$sn['subnet']}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$sn['subnet']}") . "></option>\n"; + } + } + ?> + </select><br/> + Choose the ip to use for calling station attribute. + </td> + </tr> + + <tr> <td class="vncell" valign="top">Session-Timeout</td> <td class="vtable"><input name="radiussession_timeout" type="checkbox" id="radiussession_timeout" value="yes" <?php if ($pconfig['radiussession_timeout']) echo "checked"; ?>><strong>Use RADIUS Session-Timeout attributes</strong><br> When this is enabled, clients will be disconnected after the amount of time retrieved from the RADIUS Session-Timeout attribute.</td> diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 8a5c78f..a59e83d 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -136,14 +136,15 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type * item is a checkbox, it should have the value "on" * if it was checked */ - $text = "unset(\$config" . $field_conv . ");"; + $var = "\$config{$field_conv}"; + $text = "if (isset({$var})) unset({$var});"; eval($text); return; } if($field_type == "interfaces_selection") { - $text = "unset(\$config" . $field_conv . ");"; - eval($text); + $var = "\$config{$field_conv}"; + $text = "if (isset({$var})) unset({$var});"; $text = "\$config" . $field_conv . " = \"" . $updatetext . "\";"; eval($text); return; |