Fix mac address validity.

This commit is contained in:
Tom Alexander
2023-04-27 18:44:32 -04:00
parent 740f2bdadd
commit a44b8da509
3 changed files with 15 additions and 4 deletions

View File

@@ -63,6 +63,9 @@ function start_vm {
# -H release the CPU when guest issues HLT instruction. Otherwise 100% of core will be consumed.
# -s 3,ahci-cd,/vm/.iso/archlinux-2023.04.01-x86_64.iso \
# -s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080,wait \
# -s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080 \
# TODO: Look into using nmdm instead of stdio for serial console
while true; do
set -x
set +e
@@ -75,7 +78,6 @@ function start_vm {
-s "4,nvme,/dev/zvol/${zfs_path}/disk0" \
-s "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}" \
-s 3,ahci-cd,/vm/.iso/archlinux-2023.04.01-x86_64.iso \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080 \
-s 30,xhci,tablet \
-s 31,lpc -l com1,stdio \
-l "bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,${mount_path}/BHYVE_UEFI_VARS.fd" \
@@ -146,7 +148,16 @@ function ng_exists {
function calculate_mac_address {
name="$1"
source=$(md5 -r -s "$name" | awk '{print $1}')
echo "${source:0:2}:${source:2:2}:${source:4:2}:${source:6:2}:${source:8:2}:${source:10:2}"
echo "06:${source:0:2}:${source:2:2}:${source:4:2}:${source:6:2}:${source:8:2}"
}
function find_available_port {
start_port="$1"
port="$start_port"
while true; do
sockstat -P tcp -p 443
port=$((port + 1))
done
}