mirror of
https://github.com/unraid/webgui.git
synced 2026-04-23 18:48:49 -05:00
Re-introduce macvlan / ipvlan selection when bridge is enabled
This commit is contained in:
@@ -23,6 +23,8 @@ require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
$DockerClient = new DockerClient();
|
||||
exec("/etc/rc.d/rc.docker status >/dev/null",$dummy,$DockerStopped);
|
||||
|
||||
$bridge = file_exists('/sys/class/net/br0');
|
||||
|
||||
function strposX($s, $c, $n=1) {
|
||||
$p = 0;
|
||||
while ($n && $p=strpos($s,$c,$p)!==false) {$n--; $p+=strlen($c);}
|
||||
@@ -254,6 +256,16 @@ _(Template Authoring Mode)_:
|
||||
|
||||
:docker_authoring_mode_help:
|
||||
|
||||
<?if ($bridge):?>
|
||||
_(Docker custom network type)_:
|
||||
: <select name="DOCKER_NETWORK_TYPE">
|
||||
<?=mk_option(_var($dockercfg,'DOCKER_NETWORK_TYPE'), '1', _('ipvlan'))?>
|
||||
<?=mk_option(_var($dockercfg,'DOCKER_NETWORK_TYPE'), '', _('macvlan'))?>
|
||||
</select> _(Please read the Help carefully)_. _(Misconfiguration can cause problems)_.
|
||||
|
||||
:docker_custom_network_type_help:
|
||||
|
||||
<?endif;?>
|
||||
_(Host access to custom networks)_:
|
||||
: <select name="DOCKER_ALLOW_ACCESS">
|
||||
<?=mk_option(_var($dockercfg,'DOCKER_ALLOW_ACCESS'), '', _('Disabled'))?>
|
||||
@@ -452,6 +464,13 @@ _(Docker LOG rotation)_:
|
||||
|
||||
:docker_log_rotation_active_help:
|
||||
|
||||
<?if ($bridge):?>
|
||||
_(Docker custom network type)_:
|
||||
: <?=_var($dockercfg,'DOCKER_NETWORK_TYPE')=='1' ? _('ipvlan') : _('macvlan')?>
|
||||
|
||||
:docker_custom_network_type_help:
|
||||
|
||||
<?endif;?>
|
||||
_(Host access to custom networks)_:
|
||||
: <?=_var($dockercfg,'DOCKER_ALLOW_ACCESS')=='yes' ? _('Enabled') : _('Disabled')?>
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@
|
||||
$netmodel = $nic['model'] ?: 'virtio-net';
|
||||
|
||||
$net_res =$this->libvirt_get_net_res($this->conn, $nic['network']);
|
||||
$vhost = file_exists("/boot/config/network.cfg") && exec("grep -Po '^BRNICS\\[0\\]=\"\\K[^\"]+' /boot/config/network.cfg")=='';
|
||||
$vhost = !file_exists('/sys/class/net/br0');
|
||||
if ($vhost) {
|
||||
exec("ip -br a|grep -Po '^vhost[0-9][^@]*'",$br);
|
||||
} else {
|
||||
|
||||
@@ -1066,10 +1066,10 @@ private static $encoding = 'UTF-8';
|
||||
function getValidNetworks() {
|
||||
global $lv;
|
||||
$arrValidNetworks = [];
|
||||
if (file_exists("/boot/config/network.cfg") && exec("grep -Pom1 '^BRNICS\\[0\\]=\"\\K[^\"]+' /boot/config/network.cfg")=='') {
|
||||
exec("ip -br a|grep -Po '^(virbr|vhost)[0-9][^@ ]*'",$arrBridges);
|
||||
} else {
|
||||
if (file_exists('/sys/class/net/br0')) {
|
||||
exec("brctl show|grep -Po '^(vir)?br[0-9]+(\.[0-9]+)?'", $arrBridges);
|
||||
} else {
|
||||
exec("ip -br a|grep -Po '^(virbr|vhost)[0-9][^@ ]*'",$arrBridges);
|
||||
}
|
||||
if (!is_array($arrBridges)) {
|
||||
$arrBridges = [];
|
||||
|
||||
Reference in New Issue
Block a user