OpenWrt Forum Archive

Topic: [Howto](AAP) Automated Wifi network change if the current fails

The content of this topic has been archived between 1 Sep 2014 and 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Admittedly I was dumbfounded after reading this petulant post a good 3X.

Following instructions appears not to be a prerequiste for admission to this forum.

Nowhere in the clearly documented 7 steps is it given to 'name' a section - wifi-iface, yet there is proof -

RangerZ wrote:
config wifi-iface 'STA_name'
    option network 'wwan'
    option encryption 'psk2'
    ...

Which results in the documented initialisation failure of the section - wifi-iface network wwan -

RangerZ wrote:
...
Thu Feb 11 20:56:29 2016 user.notice DEBUG: hotplug (iface): action='ifup' devicename='' devname='' devpath='' product='' type='' interface='lan' 
Thu Feb 11 20:56:30 2016 user.notice DEBUG: hotplug (iface): action='ifup' devicename='' devname='' devpath='' product='' type='' interface='loopback'

Contrasted with -

RangerZ wrote:
...
Thu Feb 11 21:14:55 2016 user.notice DEBUG: hotplug (iface): action='ifup' devicename='' devname='' devpath='' product='' type='' interface='lan' 
Thu Feb 11 21:14:55 2016 user.notice DEBUG: hotplug (iface): action='ifup' devicename='' devname='' devpath='' product='' type='' interface='loopback' 
Thu Feb 11 21:16:08 2016 user.notice DEBUG: hotplug (iface): action='ifup' devicename='' devname='' devpath='' product='' type='' interface='wwan' 

where the section - wifi-iface network wwan is anonymous.

Here, remedial *nix is required -

RangerZ wrote:

after a few minutes i reran the log read

/etc/config$ /etc/config$ logread -e DEBUG
-ash: /etc/config$: not found

N.B. -

ash wrote:

/etc/config$: not found

/etc/config is a directory, not a command.

In all situations where placement of the hotplug filter scripts is adhered to, logger commands will write messages to the log buffer which are available to extract with logread.

HTH

Hi all,
I'd like to try the script but I can't get the code from dropbox (it says too much activities on the account so no more download).
Is there anyone who can upload the latest release somewhere ?
Thank you !

Jay_74 wrote:

Hi all,
I'd like to try the script but I can't get the code from dropbox (it says too much activities on the account so no more download).
Is there anyone who can upload the latest release somewhere ?
Thank you !

No problem, updated links, now uploaded to Mega. The excessive openwrt firmware downloads from other thread blocked my account temporary...
There are two versions:
WifiMgr 1.0 switches the wifi network ONLY when the network fails
WifiMgr 1.0b also checks every few seconds if the preferred network is available, and switches to it if it's not connected to it already. This behaviour will cause constant drops if the preferred network fails often, as it will be switching constantly!

https://mega.nz/#F!KUcVSb6L!UvNxZlm1VsiyFAW3n6wAzA

(Last edited by dabyd64 on 22 Apr 2016, 20:58)

Hi.

Daby64, the mega account is not working.
Can you uoload your script again, pls?
Thx

I have a WISP that I am trying to connect to that I have configured in wifiMgr.  The password is an obscure string starting with a $.  It is not properly parsed and the connection fails. 

I am wondering it there is a character restriction of some type or some other issue.

net7_key="$y6L&Aiz"

In Luci it returns just the last 4 characters (&Aiz).

Escape the special characters.

+1 Escape special characters, example yours:
net7_key="\$y6L&Aiz"
https://s19.postimg.org/5t7r5ua8j/Sin_t_tulo.png

(Last edited by dabyd64 on 22 Aug 2016, 14:24)

Thank you!

Are there any other special characters that one needs to be aware of?  I have tested most if not all of the other non-alpha\numeric characters and not found any.  The double quote (") and apostrophe (`) put me into some other mode that I am not familiar with

root@MLWG2:~# net7_key="`6L&Aiz";echo $net7_key
>

There are lots of special cases in sh that you need to be aware of. It's best to experiment on a case by case basis or use hexadecimal. I'm not familiar with the script in question, so it could also impose additional restrictions on top of what is mentioned here if quoting is not used with due diligence in the implementation.

key1="what's up?"
key2='what"s up?'
key3="what\"s up?"
key4="back\`tick"
key5=`printf "\x21hi\22there\x23"`

You could find many guides if you are interested, though I'm not sure which one to recommend:

From BASH reference manual:
Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’,

RangerZ wrote:

Thank you!

Are there any other special characters that one needs to be aware of?  I have tested most if not all of the other non-alpha\numeric characters and not found any.  The double quote (") and apostrophe (`) put me into some other mode that I am not familiar with

root@MLWG2:~# net7_key="`6L&Aiz";echo $net7_key
>

(Last edited by bkil on 27 Aug 2016, 13:32)

Thanks for the links.  Good for reference.

Hi! I'm very interested in your tool, but the link to mega.nz/... does not work anymore. Could you upload it again?
Thanks!

Hi!
Can you please re-upload the files? because the given links are not working.
Thank you

hey!

when i followed the steps specified by RangerZ's version of the package, i got a message which said that "your hardware does not support multiple ssid"

does this mean that i will not be able to use this package or that i cannot connect to more than one wifi?

im a beginner at this, please let me know.

It means that the HW is not capable of hosting more than one wireless connection.  It should not be related to the package.

Worth noting your device\radio for others to be aware of.

Not sure if someone else suggested this, but why not submit this as a package on GitHub?

Jay_74 wrote:

Hi all,
I'd like to try the script but I can't get the code from dropbox (it says too much activities on the account so no more download).
Is there anyone who can upload the latest release somewhere ?
Thank you !


idefixx2 wrote:

Hi! I'm very interested in your tool, but the link to mega.nz/... does not work anymore. Could you upload it again?
Thanks!

urmitnick wrote:

Hi!
Can you please re-upload the files? because the given links are not working.
Thank you

Hi guys, my bad, I've been out for too long. Updated, new working links smile
WifiMgr
WifiMgr 1.0b
ApScan 1.0b

(Last edited by dabyd64 on 10 Aug 2017, 21:27)

good job. Keep it on. I wish you will upload and sort all file on GitHub.

Place this filter script in /etc/hotplug.d/iface/99-recover-STA -

#!/bin/sh
logger -t DEBUG "hotplug (iface): action='$ACTION' devicename='$DEVICENAME' devname='$DEVNAME' devpath='$DEVPATH' product='$PRODUCT' type='$TYPE' interface='$INTERFACE'"

local _wwan _wait
_wwan=$(uci -q get wireless.STA_name.interface)
[ -z "$_wwan" ] && _wwan=wwan # <-- a popular name for 'repeater STAs'
_wait=$(uci -q get wireless.STA_name.wait)
[ -z "$_wait" ] && _wait=15
if [ "$ACTION" = ifdown -a "$INTERFACE" = "$_wwan" ]; then
    /bin/sh /usr/local/bin/revert_to_AP.sh $_wait $_wwan
fi

N.B. the logger commands in the filter scripts can safely be removed but are useful with

logread -e DEBUG

Dear Max Hopper
thanks for your share this awesome script to our planet !

this is what exactly I'm looking for .

two questoin:
1 Can this project remember over 1 remote ssid?  for example: I bind ssid1 as wwan,ssid2 as wwan2..

,then I go to place from A ssid1 to B ssid2. so I need not rebind it again.

Currently I found it can only work with 1 wwan

2 once remote router get down and reboot,the repeater router will not autoreconnet again,you have to reboot it to reconnect,could you fix it?



thank you Max

(Last edited by jack338c on 19 Aug 2017, 12:08)

I'd like to try the script but I can't get the code from dropbox (it says too much activities on the account so no more download).
Is there anyone who can upload the latest release somewhere ?


Hi! I'm very interested in your tool, but the link to mega.nz/... does not work anymore. Could you upload it again?



Can you please re-upload the files? because the given links are not working.


Hi guys, my bad, I've been out for too long. Updated, new working links smile


Dear dabyd

Could you make a luci for this awesome stuff,that's will be more convenient

thank you

The discussion might have continued from here.