What's new

Any well to tell from script if router is mesh node?

  • 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!

cmkelley

Very Senior Member
Is there an NVRAM variable or some other trick to determine in a script if it is running on a node or on the main router? I tried searching the NVRAM variables for something obvious, but either there's not an obvious one, or what's obvious to someone else isn't to me. :)
 
Possibly with sw_mode.
 
I have this code in Diversion, my guess is that mesh node is either 4 or a new value of 5, I have not checked. Let me know if you do:
Code:
if [ "$(nvram get sw_mode)" != "1" ]; then
    case "$(nvram get sw_mode)" in
        2)    rtrMode="Repeater";;
        3|4)rtrMode="Access Point (AP) or Media Bridge";;
    esac
    lastError=" Router is in $rtrMode mode,\\n $NAME cannot work in this mode."
    reload_d_menu
else
    echo "${OK} Wireless router mode"
fi
 
Possibly with sw_mode.
I'll try it. Sorry if I put the original post in the wrong spot, I forgot scripts only work on mesh nodes with your firmware.
I have this code in Diversion, my guess is that mesh node is either 4 or a new value of 5, I have not checked. Let me know if you do:
Code:
if [ "$(nvram get sw_mode)" != "1" ]; then
    case "$(nvram get sw_mode)" in
        2)    rtrMode="Repeater";;
        3|4)rtrMode="Access Point (AP) or Media Bridge";;
    esac
    lastError=" Router is in $rtrMode mode,\\n $NAME cannot work in this mode."
    reload_d_menu
else
    echo "${OK} Wireless router mode"
fi
Nope, I get 3 on my 68U mesh node. My 86U main router returns 1. But that's good enough for what I want to do, which is detect if scribe is running on the main router or a node.
 
here are the various modes as defined in libshared:

Code:
enum {
        SW_MODE_NONE=0,
        SW_MODE_ROUTER,
        SW_MODE_REPEATER,       /* Ralink/MTK/QCA: if wlc_psta = 1, Media bridge mode. */
        SW_MODE_AP,             /* Broadcom:       if wlc_psta = 1, Media bridge mode. */
        SW_MODE_HOTSPOT
};

No explicit mention of AiMesh nodes. But it points out that wlc_psta might be another potential variable to review.
 
here are the various modes as defined in libshared:

Code:
enum {
        SW_MODE_NONE=0,
        SW_MODE_ROUTER,
        SW_MODE_REPEATER,       /* Ralink/MTK/QCA: if wlc_psta = 1, Media bridge mode. */
        SW_MODE_AP,             /* Broadcom:       if wlc_psta = 1, Media bridge mode. */
        SW_MODE_HOTSPOT
};

No explicit mention of AiMesh nodes. But it points out that wlc_psta might be another potential variable to review.
wlc_psta returns 0 for the main router, 2 for the node.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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

Staff online

Top