/dev/null')))); if (!preg_match('/^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/', $swName)) { $_SESSION['vmmngr_error'] = gettext('Invalid switch name.'); } elseif (!in_array($bridge, $hostBridges, true)) { $_SESSION['vmmngr_error'] = gettext('Choose an existing host bridge - the addon does not create bridges.'); } else { $res = vmm_run(['switch', 'create', '-t', 'manual', '-b', $bridge, $swName], 30); $_SESSION['vmmngr_error'] = $res['rc'] === 0 ? sprintf(gettext('Switch %s created on %s.'), $swName, $bridge) : trim($res['stderr'] ?: $res['stdout'] ?: 'unknown error'); } header('Location: vmmngr_switches.php'); exit; } if ($post && str_starts_with($act, 'destroy:')) { $swName = substr($act, 8); if (($_POST['confirm'] ?? '') !== $swName) { $_SESSION['vmmngr_error'] = gettext('Confirmation mismatch - switch kept.'); } else { $res = vmm_run(['switch', 'destroy', $swName], 30); $_SESSION['vmmngr_error'] = $res['rc'] === 0 ? sprintf(gettext('Switch %s removed.'), $swName) : trim($res['stderr'] ?: $res['stdout'] ?: 'unknown error'); } header('Location: vmmngr_switches.php'); exit; } $switches = vmm_switches(); $vms = vmm_list(); $bySwitch = []; foreach ($vms as $v) { $info = vmm_info((string)$v['name']); foreach (($info['sections']['network-interface'] ?? []) as $nic) { $sw = (string)($nic['data']['virtual-switch'] ?? ''); if ($sw !== '') { $bySwitch[$sw][] = (string)$v['name']; } } } $hostBridges = array_values(array_filter(array_map('trim', explode("\n", trim((string)@shell_exec('/sbin/ifconfig -g bridge 2>/dev/null')))))); $pgtitle = [gettext('Extensions'), gettext('VM Manager'), gettext('Switches')]; include 'fbegin.inc'; vmm_css(); vmm_nav('switches'); ?>
Bridges; this page only maps vm-bhyve switches to them.');?>
 

VLAN
()