Commit Graph

41 Commits

Author SHA1 Message Date
Adrian Schmutzler 858930547b treewide: use SPDX license identifiers
The SPDX license identifier provides a standardized way for specifying
licenses that is both human- and machine-readable. It is used upstream
both in OpenWrt and the Linux kernel.

Replace licenses in our repository by those identifiers.

The full-text licenses corresponding to these identifiers are
provided in the LICENSES folder.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Fabian Bläse <fabian@blaese.de>
2021-03-06 18:53:26 +01:00
Adrian Schmutzler 934ddab8e5 fff-nodewatcher: add config option to disable nodewatcher
This adds an option 'disabled' that will allow to disable
nodewatcher when desired.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2021-02-27 16:13:56 +01:00
Fabian Bläse f26463628b nodewatcher: Exit nodewatcher if subscript fails
If a subscript exits with an exit status != 0, its output should not
be used. Because sending incomplete data sets might result in weird
edge cases, the nodewatcher is terminated and the output of other
subscripts is discarded.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-04-23 12:00:11 +02:00
Fabian Bläse 25c5edcf3c nodewatcher: Add prefix to debug messages
Because nodewatcher is executed using a cron, but
our cron has no way to report the origin of a specific
log entry, a 'nodewatcher:' prefix is added to all debug
output.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-04-23 11:56:28 +02:00
Fabian Bläse 2eb675790e nodewatcher.d: Remove $(date) from debug output
Debug output is written to stderr now.
Therefore the output is happening in real time and
the current date and time are not necessary anymore.

Typically the date and time are added by the syslog
daemon.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-04-23 11:56:19 +02:00
Fabian Bläse c1f694c319 nodewatcher: Output to stderr instead of log file
Maintaining a logfile manually is complicated and
has no major improvements over just logging to stderr,
because nodewatcher is no deamon and can be run manually
for debugging purposes.

Also, the debug output from subscripts currently is not
written to the log file anyway and the debug level is not
used eiher.

Therefore, the file logging and debug level is removed
from nodewatcher, which simplifies the code a bit.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-04-23 11:56:01 +02:00
Tim Niemeyer b6c7acd704 nodewatcher: split into nodewatcher.d scripts for individual task
This splits up the data extraction/assembly of the nodewatcher
script into several parts and distributes them across packages, so
that each nodewatcher.d subscript is located in the package providing
the relevant functionality. This allows to extend the nodewatcher data
by enabling/disabling packages.
This scheme is not perfectly fulfilled for fff-network vs. fff-wireless,
as data cannot uniquely assigned there and the XML syntax does not allow
separation anyway.

In general, this moves code without applying code improvements, yielding
at an easy comparison of moved fragments. However, the following changes
were done to improve experience:

- The function writing debug output has been renamed from "err" to "debug"
- Since we catch the stdout of the nodewatcher.d functions anyway,
  those scripts were adjusted to echo output directly instead of first
  writing it into a variable and then outputting it at the end.
- The uci config has been kept, but initialization for the network part
  has been moved to the fff-network package.
- Space indent has been changed to tab, which is more common in the
  firmware and requires less space.
- Remove support for nodewatcher run without uci config. Script-based
  nodewatcher on other platforms will have altered code anyway, and
  splitting it up will prevent effective use as a blueprint for those
  cases. After this change, nodewatcher in firmware is supposed to be
  used only for this firmware.

Note that since the nodewatcher.d scripts are evaluated by using their
echo output, having a function created uncaught output to stdout there
will corrupt the XML.

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
[rebase and adjustments for current master, use simpler mechanism to
call nodewatcher.d scripts, use tab indent, remove debug() definition
where not needed, do not remove uci config, add commit message, use
echo -n]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
[remove 'local' modifier for variable not inside a function, fix typo]
Signed-off-by: Fabian Bläse <fabian@blaese.de>
2020-04-19 15:44:08 +02:00
Fabian Bläse 03d94d92fd nodewatcher: Add support for babel neighbours
Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2019-10-21 13:53:32 +02:00
Fabian Bläse cac9b55aa2 nodewatcher: Send babeld version
Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-07 14:44:10 +02:00
Adrian Schmutzler 004b386d55 nodewatcher: Remove leftover use of batman-adv sysfs
In d9ec8edb15 ("batman-adv: Move from DEBUGFS to batctl") we
switched from deprecated DEBUGFS to batctl.

Despite debugfs, batctl seems to also have deprecated sysfs
(https://www.open-mesh.org/news/90).

This patch thus replaces a reference to iface_status by the
corresponding batctl command.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2019-08-21 18:16:09 +02:00
Robert Langhammer 5a119dcda8 fff-nodewatcher: remove l2tp
Signed-off-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[Bump PKG_RELEASE and SCRIPT_VERSION]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2019-07-06 13:58:57 +02:00
Adrian Schmutzler d9ec8edb15 batman-adv: Move from DEBUGFS to batctl
The debug filesystem will be deprecated and disabled by default
in newer versions of B.A.T.M.A.N.

This patch switches our code to the batctl, as recommended.

Since batctl can suppress headers, this actually makes our life
easier ...

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2019-03-27 18:24:29 +01:00
Adrian Schmutzler ef00054916 configurehood/nodewatcher: Also process hood ID in addition to name
So far, the Monitoring evaluates hoods based on their names.

This introduces several problems, most prominently a hood
re-creation if it is renamed at the KeyXchange.

Since we have unique hood IDs in the KeyXchange and the
Monitoring retrieves those via hoods.php, it is logical use this
information instead of relying on string comparison.

This requires the hood files to contain an additional field "id".
While this has not been implemented, the changes in this patch
will still work and just write empty data to the uci field and
alfred data.

For local hoods, the "id" in the hood file will remain unset.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2018-11-27 23:20:13 +01:00
Adrian Schmutzler 0a05b15d43 nodewatcher: Change default name to be replaced back to OpenWrt
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-11-21 15:31:42 +01:00
Adrian Schmutzler a37dedda26 Always send hood to Monitoring
Since the MacNocker was introduced, the hood information in
UCI is DELETED if the hood is lost.

If the router still successfully sends alfred data in this state,
the Monitoring will treat it as a V1 device. This is annoying,
especially since it looks like a loop.

An easy solution is to send an empty <hood> field in those cases,
as V2 routers are detected by them knowing their hood.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-11-21 15:31:15 +01:00
Adrian Schmutzler e1b9280f12 nodewatcher: Prevent multiple instances at the same time
This is based on the configurehood-Patch from Tim Niemeyer.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2018-11-07 15:29:00 +01:00
Tim Niemeyer c1fc513cef buildscript: remove community config
The community file is not used anymore.

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2018-08-06 15:31:32 +02:00
Adrian Schmutzler 348cdbe8d3 nodewatcher: Change mechanism for client device detection
This is simpler than the previous approach and does not rely
on parsing.

This fixes:
- Interfaces being accounted for multiple times for certain
  devices
- Errors when output of bridge function changes (as with the
  current OpenWrt master)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2018-07-26 09:22:32 +02:00
Adrian Schmutzler 686da98770 nodewatcher: Provide data to calculate airtime
The actual calculation is done in the Monitoring.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2018-01-28 12:36:14 +01:00
Adrian Schmutzler 145e057a77 fff-nodewatcher: Add detailed clients data
This adds data about the clients per interface

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
2018-01-21 14:55:19 +01:00
Adrian Schmutzler bef333c43b nodewatcher: Fix bugs in gateway list creation
Changes:
- Remove first line (headline) previously parsed as gateway
- Delete leading whitespaces for netif correctly (regex
  "\\[" changed to "\\[ *")
- Remove netif whitespaces first, so they are not changed to
  "false"
- Include trailing whitespace in regex for selection marker
- Remove useless replacement "  " to " "

This is designed to support BATMAN compatibility version 14 AND 15

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-01-20 15:11:34 +01:00
Adrian Schmutzler 12804b8ff6 nodewatcher: Provide additional information about WiFi interfaces
This patch additional information to the nodewatcher XML:
- wlan_channel: Channel of interface (number only)
- wlan_ssid: SSID available through iw dev
- wlan_type: Type of interface (AP, mesh, IBSS)
- wlan_width: Width of frequency band (20 vs. 40 MHz, number only)

The nodewatcher file from this patch can be copied manually to
devices with older firmware.

The patch includes some comment typo fixes.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2017-12-31 15:40:59 +01:00
Adrian Schmutzler 39d147da8d Rearrange fff config values into their own config file
This moves the FFF configuration from
/etc/config/system to a new file /etc/config/fff. Thus,
this file can be copied as a whole during upgrade (with
compatibility provided) and then resulting values in
other files are re-set later.

This also fixes the bandwidth settings not being persistent
during upgrade. Other settings may join ...

I tried to go through all the code and update all occurrences
of the relevant system variables (looking for "system" both
in GitHub and my local src folder).

Note that a downgrade will result in loss of configuration!

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
- Rebased
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
2017-11-12 20:28:52 +01:00
Adrian Schmutzler 0d3d6f7f33 fff-nodewatcher: Use mac address instead of standard node name
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2017-10-14 17:38:48 +02:00
Tobias Klaus 4d2a42cb53 nodewatcher: fix parsing error
Signed-off-by: Tobias Klaus <tk+ff@meskal.net>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2017-07-28 07:46:04 +02:00
Christian Dresel b287daaf06 Add Hoodinformation to Nodewatcher
Fixes: #38
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2017-07-02 17:45:25 +02:00
Adrian Schmutzler 20ea0c6d8e fff-nodewatcher: write WAN status to XML (fastd and L2TP)
Fixes #30

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>

deleted some trailing whitespaces
Signed-off-by: Tobias Klaus <tk+ff@meskal.net>
2017-06-02 23:20:07 +02:00
Steffen Pankratz 008911cd20 fff-nodewatcher: fixed typo
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2016-11-05 10:56:05 +01:00
Steffen Pankratz 03e3104273 Nodewatcher: interpret 'description' and 'position_comment' purely as textual data
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2016-10-30 13:07:02 +01:00
Tim Niemeyer 1313359b1b fff-nodewatcher: bump version
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2016-06-12 16:19:23 +02:00
Tim Niemeyer e4c776153a fff-nodewatcher: fix shellcheck warnings
- SC2006: Use $(..) instead of deprecated `..`
- SC2086: Double quote to prevent globbing and word splitting.
- SC2046: Quote this to prevent word splitting.
- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.
- SC2004: $ on variables in (( )) is unnecessary.
- SC2016: Expressions don't expand in single quotes, use double quotes for that.

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
- fixed typo in same line
Signed-off-by: Tobias Klaus <tk+ff@meskal.net>
2016-06-12 16:19:23 +02:00
Tim Niemeyer c33952656c fff-nodewatcher: fastd version only if installed
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2016-06-12 16:19:23 +02:00
Tim Niemeyer 434dff1929 fff-nodewatcher: add platform as chipset
On some devices cpuinfo returns no "system type". For that devices the
"platform" tag contains the relevant chipset information.

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2016-06-12 16:19:17 +02:00
Tim Niemeyer cd60e63480 fff-nodewatcher: style: fix some long lines
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2016-06-12 16:18:08 +02:00
Tim Niemeyer f458f196fc fff-nodewatcher: style: unify to spaces
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
- two more tabs to spaces
Signed-off-by: Tobias Klaus <tk+ff@meskal.net>
2016-06-12 16:17:56 +02:00
Tim Niemeyer f765eef457 fff-nodewatcher: style: remove unused code
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
2016-06-12 16:12:42 +02:00
Tim Niemeyer 92dc0c647d fff-nodewatcher: self-detect client interfaces
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
2016-06-11 14:13:13 +02:00
Tim Niemeyer af80123aa2 fff-nodewatcher: remove busybox httpd
- remove httpd from .config
- remove httpd startup from rc.local
- add crawldata path creation in nodewatcher

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
Tested-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
2016-04-05 23:27:34 +02:00
Tim Niemeyer 5940b43765 web/nodewatcher: add description/position_comment
Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2016-01-26 00:46:00 +01:00
Tim Niemeyer 6920c9f694 fff-nodewatcher: collect geo and contact
Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2016-01-26 00:45:47 +01:00
Tim Niemeyer aad3ba8403 nodewatcher: move to separate package
- remove template parameter NETMON_IP (it's always the same)
- add new fff-nodewatcher package
- move nodewatcher, configurator, syncHostname to fff-nodewatcher
- fff-base selects fff-nodewatcher

Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
Reviewed-by: Steffen Pankratz <kratz00@gmx.de>
2015-12-30 08:01:32 +01:00