$radmac_secret = $config['captiveportal']['radmac_secret'];
/* authentication against the radius server */
- $auth_list = radius($clientmac,$radmac_secret,$clientip,$clientmac,"MACHINE LOGIN");
+ $username = mac_format($clientmac);
+ $auth_list = radius($username,$radmac_secret,$clientip,$clientmac,"MACHINE LOGIN");
if ($auth_list['auth_val'] == 2) {
return TRUE;
}
global $config;
$retvalue = array();
- $nas_mac = get_interface_mac($config['interfaces']['wan']['if']);
+ $nas_mac = mac_format(get_interface_mac($config['interfaces']['wan']['if']));
+ $clientmac = mac_format($clientmac);
$nas_port = $ruleno - 10000;
$radiusvendor = $config['captiveportal']['radiusvendor'] ? $config['captiveportal']['radiusvendor'] : null;
global $config;
$retvalue = array();
- $nas_mac = get_interface_mac($config['interfaces']['wan']['if']);
+ $nas_mac = mac_format(get_interface_mac($config['interfaces']['wan']['if']));
+ $clientmac = mac_format($clientmac);
$nas_port = $ruleno - 10000;
$radiusvendor = $config['captiveportal']['radiusvendor'] ? $config['captiveportal']['radiusvendor'] : null;
$stop_time = (empty($stop_time)) ? time() : $stop_time;
return false;
}
+function mac_format($clientmac) {
+ $mac =explode(":", $clientmac);
+
+ global $config;
+
+ $mac_format = $config['captiveportal']['radmac_format'] ? $config['captiveportal']['radmac_format'] : false;
+
+ switch($mac_format) {
+
+ case 'singledash':
+ return "$mac[0]$mac[1]$mac[2]-$mac[3]$mac[4]$mac[5]";
+
+ case 'ietf':
+ return "$mac[0]-$mac[1]-$mac[2]-$mac[3]-$mac[4]-$mac[5]";
+
+ case 'cisco':
+ return "$mac[0]$mac[1].$mac[2]$mac[3].$mac[4]$mac[5]";
+
+ case 'unformatted':
+ return "$mac[0]$mac[1]$mac[2]$mac[3]$mac[4]$mac[5]";
+
+ default:
+ return $clientmac;
+ }
+}
+
?>
$pconfig['radiuskey2'] = $config['captiveportal']['radiuskey2'];
$pconfig['radiusvendor'] = $config['captiveportal']['radiusvendor'];
$pconfig['radiussession_timeout'] = isset($config['captiveportal']['radiussession_timeout']);
+$pconfig['radmac_format'] = $config['captiveportal']['radmac_format'];
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']['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false;
/* file upload? */
if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
document.iform.auth_method[1].disabled = endis;
document.iform.auth_method[2].disabled = endis;
document.iform.radmac_enable.disabled = radius_endis;
+ document.iform.radmac_format.disabled = radius_endis;
document.iform.httpslogin_enable.disabled = endis;
document.iform.httpsname.disabled = endis;
document.iform.cert.disabled = endis;
If RADIUS type is set to Cisco, in RADIUS requests (Authentication/Accounting) the value of Calling-Station-Id will be set to the client's IP address and
the Called-Station-Id to the client's MAC address. Default behaviour is Calling-Station-Id = client's MAC address and Called-Station-Id = m0n0wall's WAN MAC address.</td>
</tr>
+ <tr>
+ <td class="vncell">MAC address format</td>
+ <td class="vtable">
+ <select name="radmac_format" id="radmac_format">
+ <option>default</option>
+ <?php
+ $macformats = array("singledash","ietf","cisco","unformatted");
+ foreach ($macformats as $macformat) {
+ if ($pconfig['radmac_format'] == $macformat)
+ echo "<option selected value=\"$macformat\">$macformat</option>\n";
+ else
+ echo "<option value=\"$macformat\">$macformat</option>\n";
+ }
+ ?>
+ </select></br>
+ This option changes the MAC address format used in the whole RADIUS system. Change this if you also
+ need to change the username format for RADIUS MAC authentication.<br>
+ default: 00:11:22:33:44:55<br>
+ singledash: 001122-334455<br>
+ ietf: 00-11-22-33-44-55<br>
+ cisco: 0011.2233.4455<br>
+ unformatted: 001122334455
+ </tr>
</table>
</tr>
<tr>