What's new

[Network Map RT-AC87U] Solution to blank View List and other issues editing devices

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Alan

New Around Here
Hopefully I haven't missed someone else finding a solution to this problem that's been plaguing me.

I think I have the solution to this issue. It is related to the logic behind manually assigned IPs. I am using a RT-AC87U with the 3.0.0.4.378_9177-ge585a63 firmware. I was using the previous release (3.0.0.4.378.5134) until this morning. I set up my DHCP clients using MAC addresses I had saved in an Excel spreadsheet when I had my previous Linksys router and copying them into the form. I had seen the strange behavior previously noted when Googling for a solution (not able to edit names, etc., and the 'This entry has been in list." error) prior to this release. When trying to view the "View List", I initially got data, then subsequently got a blank page. I decided to debug the page using Chrome's debugging tools.

Here is the underlying problem, and the line numbers are from the source code in asuswrt-merlin main branch.
Root cause: I manually added MAC addresses in the manually assigned DHCP list in lower case.
The code in genClientList() in asuswrt-merlin/release/src/router/www/client_function.js line 202 loads data from both dynamic introspection and from NVRAM when you have made changes to the device names.
All the data stored in the array called clientList in the field mac are in upper case (this is important)
After populating the clientList, a number of modifications are made, including the customized names, and values from NVRAM, which begins at the loop that begins at line 458 with for(var i=0; i<originData.customList.length; i++)
Inside this loop at line 509, the mac address is overwritten with the value from NVRAM (which in my case is stored in lower case!)
When the "View List" is populated, it runs code in clients_functions.asp. In the debugger, it was failing to execute drawClientListBlock() (line 2342), failing at line 2482. clientListCode += (clientList[clientlist_sort[j].mac].isWebServer) saying that isWebServer is undefined. This is strange because the client object was being populated in genClientList() - I verified that previously
clientList[clientlist_sort[j].mac] is the culprit:
clientList is indexed by MAC address in upper case; clientList_sort is an array populated from the original genClientList(), with some of the MAC address overwritten by the contents of the NVRAM, and hence in lower case.
In the case where clientlist_sort.mac returns a lower case MAC, the line fails because it is used to index clientList[], which is in upper case. So, it finds no match.

Bug #1. Manual DHCP entry should convert MAC addresses to upper case. Simple as that.

Once I realized what happened, I went to my list of DHCP clients and deleted an entry with lower case MAC, saved it. I then manually entered the upper case MAC, and mysteriously the DHCP list already knew about my device name. I finished configuration and retested. It failed again. I went back to the DHCP list and looked at the detail of the device by clicking on the icon, and the MAC address was in lower case.

Bug #2, when you delete from the DHCP list, it does not delete the entry from NVRAM. So, the data I saved originally is brought "back from the dead" even though I thought I had deleted it. The MAC address is in lower case and non-editable.
Here's the workaround if you are brave enough to use an HTML editor. In the manual DHCP list:
1) View the device detail by clicking on the device icon.
2) In Chrome (and supposedly any other browser with a built-in debugger), right click on the MAC address field, and choose 'inspect element'. A bottom panel will open up showing the source HTML of the page.
3) In the bottom panel you will see an <input> tag saying:
<input id="client_macaddr_field" type="text" value="" class="input_32_table client_input_text_disabled" disabled>
This is the field containing the MAC address, and the element is marked as 'disabled' to stop you editing it in the device detail panel. Edit the input element (typically by double-click) and set it to 'enabled'.
<input id="client_macaddr_field" type="text" value="" class="input_32_table client_input_text_disabled" enabled>
Click enter to save the changes to the HTML.
4) In the DHCP form you can now overwrite the MAC address with the upper case value.
5) Click the Apply button. This sets the value correctly in NVRAM.
6) Repeat these steps for every lower case MAC in your DHCP table.
"View List" works like a charm.

So, in conclusion, if the manual DHCP assignment screen ensures MAC addresses are converted to upper case, none of these issues would exist. Also, deletion of a device from the manual DHCP table should also delete it from NVRAM.

I hope this helps everyone. It took me a couple of hours of debugging to work this out.
 
Thanks for this - I'll be trying this later on today.

For what it's worth I've used a script to sort the DHCP addresses by IP address available from here: https://github.com/RMerl/asuswrt-merlin/wiki/Sort-DHCP-Reservations-by-IP

With a small tweak (highlighted) you can convert the MAC addresses to uppercase automatically. Here's the code:

nvram get dhcp_staticlist | sed 's/</\n/g' | grep ":" | awk -F">" '{ print $2">"$1">"$3; }' | \
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n | awk -F">" '{ print toupper($2)">"$1">"$3; }' | \
sed 's/^/</g' | tr -d '\n' | sed 's/^/nvram set dhcp_staticlist="/' | sed 's/$/"\n/' | \
tee /tmp/dhcp_list_sorted_tmp.sh
 
Be careful with modifying the MAC address cases. There are a few places in the code where the handling isn't non-case sensitive.
 
So should we leave all the MAC addresses at lower case in the DHCP list?

I've been trying to get the network map to work for a while on my RT-N66U with no luck. I replaced it with a RT-AC87U recently and it appeared to be working at first, but once I'd replaced it properly it went back to only reporting my LinkSys smart switch on the LAN. Nothing else, wired or wireless, is reported. Clearly it's no big deal but it does niggle.

I may spend a bit of time investigating just for my own satisfaction.

By the way - thanks for all your work on this firmware RMerlin. It's very much appreciated!
 
So should we leave all the MAC addresses at lower case in the DHCP list?

Just to be safe, yes. It might not be case-sensitive, but I wouldn't take any chance since I did run into issues a year or two ago when dealing with MACs (the webui was using case sensitive compares in some areas).

I've been trying to get the network map to work for a while on my RT-N66U with no luck. I replaced it with a RT-AC87U recently and it appeared to be working at first, but once I'd replaced it properly it went back to only reporting my LinkSys smart switch on the LAN. Nothing else, wired or wireless, is reported. Clearly it's no big deal but it does niggle.

Make sure your LAN is a /24. Networkmap is hardcoded for that mask, it doesn't properly handle larger subnets (unless that has recently changed - Asus made a lot of changes recently).
 
Make sure your LAN is a /24. Networkmap is hardcoded for that mask, it doesn't properly handle larger subnets (unless that has recently changed - Asus made a lot of changes recently).

That would do it! I've got mine set to a /16 purely so I can have my devices nicely categorized. No good reason for it any more to be honest. Perhaps now that I've removed a lot of VMs I'll reshuffle it. Thanks a lot!
 
I spent a productive evening re-addressing my devices and swapped the network from a /16 to a /24 and, as you predicted, the client list now works like a charm.

Thanks again for all your hard work on this firmware and your help here. I've been meaning to do it for an age but I've finally donated a little something to the cause.
 
I'm glad that this was of help. I had seen so many comments about issues with the client list; it was nice to help contribute my little bit to this excellent firmware.
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top