Re-introduce macvlan / ipvlan selection when bridge is enabled

This commit is contained in:
bergware
2023-08-10 03:26:04 +02:00
parent 5e6f8656ac
commit 180c4c2e91
5 changed files with 45 additions and 12 deletions

View File

@@ -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>&nbsp;_(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')?>