Use new mac format.

This commit is contained in:
SimonFair
2024-02-01 07:40:25 +00:00
parent 9f01517f21
commit dec1bf5de6
2 changed files with 13 additions and 6 deletions
+11 -4
View File
@@ -22,6 +22,14 @@ $_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt.php";
function macbyte($val) {
if ($val < 16)
return '0'.dechex($val);
return dechex($val);
}
$arrEntries = [];
$vms = $lv->get_domains() ?:[];
sort($vms,SORT_NATURAL);
@@ -54,8 +62,7 @@ foreach($arrEntries as $key => $data) {
foreach($data as $data2){
$name=$data2['name'];
if (isset($user_mac[$type][$name])) {
$name=$name;
#var_dump($name);
$name=$name;
$arrEntries[$type][$name]['enable'] = $user_mac[$type][$name]['enable'];
$arrEntries[$type][$name]['user_mac'] = strtolower($user_mac[$type][$name]['user_mac']);
} else {
@@ -109,8 +116,8 @@ case 't1load':
case "macaddress":
$seed = 1;
$prefix = '52:54:AA';
$prefix.':'.$lv->macbyte(($seed * rand()) % 256).':'.$lv->macbyte(($seed * rand()) % 256).':'.$lv->macbyte(($seed * rand()) % 256);
$prefix = '62:00:00';
$prefix .=':'.macbyte(($seed * rand()) % 256).':'.macbyte(($seed * rand()) % 256).':'.macbyte(($seed * rand()) % 256);
echo json_encode(['mac' => $prefix]);
break;