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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
cc650fa
Merge pull request #15 from viisauksena/chaos-calmer
mmalte Jan 23, 2016
dfb9063
Update README.md
mmalte Jan 27, 2016
cc0e1f4
Allow SSIDs containing slashes
rubo77 Oct 30, 2016
759aafe
fix grammar, indentions and code quality
rubo77 Oct 30, 2016
109bd08
prevent unknown operand warning on console
rubo77 Oct 30, 2016
3a6ae09
delete fffr specific stuff, but still in default ssid FREIFUNK fixed
viisauksena Nov 11, 2016
bc81df8
makefile
viisauksena Nov 11, 2016
4323ed5
delete emergency script
rubo77 Nov 11, 2016
1d35be8
take more of the node name into the offline SSID
rubo77 Nov 11, 2016
6a6d405
fix not allowed slashes in SSID name
rubo77 Nov 11, 2016
a13166d
Add a timeframe under that that the SSID will not change
rubo77 Nov 11, 2016
6a85ff0
update Makefile
rubo77 Nov 11, 2016
8f5ac15
Hint how to configure for an immediate change
rubo77 Nov 11, 2016
f7abefe
the use of `uci` is unlucky in case you do uci commit on the console
rubo77 Nov 11, 2016
2550af3
merged most of the original code from ffac (mmalte), enhanced in
rubo77 Nov 11, 2016
aa7aba3
if the router started less than 10 minutes ago, exit
rubo77 May 22, 2017
f0da2af
Readme: add details and new commit id
rubo77 May 22, 2017
614d2f5
the first few minutes directly after reboot an Offline-SSID always ma…
rubo77 May 24, 2017
5154773
Enhance README
rubo77 May 24, 2017
5d0258f
README: add example for site.conf variables
rubo77 Jun 4, 2017
9cd44be
Add enabled option
rubo77 Jun 4, 2017
995190d
Read all options from config and add option to use mac as offline suf…
rubo77 Jun 4, 2017
e2b04ae
fixed indentins and all comments in single lines
rubo77 Jun 5, 2017
6266c4a
delete all comments during build in makefile
rubo77 Jun 5, 2017
c2c88f4
add upgrade script and empty config file for uci and fill it with var…
rubo77 Jun 4, 2017
48336bf
upgrade script has to be executable
rubo77 Jun 8, 2017
b283d72
Makefile: add postinst ... $(call GluonCheckSite,check_site.lua)
rubo77 Jun 6, 2017
be7f05b
Makefile description adapted to new feature
rubo77 Jun 8, 2017
0bc1ee5
adaption for master (lede)
rubo77 Jun 8, 2017
327370e
include $(TOPDIR)/../package/gluon.mk
rubo77 Jun 8, 2017
d8c73f8
remove line PKG_RELEASE:=$(GLUON_BRANCH)
rubo77 Jun 8, 2017
97f5865
Makefile darf nicht ausführbar sein
rubo77 Jun 8, 2017
a1cdce7
packages in lede must reside in their own folder
rubo77 Jun 8, 2017
0dabdd9
correct varible path in upgrade script
rubo77 Jun 8, 2017
5e548c8
uci option -q must be first option now
rubo77 Jun 8, 2017
b008c42
tq settings from ffac-version implemented
rubo77 Jun 11, 2017
35fa15b
add safety checks on start
rubo77 Jun 17, 2017
a33e960
lower suggeste and default TQ values
rubo77 Jun 17, 2017
7431ebf
FIRST must be <= switch_timeframe
rubo77 Jun 17, 2017
7c98452
tq_max should be used on greater than or equal already
rubo77 Jun 17, 2017
30d1b7a
Only set offline, if the node was offline more times than half of swi…
rubo77 Jun 17, 2017
af38b04
README: add manual installation instructions
rubo77 Jun 17, 2017
9265743
check if hostapd-phy* files exist corrected
rubo77 Jun 17, 2017
1a11811
upgrade script, check if ssid_changer is in site.conf
rubo77 Jun 18, 2017
406deca
README: fix manual installation instructions
rubo77 Jun 18, 2017
5aa0dc6
correct file permissions for micron.d file and add reload to example …
rubo77 Jun 18, 2017
6dc81ac
Readme: add FIRST to example manual installation
rubo77 Jun 18, 2017
0e4c338
option in config mode to dis-/enable the Offline-SSID
rubo77 Jun 19, 2017
5c80482
Readme: Update Commit id and add History
rubo77 Jun 19, 2017
7421a92
add i18n support to Makefile
rubo77 Jun 19, 2017
cb8e467
Position in navigation between "Private WLAN" and "Network"
rubo77 Jun 19, 2017
cecb2ae
typo in translation
rubo77 Jun 20, 2017
cc16f48
DE-CAPITALIZE OFFLINE
rubo77 Jun 20, 2017
ff9a7c4
Readme: fix manual installation
rubo77 Jun 23, 2017
8ee33e0
Readme: add alternative: gluon-ssid-notifier
rubo77 Jun 26, 2017
d307ba9
add site.conf validy check
rubo77 Jun 29, 2017
5a7f70f
debug count removed
rubo77 Jul 3, 2017
79910fa
ssid-changer-v4-2017.1
rubo77 Jul 3, 2017
b0535e2
define Package section must be indented with spaces
rubo77 Jul 4, 2017
c6dc54f
use $(PKG_NAME) for gluon-ssid-changer
rubo77 Sep 28, 2017
54ccc95
correct default value types
rubo77 Jan 23, 2018
b62a36b
Default settings on factory firmware enabled
rubo77 Jan 23, 2018
772e9f0
write settings in the right config section
rubo77 Feb 16, 2018
61f8dca
Enable dual band devices and different SSIDs (#18)
tennet-ahertel Mar 17, 2018
f0461e0
shorter mac address (leave out colons)
1977er Sep 10, 2017
25a8782
shorter uptime determination
rubo77 Aug 28, 2017
3d15977
new branch names 2017.1.x and 2016.2.x
rubo77 Mar 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions Makefile

This file was deleted.

141 changes: 112 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,127 @@
ssid-changer.sh
===============
gluon-ssid-changer
==================

This script changes the SSID when there is no connection to the selected Gateway.
_This branch of the script contains the ssid-changer version for the gluon
2017.1.x branch. For other release of Gluon use the branches "2018.1.x" and
"2016.2.x"._

Once a minute it checks if there is a gateway reacheable with `batctl gwl -H` and
decides if a change of the SSID is necessary.
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.

*It is a simplified rewrite of https://github.com/ffac/gluon-ssid-changer that doesn't check
the tx value any more. It is in use in Freifunk Freiburg*
You can enable/disable it in the config mode.

emergency.sh
============
this repository also includes an emergency script which checks for a working batman-adv
gateway connection. If no Gateway connection exists some countermeasures are started:
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:

- 3 min offline - call `wifi`
- 5 min offline - restart fastd
- 7 min offline - restart networking
- `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:

If no countermeasure works bringing the node online again, the router will be enforced
to reboot after 10 minutes.
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.

site.conf
=========

Adapt and add this block to your site.conf:

```
ssid_changer = {
enabled = true,
switch_timeframe = 30, -- only once every timeframe (in minutes) the SSID will change to the Offline-SSID
-- set to 1440 to change once a day
-- set to 1 minute to change every time the router gets offline
first = 5, -- the first few minutes directly after reboot within which an Offline-SSID always may be activated (must be <= switch_timeframe)
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 = false, -- 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.
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
},
```

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'

Or set the timeframe to every three minutes with

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

Manual installation
===================

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:

```
ROUTER_IP='your:node::ip6'
LOGIN="root@[$ROUTER_IP]"
git clone https://github.com/Freifunk-Nord/gluon-ssid-changer.git ssid-changer
cd ssid-changer/gluon-ssid-changer/
git checkout lede
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;" \
"uci set ssid-changer.settings.switch_timeframe='3';" \
"uci set ssid-changer.settings.first='3';" \
"uci commit ssid-changer;" \
"uci show ssid-changer;" \
"/etc/init.d/micrond reload;"
```

Alternative: gluon-ssid-notifier
================================
If you just need the Offline-SSID for administrative purposes, there is a better solution,
that will just add an extra SSID if a node is offline:
https://github.com/freifunk-kiel/gluon-ssid-notifier/

*Note: this script may cause a problem for users, that use the node on purposes intended
to work without functioning gateway connectivity, for example as a switch (disable
the cronjob there).*

Gluon versions
==============
This branch of the skript contains the the ssid-changer version for the gluon 2016.1.x
based on openwrt `chaos-calmer`. There is also a pre 2016.1 (barrier braker based)
version in the branch `master`. It will probably not work in 2016.2 yet.
This branch of the script contains the ssid-changer version for the gluon
master branch (lede).

Implement this package in your firmware
=======================================
Create a file "modules" with the following content in your
<a href="https://github.com/ffac/site/tree/offline-ssid"> site directory:</a>
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
PACKAGES_SSIDCHANGER_COMMIT=cc16f488bd32f17da845279800e06f237884829e # <-- set the newest commit ID here
PACKAGES_SSIDCHANGER_BRANCH=master
```

GLUON_SITE_FEEDS="ssidchanger"<br>
PACKAGES_SSIDCHANGER_REPO=https://github.com/viisauksena/gluon-ssid-changer.git<br>
PACKAGES_SSIDCHANGER_COMMIT=f135ba05913feb4451e4cf067b735b095a4ee243<br>
PACKAGES_SSIDCHANGER_BRANCH=chaos-calmer<br>
With this done you can add the package `gluon-ssid-changer` to your `site.mk`

With this done you can add the package gluon-ssid-changer to your site.mk
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
the tx value any more. It is now in use in Freifunk Nord*
42 changes: 0 additions & 42 deletions files/lib/gluon/ssid-changer/emergency.sh

This file was deleted.

23 changes: 0 additions & 23 deletions files/lib/gluon/ssid-changer/ssid-changer.sh

This file was deleted.

1 change: 0 additions & 1 deletion files/usr/lib/micron.d/emergency

This file was deleted.

1 change: 0 additions & 1 deletion files/usr/lib/micron.d/ibss-empty

This file was deleted.

53 changes: 53 additions & 0 deletions gluon-ssid-changer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=gluon-ssid-changer
PKG_VERSION:=4

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(TOPDIR)/../package/gluon.mk

PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)


define Package/$(PKG_NAME)
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=changes the SSID to an Offline-SSID so clients don't connect to an offline WiFi
DEPENDS:=+gluon-core +micrond
endef

define Package/$(PKG_NAME)/description
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.
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Configure
endef

define Build/Compile
$(call GluonBuildI18N,$(PKG_NAME),i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef

define Package/$(PKG_NAME)/install
$(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
./gluonShellDiet.sh $(1)/lib/gluon/ssid-changer/ssid-changer.sh
$(call GluonInstallI18N,$(PKG_NAME),$(1))
endef

define Package/$(PKG_NAME)/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
11 changes: 11 additions & 0 deletions gluon-ssid-changer/check_site.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if need_table('ssid_changer', nil, false) then
need_boolean('ssid_changer.enabled', false)
need_number('ssid_changer.switch_timeframe', false)
need_number('ssid_changer.first', false)
need_string('ssid_changer.prefix', false)
need_string('ssid_changer.suffix', false)
if need_boolean('ssid_changer.tq_limit_enabled', false) then
need_number('ssid_changer.tq_limit_max', false)
need_number('ssid_changer.tq_limit_min', false)
end
end
2 changes: 2 additions & 0 deletions gluon-ssid-changer/files/etc/config/ssid-changer
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config settings 'settings'
option enabled '1'
Loading