OpenWrt Forum Archive

Topic: WIFI disabled if wifi client interface is not connected

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have a TP-Link TL-MR3020 travel router that I'm running on OpenWrt.  It is normally configured to be a WIFI client and a WIFI AP simultaneously in routed mode.

There is a problem that if the WIFI Client isn't able to find the SSID it is configured for, the WIFI AP is also disabled.  I had the same behavior occur on DD-WRT as well.  The problem this causes is that if the AP is disabled, I can't go in to reconfigure the router for the hotel's WIFI unless I hard reset or connect to the router via ethernet.

Is there any way to change this?  If this isn't possible, is there a way to assign a custom function to the WPS button that will disable the WIFI Client interface?  I'd be able to boot the router, then press the WPS button to make the AP show up.

The actual issue (practical, not technical) is that the STAtion interface is NOT disabled.  If you open the wireless file and look at the wifi-iface for the STAtion, you will find that the "option disabled [value]" is either 0 or the line does not exist.  Setting this value to 1, (disabled) allows the AP side to resume functioning (after appropriate restart).  I think a better description is that the wireless is "hanging" as it can not connect to the STAtion, but both sides are technically enabled.

There are a few types of solutions to the problem. 

1 - Remove the iface section or update with the "option disabled '1'
2 - Swap the wireless config file with another (1 enabled file, 1 disabled file)
3 - Use some type of "wifi manager"

For option 1 there are a couple of approaches.
1 - Remove the STAtion on boot (add to the Startup => Local Startup)
2 - Remove the STAtion based on a button action (works if you have a button or switch)
The first is best if you frequently change STAtions.  I use this:  https://forum.openwrt.org/viewtopic.php … 30#p278230 and have run it both ways.  I prefer the button action.

I consider the second more of an issue, as one needs to maintain multiple files, and the code is more complicated.  You will still probably need to SCAN and select the new STAtion.  You need a trigger action like above.

The third is to use some type of "wifi manager".  I use this:
http://www.gl-inet.com/forums/topic/wif … saved-aps/
which is based upon work done by dabyd64 here:  https://forum.openwrt.org/viewtopic.php … 52&p=3

One can also use a second radio, which eliminates the issue (which is related to the single radio running both sides of the connection).  Most have reported it is not as fast as the above solutions and that you get better performance with the USB radio separated from the device by some distance.

If you have a button, try the first reference and put it into a script (/usr/bin/wifireset) and call it from the button (/etc/rc.button/reset usually).  Below is my modified reset file as an example.

.....
if [ "$SEEN" -lt 2 ]
then
    echo "Wifi On Off from button" >>/tmp/startup.log
        /usr/bin/wifionoff          

elif [ "$SEEN" -ge 5 ] && [ "$SEEN" -lt 15 ]
then

logger "Removing STA interface"
        /usr/bin/wifireset 

elif [ "$SEEN" -gt 30 ]
then                                       
        echo "FACTORY RESET" > /dev/console
        /usr/bin/flashleds &
        jffs2reset -y && reboot &          
fi     

Below are a number of other references to the issue.  There are a few variations to the first ref I have given, including the one referred to by nenekofi:
https://forum.openwrt.org/viewtopic.php … 25#p188725
https://forum.openwrt.org/viewtopic.php … 32#p311832
https://forum.openwrt.org/viewtopic.php?id=59678
https://forum.openwrt.org/viewtopic.php?id=56758
http://www.gl-inet.com/forums/topic/switching-configs/
https://forum.openwrt.org/viewtopic.php … 50#p323650
https://forum.openwrt.org/viewtopic.php?id=60291
https://wiki.openwrt.org/doc/recipes/ap_sta

I followed the "event driven" method and it works.  Thanks for your help.  My big problem was that I didn't even know what to key words search for.

EDIT:  I didn't see RangerZ's response until I implemented the automated script by MAX Hopper.  I think Max Hopper's method works well for a client that expects to be connected to the same STAtion, such as WIFI Tethering on a phone because it will automatically restore the STAtion configuration.  I have one situation where I would be doing this.  But on a travel router that I would bring with me on trips, I think the button action method is the way to go (it would simply "forget" the previous STAtion).

(Last edited by Spook on 24 May 2016, 23:25)

There is also another solution to
"I think the button action method is the way to go (it would simply "forget" the previous STAtion)"
is the use of ramdisk/swap for wireless configs.  This also saves wear on the flash.
I have implemented my own solution which works well without buttons. See link

http://www.gl-inet.com/forums/topic/roa … le-router/

The discussion might have continued from here.