README.md 4.83 KB
Newer Older
1 2
gluon-ssid-changer
==================
3

rubo77's avatar
rubo77 committed
4 5 6 7 8 9 10
This package adds a script to change the SSID to an Offline-SSID when there is
no connection to any gateway.
This SSID can be generated from the nodes hostname with the first
and last part of the nodename or the mac address, to allow observers to 
recognise which node is down. The script is called once a minute by micron.d
and it will change from online to offline-SSID maximum once every (definable)
timeframe.
11

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
You can enable/disable it in the config mode.

Once every timeframe it checks if there's still a gateway reachable. There can be
selected two algorithms to analyze if a gateway is reacheable:

- `tq_limit` enabled: define an upper and lower limit to turn the offline_ssid 
  on and off in-between these two values the SSID will never be changed to
  prevent it from toggeling every minute.
- `tq_limit` disabled: there will be only checked, if the gateway is reachable
  with:

        batctl gwl -H

Depending on the connectivity, it will be decided if a change of the SSID is 
necessary: There is a variable `switch_timeframe` (for ex.  1440 = 24h) that 
defines a time interval after which a successful check that detects an offline
state will result in a single change of the SSID to "FF_OFFLINE_$node_hostname".
Only the first few minutes (also definable in a variable `first`) the 
OFFLINE_SSID may also be set. All other minutes a checks will just be counted
and reported in the log and whenever an online state is detected the SSID will
be set back immediately back to normal. when the timeframe is reached, there
will be checked if the node was offline at least half the timeframe, only then
the SSID will be changed.
35

36 37 38 39 40 41 42
site.conf
=========

Adapt and add this block to your site.conf: 

```
ssid_changer = {
rubo77's avatar
rubo77 committed
43
  switch_timeframe = 30,  -- only once every timeframe (in minutes) the SSID will change to OFFLINE 
44 45
                          -- set to 1440 to change once a day
                          -- set to 1 minute to change every time the router gets offline
rubo77's avatar
rubo77 committed
46
  first = 5,              -- the first few minutes directly after reboot within which an Offline-SSID always may be activated (must be <= switch_timeframe)
47 48 49 50 51 52
  prefix = 'FF_OFFLINE_', -- use something short to leave space for the nodename (no '~' allowed!)
  suffix = 'nodename',    -- generate the SSID with either 'nodename', 'mac' or to use only the prefix: 'none'
  
  tq_limit_enabled = 0,   -- if false, the offline SSID will only be set if there is no gateway reacheable
                          -- upper and lower limit to turn the offline_ssid on and off
                          -- in-between these two values the SSID will never be changed to prevent it from toggeling every minute.
rubo77's avatar
rubo77 committed
53 54
  tq_limit_max = '45',    -- upper limit, above that the online SSID will be used
  tq_limit_min = '35'     -- lower limit, below that the offline SSID will be used
55 56 57 58 59 60 61 62 63 64 65
},
```

Commandline options
===================

You can configure the ssid-changer on the commandline with `uci`, for example 
disable it with:

    uci set ssid-changer.settings.enabled='0'

66 67 68 69 70
Or set the timeframe to every three minutes with

    uci set ssid-changer.settings.switch_timeframe='3'
    uci set ssid-changer.settings.first='3'

71 72 73
Manual installation
===================

74 75
If you don't have ssid-changer in your firmware, you can still install it
manually on a node and set the desired settings that should differ from default:
76 77

```
78
ROUTER_IP='your:node::ip6'
79 80 81
LOGIN="root@[$ROUTER_IP]"
git clone https://github.com/Freifunk-Nord/gluon-ssid-changer.git ssid-changer
cd ssid-changer/gluon-ssid-changer/
82
git checkout lede
83 84 85
scp -r files/* $LOGIN:/
scp luasrc/lib/gluon/upgrade/500-ssid-changer $LOGIN:/lib/gluon/upgrade/
ssh $ROUTER_IP "/lib/gluon/upgrade/500-ssid-changer;" \
86 87
  "uci set ssid-changer.settings.switch_timeframe='3';" \
  "uci set ssid-changer.settings.first='3';" \
88
  "uci commit ssid-changer;" \
89 90
  "uci show ssid-changer;" \
  "/etc/init.d/micrond reload;"
91 92 93 94 95 96 97
```

logread |grep -v "fastd" & logread -f |grep -v "fastd"

cd /var/www/freifunk/firmware/ffki/rc/
router_ip+=fda1:384a:74de:4242:62e3:27ff:fe2a:67d6;

98 99 100

Gluon versions
==============
101
This branch of the script contains the ssid-changer version for the gluon 
rubo77's avatar
rubo77 committed
102
master branch (lede).
103 104 105

Implement this package in your firmware
=======================================
rubo77's avatar
rubo77 committed
106 107 108 109 110
Create a file "modules" with the following content in your site directory:

```
GLUON_SITE_FEEDS="ssidchanger"
PACKAGES_SSIDCHANGER_REPO=https://github.com/freifunk-nord/gluon-ssid-changer.git
111
PACKAGES_SSIDCHANGER_COMMIT=0e4c3384a51c7359234ae883f00e47b044a0c704 # <-- set the newest commit ID here
rubo77's avatar
rubo77 committed
112 113
PACKAGES_SSIDCHANGER_BRANCH=master
```
114

rubo77's avatar
rubo77 committed
115
With this done you can add the package `gluon-ssid-changer` to your `site.mk`
rubo77's avatar
rubo77 committed
116

117 118 119 120
History
=======
*This is a merge of https://github.com/ffac/gluon-ssid-changer and
https://github.com/viisauksena/gluon-ssid-changer that doesn't check
rubo77's avatar
rubo77 committed
121
the tx value any more. It is now in use in Freifunk Nord*