From 90499aabb8519f7521c65cb8ba96faed34eb30a6 Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 5 May 2023 22:42:21 +0200 Subject: [PATCH 1/5] netconfig: PHP8 fix and regression fix --- plugins/dynamix/scripts/netconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/dynamix/scripts/netconfig b/plugins/dynamix/scripts/netconfig index 12c68ff15..326669ac8 100755 --- a/plugins/dynamix/scripts/netconfig +++ b/plugins/dynamix/scripts/netconfig @@ -21,7 +21,7 @@ function ifname($name) { global $old; if (!$name) return; for ($i=0; $i<$old['SYSNICS']; $i++) { - $nics = $old['BONDNICS'][$i] ?: $old['BRNICS'][$i]; + $nics = $old['BONDNICS'][$i] ?? $old['BRNICS'][$i] ?? ''; if (strpos("$nics ","$name ")!==false) return $old['IFNAME'][$i]; } return $name; @@ -40,7 +40,7 @@ function bridge_nics(&$bridge,$nic) { if ($run) { $old = []; if (file_exists($cfg)) { - $old = parse_ini_string(preg_replace('/^#/m',';',file_get_contents($cfg))); + $old = parse_ini_string(preg_replace(['/^#/m',"/\r/m"],[';',''],file_get_contents($cfg))); if (isset($old['SYSNICS'])) { // new syntax $ifname = ifname($set); @@ -95,8 +95,8 @@ foreach ($ini as $name => $port) { 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']) && $USE_DHCP6!='no') continue; - if (preg_match('/^DNS_SERVER/',$key) && (empty($DHCP_KEEPRESOLV) || $DHCP_KEEPRESOLV=='no')) continue; - if (preg_match('/^DNS6_SERVER/',$key) && (empty($DHCP6_KEEPRESOLV) || $DHCP6_KEEPRESOLV=='no')) continue; + if (preg_match('/^DNS_SERVER/',$key) && isset($DHCP_KEEPRESOLV) && $DHCP_KEEPRESOLV=='no') continue; + if (preg_match('/^DNS6_SERVER/',$key) && isset($DHCP6_KEEPRESOLV) && $DHCP6_KEEPRESOLV=='no') continue; if ($item=='PRIVACY6' && $PROTOCOL=='ipv4') continue; if ($item=='METRIC' && $PROTOCOL=='ipv6') continue; if ($item=='METRIC6' && $PROTOCOL=='ipv4') continue; From 40ecff3bb021d3e169b18e340971f779d7dc0be1 Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 5 May 2023 22:47:56 +0200 Subject: [PATCH 2/5] netconfig: PHP8 fix and regression fix --- plugins/dynamix/scripts/netconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dynamix/scripts/netconfig b/plugins/dynamix/scripts/netconfig index 326669ac8..8b88a1a6d 100755 --- a/plugins/dynamix/scripts/netconfig +++ b/plugins/dynamix/scripts/netconfig @@ -46,7 +46,7 @@ if ($run) { $ifname = ifname($set); } else { // legacy syntax - if ($set=='eth0') $ifname = $old['BRIDGING']=='yes' ? ($old['BRNAME'] ?: 'br0') : ($old['BONDING']=='yes' ? ($old['BONDNAME'] ?: 'bond0') : $set); + if ($set=='eth0') $ifname = $old['BRIDGING']=='yes' ? ($old['BRNAME'] ?? 'br0') : ($old['BONDING']=='yes' ? ($old['BONDNAME'] ?? 'bond0') : $set); } } exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_stop")." >/dev/null"); From 86357dbde81ac1f75bc602a5fc4eccb8c2e47442 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 May 2023 01:07:14 +0200 Subject: [PATCH 3/5] Network settings: fix bug in description field --- plugins/dynamix/Eth0.page | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/dynamix/Eth0.page b/plugins/dynamix/Eth0.page index ed0addae5..2b97cca5b 100644 --- a/plugins/dynamix/Eth0.page +++ b/plugins/dynamix/Eth0.page @@ -350,15 +350,15 @@ function disableForm(form) { $(form).find('input[name^="DESCRIPTION"],input[name^="#"]').prop('disabled',false); } var stopEvent = false; -function exitCode(form,key) { +function noRun(form) { + var arg1 = $(form).find('input[name="#arg[1]"]'); + if (arg1.val()=='') arg1.val('none'); + stopEvent = true; +} +function doRun(form) { if (stopEvent) {stopEvent = false; return;} var arg1 = $(form).find('input[name="#arg[1]"]'); - if (!key) { - arg1.val($(form).find('input[name="#section"]').val()); - } else { - if (arg1.val()=='') arg1.val('none'); - stopEvent = true; - } + arg1.val($(form).find('input[name="#section"]').val()); } function portcheck_eth0() { $.post('/webGui/include/CheckPort.php',{port:'eth0'},function(text) { @@ -437,7 +437,7 @@ $(function() { watchDHCP.start(); }); -
+ @@ -450,7 +450,7 @@ $(function() { _(Interface description)_: : - " oninput="exitCode(this.form,true)"> + " oninput="noRun(this.form)"> :eth_interface_description_help: @@ -669,7 +669,7 @@ _(Enable VLANs)_: