Fix AiMesh 2nd Login Attempt - #615
ExtremeFiretop wants to merge 11 commits into
Conversation
Log out of an AiMesh node immediately when merlinau_fw_update=1 is detected. Skip all further node actions / status while that node is flashing. Report actively flashing nodes as busy instead of failed/unreachable in mn screen. Clean up per-run AiMesh state properly. Preserve failed WebUI login diagnostics in JFFS. Protect concurrent diagnostic writes. Reuse existing log-retention mechanism for the new diagnostic logs.. Clear the firmware-update guard on failed or aborted updates.
Fix Logout Request... Standardizing node logouts
removes the ineffective 5-second wait for login_ip_str to clear... if the existing cookie has failed and login_ip_str is still populated, restarts httpd
improve wording
|
I won't lie. But they only worked for me and @TheS1R because we had set the re_mode nvram value which allowed us to view and login to the node WebUI. So this entire time the logout only worked because in my testing and development of the logout request, I had my node operating as a router. And it's WebUI restrictions were disabled. Now, I don't think this is a reason to fully remove it. Many people are aware of the workaround to disable the restrictions on nodes. And otherwise it's a no-op and does nothing but send back a redirect request. So I won't remove it. But I've clearly documented it in the notes, basically does nothing so I'll stop assuming in the future that the logouts actually work normally. Long story short, that's the reason I pivoted from just doing a logout from the primary router to also doing a httpd restart on the node. |
Moving the flashing wording
wording improvements
|
In general, the PR looks good, but I do have some questions, as noted above in my review comments. Perhaps I'm already too tired, but I feel like something may be missing...(??) Talk to you tomorrow when my brain has recharged and my mind is clearer... :>). |
Additional cleanup
Correct date

@Martinski4GitHub
Extension of your PR: #603
Currently, the code allows the node to try a second time when it detects a stale cookie/session
However, the primary does not attempt to "logout" after it invalidates the nodes cookie first, and grabs the node data / flashing status. This means the node is not actually allowed to login on the second attempt. Since the first session is still held by the primary router.
See the below error I received while testing for release:
I've adjusted the logic so as soon as the primary logs into the node, grabs the flashing status, it sends a logout.
I also learned that routers with nvram set: re_mode=1 will reject a logout request from the primary router anyways. https://github.com/RMerl/asuswrt-merlin.ng/blob/53680019cc1491452ecda2824e1b43f32a34d61b/release/src/router/httpd/httpd.c#L1672
Due to this, I used a bounced attempt to restart the httpd service which will release the primary router session and invalidate it's cookie, and allow the second login to work from the node.
I kept the attempted logout in place in case it works, for example, on my older routers on 3004 firmware.
However the real save will end up being the httpd restart.
Additionally, I added some nicer formatting around the (mn) menu as found below:

I also found a bug not releasing/resetting the flashing flag we setup: merlinau_fw_update
and resolved that as well.. It should now say:
Cleared AiMesh F/W-update NVRAM guard [merlinau_fw_update].As found below:
