From 39e544fd0d92752f57fc99b9dc305045dadef64c Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 30 Jun 2021 07:41:25 +0200 Subject: [PATCH 01/10] Remove debug/test code --- plugins/dynamix/nchan/update_3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dynamix/nchan/update_3 b/plugins/dynamix/nchan/update_3 index 5cc3bcd1a..62bf3fb0d 100755 --- a/plugins/dynamix/nchan/update_3 +++ b/plugins/dynamix/nchan/update_3 @@ -63,7 +63,7 @@ while (true) { $echo[] = "$port\0$rx_speed\0$tx_speed\0$rxd\0$txd"; // interface general information $mtu = port_get_contents("$net/$port/mtu"); - $link = true; //port_get_contents("$net/$port/carrier")==1; + $link = port_get_contents("$net/$port/carrier")==1; if (substr($port,0,4)=='bond') { if ($link) { $bond_mode = file_exists("$bond/$port") ? str_replace('Bonding Mode: ','',@file("$bond/$port",FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)[1]) : '---'; From e09c4e64693d047af0ebbc76b044cbcb446cfc6d Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 2 Jul 2021 11:15:31 +0200 Subject: [PATCH 02/10] Rearrange buttons in Mover settings --- plugins/dynamix/MoverSettings.page | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/dynamix/MoverSettings.page b/plugins/dynamix/MoverSettings.page index 3108d5f42..939027845 100644 --- a/plugins/dynamix/MoverSettings.page +++ b/plugins/dynamix/MoverSettings.page @@ -118,16 +118,16 @@ _(Mover logging)_: :mover_logging_help: - -  -: - + -  - -: _(Mover is running)_. + + _(Mover is running)_ -: _(Click to invoke the Mover)_. + _(Click to invoke the Mover)_ + +  + +: From bd6342ed7073f1f4be509cd550b1f9b380df16e1 Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 2 Jul 2021 12:25:36 +0200 Subject: [PATCH 03/10] Suppress error messages when validating DNS --- plugins/dynamix/ManagementAccess.page | 38 ++++++++++++++------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/plugins/dynamix/ManagementAccess.page b/plugins/dynamix/ManagementAccess.page index d1598f650..b3b3592d7 100644 --- a/plugins/dynamix/ManagementAccess.page +++ b/plugins/dynamix/ManagementAccess.page @@ -38,30 +38,32 @@ function find_tasks() { sort($tasks); return $tasks; } -$tasks = find_tasks(); -$internalip = $eth0['IPADDR:0']; -$keyfile = @file_get_contents($var['regFILE']); +$tasks = find_tasks(); +$internalip = $eth0['IPADDR:0']; +$rebindip = "192.168.42.42"; +$keyfile = @file_get_contents($var['regFILE']); if ($keyfile !== false) $keyfile = base64_encode($keyfile); -$certFile = "/boot/config/ssl/certs/certificate_bundle.pem"; +$certFile = "/boot/config/ssl/certs/certificate_bundle.pem"; $certPresent = file_exists("$certFile"); -$certSubject=""; -if ($certPresent) $certSubject = exec("/usr/bin/openssl x509 -noout -subject -nameopt multiline -in $certFile | /usr/bin/sed -n 's/ *commonName *= //p'"); -$isLEcert = $certPresent && preg_match('/.*\.unraid\.net$/', $certSubject); +$certSubject = $certPresent ? exec("openssl x509 -noout -subject -nameopt multiline -in $certFile 2>/dev/null|sed -n 's/ *commonName *= //p'") : ""; +$isLEcert = $certPresent && preg_match('/.*\.unraid\.net$/', $certSubject); + if ($isLEcert) { - exec("/usr/bin/openssl x509 -checkend 2592000 -noout -in $certFile",$arrout,$retval_expired); - $rebindtest_ip = exec("/usr/bin/host -4 rebindtest.unraid.net |sed -n 's/.*has address //p'"); - $dnsRebindingProtection = ($rebindtest_ip != "192.168.42.42"); + exec("openssl x509 -checkend 2592000 -noout -in $certFile 2>/dev/null", $arrout,$retval_expired); + $rebindtest_ip = exec("host -4 rebindtest.unraid.net 2>/dev/null|sed -n 's/.*has address //p'"); + $dnsRebindingProtection = ($rebindtest_ip != $rebindip); if (!$dnsRebindingProtection) { - $certtest_ip = exec("/usr/bin/host -4 $certSubject |sed -n 's/.*has address //p'"); + $certtest_ip = exec("host -4 $certSubject 2>/dev/null|sed -n 's/.*has address //p'"); $dnsValid = ($certtest_ip == $internalip); } // more: similar test for "www.$certSubject" dns valid goes here } -$provisionlabel = $isLEcert ? _('Renew') : _('Provision'); + +$provisionlabel = $isLEcert ? _('Renew') : _('Provision'); $disabled_provision = $keyfile===false || ($isLEcert && $retval_expired===0) ? 'disabled' : ''; $disabled_updatedns = $keyfile!==false && $isLEcert ? '' : 'disabled'; -$disabled_delete = $certPresent && $var['USE_SSL']!='auto' ? '' : 'disabled'; -$disabled_auto = $isLEcert && !$dnsRebindingProtection && $dnsValid ? '' : 'disabled'; +$disabled_delete = $certPresent && $var['USE_SSL']!='auto' ? '' : 'disabled'; +$disabled_auto = $isLEcert && !$dnsRebindingProtection && $dnsValid ? '' : 'disabled'; // Get ports in use $portsInUse = []; @@ -139,10 +141,10 @@ function checkPorts(form,provision) { swal({title:'_(Port out of range)_',text:sprintf('_(Port %s is out of range (minimum 1 maximum 65535))_',range.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"}); return false; } -// if ( list.length > 0 ) { -// swal({title:'_(Port already in use)_',text:sprintf('_(Port %s is already in use by other services)_',list.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"}); -// return false; -// } + if ( list.length > 0 ) { + swal({title:'_(Port already in use)_',text:sprintf('_(Port %s is already in use by other services)_',list.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"}); + return false; + } if ( duplicates.length > 0 ) { swal({title:'_(Duplicate port entered)_',text:sprintf('_(Port %s is duplicated)_',duplicates.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"}); return false; From f1befe33a2d2d89c945bb4b8b4a0a33a420c4db7 Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 2 Jul 2021 16:21:07 +0200 Subject: [PATCH 04/10] Fix SMART regression error and increase Adaptec devices --- plugins/dynamix/DeviceInfo.page | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index 112b8151c..fe37334b8 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -19,6 +19,7 @@ require_once "$docroot/webGui/include/Preselect.php"; $unassigned = array_key_exists($name, $devs); $disks = array_merge_recursive($disks, $devs); $disk = &$disks[$name]; +$dev = $disk['device']; $events = explode('|',$disk['smEvents'] ?? $var['smEvents'] ?? $numbers); $bgcolor = strstr('white,azure',$display['theme']) ? '#f2f2f2' : '#1c1c1c'; $yes = _('Yes'); @@ -95,7 +96,7 @@ function setGlue(form,reset) { {glue:',',more:2,dev:0,type:'select',min11:'',min12:'auto',min21:'',min22:12,min23:16}, // sat {glue:'' ,more:0,dev:0,type:''}, // scsi {glue:',',more:1,dev:1,type:'',min1:0,max1:127}, // 3ware - {glue:',',more:3,dev:1,type:'',min1:0,max1:15,min2:0,max2:7,min3:0,max3:7}, // adaptec + {glue:',',more:3,dev:1,type:'',min1:0,max1:15,min2:0,max2:7,min3:0,max3:15}, // adaptec {glue:'/',more:2,dev:1,type:'',min1:1,max1:128,min2:1,max2:8}, // areca {glue:'/',more:3,dev:1,type:'',min1:1,max1:4,min2:1,max2:128,min3:1,max3:4}, // highpoint {glue:'' ,more:1,dev:1,type:'',min1:0,max1:15}, // hp cciss From 2fa1467f9d8583088b6a511bb857f3db09f9613a Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 2 Jul 2021 18:16:47 +0200 Subject: [PATCH 05/10] Fix SMART settings for individual disks --- plugins/dynamix/DeviceInfo.page | 60 +++++++++++--------------- plugins/dynamix/include/Dispatcher.php | 30 ------------- 2 files changed, 25 insertions(+), 65 deletions(-) delete mode 100644 plugins/dynamix/include/Dispatcher.php diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index fe37334b8..b7dd8a02c 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -20,6 +20,7 @@ $unassigned = array_key_exists($name, $devs); $disks = array_merge_recursive($disks, $devs); $disk = &$disks[$name]; $dev = $disk['device']; +$id = $disk['id']; $events = explode('|',$disk['smEvents'] ?? $var['smEvents'] ?? $numbers); $bgcolor = strstr('white,azure',$display['theme']) ? '#f2f2f2' : '#1c1c1c'; $yes = _('Yes'); @@ -62,19 +63,6 @@ if ($.cookie('deletepool')!=null) { $.removeCookie('deletepool'); done(); } -function doDispatch(form) { - var fields = {}; - - var hottemp = $(form).find('input[name="_hotTemp"]'); - var maxtemp = $(form).find('input[name="_maxTemp"]'); - if (hottemp.val()>0) hottemp.val(Math.round((hottemp.val()-32)*5/9)); - if (maxtemp.val()>0) maxtemp.val(Math.round((maxtemp.val()-32)*5/9)); - - fields['#cfg'] = "/boot/config/smart-one.cfg"; - fields['#cleanup'] = true; - $(form).find('input[name^="_"]').each(function(){fields[$(this).attr('name').replace(/\./g,'%3E')] = $(this).val(); $(this).prop('disabled',true);}); - $.post('/webGui/include/Dispatcher.php',fields); -} function prepareDeviceInfo(form) { var events = []; for (var i=0; i < ; i++) { @@ -85,8 +73,12 @@ function prepareDeviceInfo(form) { custom = custom.length ? custom.split(',') : []; for (var i=0; i < custom.length; i++) events.push(custom[i].trim()); form.smEvents.value = events.join('|'); - if (form.smEvents.value == '') form.smEvents.value = ''; + if (form.smEvents.value == '') form.smEvents.value = ''; if (form.smLevel.value == 1.00) form.smLevel.value = ''; + + if (form.hotTemp.value>0) form.hotTemp.value = Math.round((form.hotTemp.value-32)*5/9); + if (form.maxTemp.value>0) form.maxTemp.value = Math.round((form.maxTemp.value-32)*5/9); + } function setGlue(form,reset) { var data = @@ -355,7 +347,7 @@ _(Identification)_: _(Identification)_: -:  () +:  () @@ -422,7 +414,6 @@ _(File system type)_: - _(Enable user share assignment)_: : @@ -571,9 +561,9 @@ _(btrfs scrub status)_:
_(Check Filesystem Status)_
-
+ - + _(btrfs check status)_: : ".implode("\n", $check_status).""?> @@ -582,7 +572,7 @@ _(btrfs check status)_: - +   : _(Options (see Help))_ @@ -593,7 +583,7 @@ _(btrfs check status)_: - +   : *_(Running)_* @@ -617,9 +607,9 @@ _(btrfs check status)_:
_(Check Filesystem Status)_
- + - + _(reiserfsck status)_: : ".implode("\n", $check_status).""?> @@ -628,7 +618,7 @@ _(reiserfsck status)_: - +   : _(Options (see Help))_ @@ -639,7 +629,7 @@ _(reiserfsck status)_: - +   : *_(Running)_* @@ -657,9 +647,9 @@ _(reiserfsck status)_:
_(Check Filesystem Status)_
- + - + _(xfs_repair status)_: : ".implode("\n", $check_status).""?> @@ -668,7 +658,7 @@ _(xfs_repair status)_: - +   : _(Options (see Help))_ @@ -698,20 +688,20 @@ _(xfs_repair status)_:
_(SMART Settings)_
- - + + - + - + _(Warning disk temperature threshold)_ (°): -: +: :info_warning_temp_help: _(Critical disk temperature threshold)_ (°): -: +: :info_critical_temp_help: @@ -757,7 +747,7 @@ _(SMART controller type)_: /dev/ - enter disk index and device name as applicable to your controller + enter disk index and device name as applicable to your controller :info_controller_type_help: diff --git a/plugins/dynamix/include/Dispatcher.php b/plugins/dynamix/include/Dispatcher.php deleted file mode 100644 index ed1994cae..000000000 --- a/plugins/dynamix/include/Dispatcher.php +++ /dev/null @@ -1,30 +0,0 @@ - - $value) { - if ($field[0] == '#') continue; - $n = strrpos($field,'_'); - $section = str_replace('%3E','.',substr($field,0,$n)); - $key = substr($field,$n+1); - $keys[$section][$key] = $value; -} -foreach ($keys as $section => $block) { - $pairs = ""; - foreach ($block as $key => $value) if (strlen($value) || !$cleanup) $pairs .= "$key=\"$value\"\n"; - if ($pairs) $text .= "[$section]\n".$pairs; -} -if ($text) file_put_contents($_POST['#cfg'], $text); else @unlink($_POST['#cfg']); -?> From d8a62e6f050eb372affd5750c87e4ea3cf8f7a7b Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 2 Jul 2021 18:27:01 +0200 Subject: [PATCH 06/10] Fix SMART settings for individual disks --- plugins/dynamix/DeviceInfo.page | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index b7dd8a02c..15b577bfa 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -747,7 +747,7 @@ _(SMART controller type)_: /dev/ - enter disk index and device name as applicable to your controller + _(enter disk index and device name as applicable to your controller)_ :info_controller_type_help: From 995c5feda6dd86201b54620523b3c618a6d0f65b Mon Sep 17 00:00:00 2001 From: bergware Date: Fri, 2 Jul 2021 18:42:41 +0200 Subject: [PATCH 07/10] Fix SMART settings for individual disks --- plugins/dynamix/DeviceInfo.page | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index 15b577bfa..f5ca278f0 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -54,8 +54,9 @@ $text = in_array($name,$pools) ? _('This will ERASE content of ALL devices in th ">