mirror of
https://github.com/unraid/webgui.git
synced 2026-03-12 22:09:53 -05:00
Major network enhancements
This commit is contained in:
@@ -78,6 +78,7 @@ foreach ($ini as $name => $port) {
|
||||
$new[] = "IFNAME[$i]=\"$iface\"";
|
||||
if ($set==$name) $ifname = $iface;
|
||||
foreach ($port as $key => $val) {
|
||||
if (!strlen($val)) continue;
|
||||
if (preg_match('/^(TYPE|BONDING$|BRIDGING)/',$key)) continue;
|
||||
if (!$bonding && preg_match('/^(BONDING_MODE|BONDING_MIIMON|BONDNICS|BONDNAME)/',$key)) continue;
|
||||
if (!$bridging && preg_match('/^(BRSTP|BRFD|BRNICS|BRNAME)/',$key)) continue;
|
||||
@@ -87,6 +88,17 @@ foreach ($ini as $name => $port) {
|
||||
$vlan = ",$j]";
|
||||
} else $vlan = '';
|
||||
if (!$vlan && preg_match('/^VLANID/',$key)) continue;
|
||||
if ($item=='DHCP_KEEPRESOLV') $DHCP_KEEPRESOLV = $val;
|
||||
if ($item=='DHCP6_KEEPRESOLV') $DHCP6_KEEPRESOLV = $val;
|
||||
if ($item=='PROTOCOL') $PROTOCOL = $val;
|
||||
if ($item=='USE_DHCP') $USE_DHCP = $val;
|
||||
if ($item=='USE_DHCP6') $USE_DHCP6 = $val;
|
||||
if (in_array($item,['IPADDR','NETMASK','GATEWAY']) && $USE_DHCP!='no') continue;
|
||||
if (in_array($item,['IPADDR6','NETMASK6','GATEWAY6','PRIVACY6']) && $USE_DHCP6!='no') continue;
|
||||
if (preg_match('/^DNS_SERVER/',$key) && $DHCP_KEEPRESOLV=='no') continue;
|
||||
if (preg_match('/^DNS6_SERVER/',$key) && $DHCP6_KEEPRESOLV=='no') continue;
|
||||
if ($item=='METRIC' && $PROTOCOL == 'ipv6') continue;
|
||||
if ($item=='METRIC6' && $PROTOCOL == 'ipv4') continue;
|
||||
$new[] = $item.(preg_match('/^(DNS6?_SERVER|DHCP6?_KEEPRESOLV)/',$key)?'':'['.$i.($vlan?'':']')).$vlan."=\"$val\"";
|
||||
}
|
||||
if ($trunk) $new[] = "VLANS[$i]=\"".($j+1)."\"";
|
||||
@@ -99,7 +111,6 @@ file_put_contents($cfg,implode("\r\n",$new)."\r\n");
|
||||
// don't execute when only interface description has changed
|
||||
if ($run) {
|
||||
exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_start")." >/dev/null");
|
||||
sleep(1);
|
||||
exec("/usr/local/sbin/create_network_ini >/dev/null");
|
||||
}
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user