From 3471bf0f367b0d2a0f284a8664be2bd0ad1b866e Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Fri, 5 May 2017 10:18:30 -0500 Subject: [PATCH] webGui: networking now allows multi bonds and multi bridge groups --- plugins/dynamix/Eth0.page | 162 ++++++++++---------- plugins/dynamix/EthX.page | 114 ++++++++++---- plugins/dynamix/include/update.ethernet.php | 14 +- plugins/dynamix/scripts/netconfig | 73 +++++---- plugins/dynamix/styles/default-black.css | 2 +- plugins/dynamix/styles/default-white.css | 2 +- 6 files changed, 213 insertions(+), 154 deletions(-) diff --git a/plugins/dynamix/Eth0.page b/plugins/dynamix/Eth0.page index 2b04c8aca..12b11f7f5 100644 --- a/plugins/dynamix/Eth0.page +++ b/plugins/dynamix/Eth0.page @@ -1,4 +1,4 @@ -Menu="NetworkSettings" +Menu="NetworkSettings:100" Title="Interface eth0" Png="ethernet.png" --- @@ -15,6 +15,8 @@ Png="ethernet.png" */ ?> $value) { + if ($member == $source) continue; + if ($value['BONDING']=='yes' && in_array($port,explode(',',$value['BONDNICS']))) return $value['BONDNAME'].' '.$member; + if ($value['BRIDGING']=='yes' && in_array($port,explode(',',$value['BRNICS']))) return $value['BRNAME'].' '.$member; + } + return false; +} // remove non-existing ethernet ports foreach (glob("$docroot/webGui/Eth[1-9]*.page",GLOB_NOSORT) as $port) { if (!in_array(strtolower(basename($port,'.page')), $ports)) { @@ -32,11 +43,16 @@ foreach (glob("$docroot/webGui/Eth[1-9]*.page",GLOB_NOSORT) as $port) { } } // add new ethernet ports -foreach ($ports as $port) { - $file = "$docroot/webGui/".ucfirst($port).".page"; +foreach ($ports as $ethX) { + $file = "$docroot/webGui/".ucfirst($ethX).".page"; if (!file_exists($file)) { + $X = filter_var($ethX,FILTER_SANITIZE_NUMBER_INT); + $nnn = 100 + $X; + $tabX = 'tab'.($X+1); + $bondX = 'bond'.$X; + $brX = 'br'.$X; copy($template, $file); - exec("sed -i 's/x-settings/NetworkSettings/;s/ethX/$port/g' $file"); + exec("sed -i 's/parentname:nnn/NetworkSettings:$nnn/;s/tabX/$tabX/;s/bondX/$bondX/g;s/brX/$brX/g;s/ethX/$ethX/g' $file"); $build = true; } } @@ -48,8 +64,9 @@ $service .= exec("pgrep docker") ? ($service ? ' and ' : '').'Docker service' : $no_eth0 = exec("ip link show eth0|grep -Pom1 '(NO-CARRIER|state DOWN)'"); // get VLAN interfaces +$vlan_id = 'VLANID:'; $vlan_eth0 = [0]; -if (isset($eth0)) foreach ($eth0 as $key => $val) if (substr($key,0,6)=='VLANID') $vlan_eth0[] = substr($key,7); +if (isset($eth0)) foreach ($eth0 as $key => $val) if (strpos($key,$vlan_id)===0) $vlan_eth0[] = substr($key,strlen($vlan_id)); ?>