Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dual band devices and different SSIDs #12

Open
wants to merge 67 commits into
base: lede
Choose a base branch
from

Conversation

tennet-ahertel
Copy link

@tennet-ahertel tennet-ahertel commented Feb 16, 2018

using different SSIDs on 2.4GHz and 5GHz cause a problem,
because at the moment only wireless.client_radio0.ssid is checked.

i solved the problem in this way:

diff --git a/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh b/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
index 9377d8f..36f4346 100755
--- a/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
+++ b/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
@@ -10,7 +10,7 @@ safety_exit() {
 pgrep -f autoupdater >/dev/null && safety_exit 'autoupdater running'
 [ $(cat /proc/uptime | sed 's/\..*//g') -gt 60 ] || safety_exit 'less than one minute'
 [ $(find /var/run -name hostapd-phy* | wc -l) -gt 0 ] || safety_exit 'no hostapd-phy*'
-
+
 # only once every timeframe minutes the SSID will change to the Offline-SSID
 # (set to 1 minute to change immediately every time the router gets offline)
 MINUTES="$(uci -q get ssid-changer.settings.switch_timeframe)"
@@ -57,8 +57,8 @@ fi
 OFFLINE_SSID="$PREFIX$SUFFIX"

 # if for whatever reason ONLINE_SSID is NULL
-ONLINE_SSID="$(uci -q get wireless.client_radio0.ssid)"
-: ${ONLINE_SSID:="FREIFUNK"}
+ONLINE_SSIDs="$(uci show | grep wireless.client_radio | grep ssid  | awk -F '='  '{print $2}')"
+: ${ONLINE_SSIDs:="'FREIFUNK'"}

 # temp file to count the offline incidents during switch_timeframe
 TMP=/tmp/ssid-changer-count
@@ -84,9 +84,9 @@ if [ $TQ_LIMIT_ENABLED = 1 ]; then
                # there is no gateway
                GATEWAY_TQ=0
        fi
-
+
        MSG="TQ is $GATEWAY_TQ, "
-
+
        if [ $GATEWAY_TQ -ge $TQ_LIMIT_MAX ]; then
                CHECK=1
        elif [ $GATEWAY_TQ -lt $TQ_LIMIT_MIN ]; then
@@ -107,8 +107,11 @@ M=$(($UP % $MINUTES))
 HUP_NEEDED=0
 if [ "$CHECK" -gt 0 ] || [ "$DISABLED" = '1' ]; then
        echo "node is online"
+       LOOP=1
        # check status for all physical devices
        for HOSTAPD in $(ls /var/run/hostapd-phy*); do
+               ONLINE_SSID="$(echo $ONLINE_SSIDs | awk -F \' -v l=$((LOOP*2)) '{print $l}')"
+               LOOP=$((LOOP+1))
                CURRENT_SSID="$(grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2)"
                if [ "$CURRENT_SSID" = "$ONLINE_SSID" ]; then
                        echo "SSID $CURRENT_SSID is correct, nothing to do"
@@ -137,7 +140,10 @@ elif [ "$CHECK" -eq 0 ]; then
                #echo minute $M, check if $OFF_COUNT is more than half of $T
                if [ $OFF_COUNT -ge $(($T / 2)) ]; then
                        # node was offline more times than half of switch_timeframe (or than $FIRST)
+                       LOOP=1
                        for HOSTAPD in $(ls /var/run/hostapd-phy*); do
+                               ONLINE_SSID="$(echo $ONLINE_SSIDs | awk -F \' -v l=$((LOOP*2)) '{print $l}')"
+                               LOOP=$((LOOP+1))
                                CURRENT_SSID="$(grep "^ssid=$OFFLINE_SSID" $HOSTAPD | cut -d"=" -f2)"
                                if [ "$CURRENT_SSID" = "$OFFLINE_SSID" ]; then
                                        echo "SSID $CURRENT_SSID is correct, nothing to do"

mmalte and others added 30 commits January 24, 2016 00:14
Chaos calmer - generic ssid from firmware 

Works, but I'll leave issue #8 open, I like to add the ssid during build.
Update to latest Commit
This adds a configuration MINUTES, so it cannot happen more often than those minutes that the SSID is changed to offline
…iables from the site.conf

- added gluon luasrc diet to lua upgrade script
@rubo77
Copy link

rubo77 commented Feb 16, 2018

This is the wrong repo, you have to set the PR against the correct branch in https://github.com/Freifunk-Nord/gluon-ssid-changer/

@rubo77 rubo77 deleted the lede branch March 19, 2018 13:37
@rubo77 rubo77 restored the lede branch March 19, 2018 13:39
@rubo77 rubo77 deleted the lede branch March 19, 2018 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants