|
4 | 4 | # |
5 | 5 | # Original Creation Date: 2023-Oct-01 by @ExtremeFiretop. |
6 | 6 | # Official Co-Author: @Martinski W. - Date: 2023-Nov-01 |
7 | | -# Last Modified: 2025-Jun-02 |
| 7 | +# Last Modified: 2025-Jun-08 |
8 | 8 | ################################################################### |
9 | 9 | set -u |
10 | 10 |
|
11 | 11 | ## Set version for each Production Release ## |
12 | | -readonly SCRIPT_VERSION=1.4.7 |
| 12 | +readonly SCRIPT_VERSION=1.4.8 |
13 | 13 | readonly SCRIPT_NAME="MerlinAU" |
14 | 14 | ## Set to "master" for Production Releases ## |
15 | 15 | SCRIPT_BRANCH="master" |
@@ -4638,33 +4638,38 @@ _GetLoginCredentials_() |
4638 | 4638 | return 0 |
4639 | 4639 | } |
4640 | 4640 |
|
4641 | | -##----------------------------------------## |
4642 | | -## Modified by Martinski W. [2024-Apr-06] ## |
4643 | | -##----------------------------------------## |
| 4641 | +##-------------------------------------------## |
| 4642 | +## Modified by ExtremeFiretop [2025-June-06] ## |
| 4643 | +##-------------------------------------------## |
4644 | 4644 | _GetNodeIPv4List_() |
4645 | 4645 | { |
4646 | | - # Get the value of asus_device_list # |
4647 | | - local ip_addresses |
4648 | | - local device_list="$(nvram get asus_device_list)" |
| 4646 | + local NODE_ROLE="2" # keep only nodes whose last field == 2 |
| 4647 | + local device_list ip_addresses |
4649 | 4648 |
|
4650 | | - # Check if asus_device_list is not empty # |
4651 | | - if [ -n "$device_list" ] |
4652 | | - then |
4653 | | - # Split the device list into records and extract the IP addresses, excluding Main Router LAN IP address # |
4654 | | - ip_addresses="$(echo "$device_list" | tr '<' '\n' | awk -v exclude="$mainLAN_IPaddr" -F'>' '{if (NF>=4 && $3 != exclude) print $3}')" |
| 4649 | + device_list="$(nvram get asus_device_list)" |
4655 | 4650 |
|
4656 | | - # Check if IP addresses are not empty # |
4657 | | - if [ -n "$ip_addresses" ]; then |
4658 | | - # Print each IP address on a separate line |
4659 | | - printf "%s\n" "$ip_addresses" |
4660 | | - else |
4661 | | - return 1 |
4662 | | - fi |
4663 | | - else |
| 4651 | + if [ -z "$device_list" ]; then |
4664 | 4652 | Say "NVRAM asus_device_list is NOT populated. No Mesh Nodes were found." |
4665 | 4653 | return 1 |
4666 | 4654 | fi |
4667 | | - return 0 |
| 4655 | + |
| 4656 | + ip_addresses="$( |
| 4657 | + printf '%s\n' "$device_list" | |
| 4658 | + tr '<' '\n' | |
| 4659 | + awk -F'>' \ |
| 4660 | + -v role="$NODE_ROLE" \ |
| 4661 | + -v exclude="$mainLAN_IPaddr" ' |
| 4662 | + NF >= 4 && $3 != exclude && $NF == role { print $3 } |
| 4663 | + ' |
| 4664 | + )" |
| 4665 | + |
| 4666 | + if [ -n "$ip_addresses" ]; then |
| 4667 | + printf '%s\n' "$ip_addresses" |
| 4668 | + return 0 |
| 4669 | + fi |
| 4670 | + |
| 4671 | + # nothing matched |
| 4672 | + return 1 |
4668 | 4673 | } |
4669 | 4674 |
|
4670 | 4675 | ##----------------------------------------## |
@@ -4737,9 +4742,9 @@ _GetNodeURL_() |
4737 | 4742 | echo "${urlProto}://${NodeIP_Address}${urlPort}" |
4738 | 4743 | } |
4739 | 4744 |
|
4740 | | -##----------------------------------------## |
4741 | | -## Modified by Martinski W. [2025-Mar-07] ## |
4742 | | -##----------------------------------------## |
| 4745 | +##------------------------------------------## |
| 4746 | +## Modified by ExtremeFiretop [2025-June-08] ## |
| 4747 | +##------------------------------------------## |
4743 | 4748 | _GetNodeInfo_() |
4744 | 4749 | { |
4745 | 4750 | local NodeIP_Address="$1" |
@@ -4787,11 +4792,9 @@ _GetNodeInfo_() |
4787 | 4792 |
|
4788 | 4793 | if [ $? -ne 0 ] |
4789 | 4794 | then |
4790 | | - _UpdateLoginPswdCheckHelper_ FAILURE |
4791 | 4795 | printf "\n${REDct}Login failed for AiMesh Node [$NodeIP_Address].${NOct}\n" |
4792 | 4796 | return 1 |
4793 | 4797 | fi |
4794 | | - _UpdateLoginPswdCheckHelper_ SUCCESS |
4795 | 4798 |
|
4796 | 4799 | # Retrieve the HTML content # |
4797 | 4800 | htmlContent="$(curl -s -k "${NodeURLstr}/appGet.cgi?hook=nvram_get(productid)%3bnvram_get(asus_device_list)%3bnvram_get(cfg_device_list)%3bnvram_get(firmver)%3bnvram_get(buildno)%3bnvram_get(extendno)%3bnvram_get(webs_state_flag)%3bnvram_get(odmpid)%3bnvram_get(wps_modelnum)%3bnvram_get(model)%3bnvram_get(build_name)%3bnvram_get(lan_hostname)%3bnvram_get(webs_state_info)%3bnvram_get(label_mac)" \ |
|
0 commit comments