nodewatcher: Provide additional information about WiFi interfaces

Submitted by Adrian Schmutzler on Dec. 29, 2017, 3 p.m.

Details

Message ID 1514559602-2319-1-git-send-email-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler Dec. 29, 2017, 3 p.m.
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>
---
 src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
 .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
index 02ee78b..adfab26 100644
--- a/src/packages/fff/fff-nodewatcher/Makefile
+++ b/src/packages/fff/fff-nodewatcher/Makefile
@@ -1,7 +1,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-nodewatcher
-PKG_VERSION:=43
+PKG_VERSION:=44
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
index e4a9bc9..7a9dbe6 100755
--- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
+++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
@@ -2,7 +2,7 @@ 
 # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
 # License; GPL v3
 
-SCRIPT_VERSION="43"
+SCRIPT_VERSION="44"
 
 test -f /tmp/started || exit
 
@@ -30,7 +30,7 @@  else
     }
 fi
 
-#this method checks id the logfile has bekome too big and deletes the first X lines
+#This method checks if the log file has become too big and deletes the first X lines
 delete_log() {
     if [ -f "$SCRIPT_LOGFILE" ]; then
         if [ "$(find "$SCRIPT_LOGFILE" -printf "%s")" -gt "6000" ]; then
@@ -50,7 +50,7 @@  inArray() {
     return 1
 }
 
-#this method generates the crawl data xml file that is beeing fetched by netmon
+#This method generates the crawl data XML file that is being fetched by netmon
 #and provided by a small local httpd
 crawl() {
     #Get system data from other locations
@@ -199,7 +199,16 @@  crawl() {
             /ESSID/ { split($0, e, "\""); printf "<wlan_essid>"e[2]"</wlan_essid>" }
             /Freq/{ split($3, f, " "); printf "<wlan_frequency>"f[1]f[2]"</wlan_frequency>" }
             /Tx-Power/{ split($0, p, "="); sub(/[[:space:]]*$/, "", p[2]); printf "<wlan_tx_power>"p[2]"</wlan_tx_power>" }
-        ')"</$iface>"
+        ')
+
+        interface_data=$interface_data$(iw dev "${iface}" info 2>/dev/null | awk '
+            /ssid/{ split($0, s, " "); printf "<wlan_ssid>"s[2]"</wlan_ssid>" }
+            /type/ { split($0, t, " "); printf "<wlan_type>"t[2]"</wlan_type>" }
+            /channel/{ split($0, c, " "); printf "<wlan_channel>"c[2]"</wlan_channel>" }
+            /width/{ split($0, w, ": "); sub(/ .*/, "", w[2]); printf "<wlan_width>"w[2]"</wlan_width>" }
+        ')
+
+        interface_data=$interface_data"</$iface>"
     done
 
     err "$(date): Collecting information from batman advanced and its interfaces"

Comments

Fabian Blaese Dec. 30, 2017, 8:49 p.m.
Gefällt mir soweit.
Ob man in so einem Patch die Groß-/Kleinschreibung in Kommentaren an unberührten Stellen geändert haben möchte, darüber kann man sich streiten..

Reviewed-by: Fabian Bläse <fabian@blaese.de>

> On 29. Dec 2017, at 16:00, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote:
> 
> 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>
> ---
> src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
> .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17 +++++++++++++----
> 2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
> index 02ee78b..adfab26 100644
> --- a/src/packages/fff/fff-nodewatcher/Makefile
> +++ b/src/packages/fff/fff-nodewatcher/Makefile
> @@ -1,7 +1,7 @@
> include $(TOPDIR)/rules.mk
> 
> PKG_NAME:=fff-nodewatcher
> -PKG_VERSION:=43
> +PKG_VERSION:=44
> PKG_RELEASE:=1
> 
> PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> index e4a9bc9..7a9dbe6 100755
> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> @@ -2,7 +2,7 @@
> # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
> # License; GPL v3
> 
> -SCRIPT_VERSION="43"
> +SCRIPT_VERSION="44"
> 
> test -f /tmp/started || exit
> 
> @@ -30,7 +30,7 @@ else
>     }
> fi
> 
> -#this method checks id the logfile has bekome too big and deletes the first X lines
> +#This method checks if the log file has become too big and deletes the first X lines
> delete_log() {
>     if [ -f "$SCRIPT_LOGFILE" ]; then
>         if [ "$(find "$SCRIPT_LOGFILE" -printf "%s")" -gt "6000" ]; then
> @@ -50,7 +50,7 @@ inArray() {
>     return 1
> }
> 
> -#this method generates the crawl data xml file that is beeing fetched by netmon
> +#This method generates the crawl data XML file that is being fetched by netmon
> #and provided by a small local httpd
> crawl() {
>     #Get system data from other locations
> @@ -199,7 +199,16 @@ crawl() {
>             /ESSID/ { split($0, e, "\""); printf "<wlan_essid>"e[2]"</wlan_essid>" }
>             /Freq/{ split($3, f, " "); printf "<wlan_frequency>"f[1]f[2]"</wlan_frequency>" }
>             /Tx-Power/{ split($0, p, "="); sub(/[[:space:]]*$/, "", p[2]); printf "<wlan_tx_power>"p[2]"</wlan_tx_power>" }
> -        ')"</$iface>"
> +        ')
> +
> +        interface_data=$interface_data$(iw dev "${iface}" info 2>/dev/null | awk '
> +            /ssid/{ split($0, s, " "); printf "<wlan_ssid>"s[2]"</wlan_ssid>" }
> +            /type/ { split($0, t, " "); printf "<wlan_type>"t[2]"</wlan_type>" }
> +            /channel/{ split($0, c, " "); printf "<wlan_channel>"c[2]"</wlan_channel>" }
> +            /width/{ split($0, w, ": "); sub(/ .*/, "", w[2]); printf "<wlan_width>"w[2]"</wlan_width>" }
> +        ')
> +
> +        interface_data=$interface_data"</$iface>"
>     done
> 
>     err "$(date): Collecting information from batman advanced and its interfaces"
> --
> 2.7.4
> 
> --
> franken-dev mailing list
> franken-dev@freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Tim Niemeyer Dec. 31, 2017, 2:41 p.m.
Hi

Und applied.

Danke
Tim

Am Samstag, den 30.12.2017, 21:49 +0100 schrieb Fabian Bläse:
> Gefällt mir soweit.
> Ob man in so einem Patch die Groß-/Kleinschreibung in Kommentaren an
> unberührten Stellen geändert haben möchte, darüber kann man sich
> streiten..
> 
> Reviewed-by: Fabian Bläse <fabian@blaese.de>
> 
> > On 29. Dec 2017, at 16:00, Adrian Schmutzler <freifunk@adrianschmut
> > zler.de> wrote:
> > 
> > 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>
> > ---
> > src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
> > .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17
> > +++++++++++++----
> > 2 files changed, 14 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/packages/fff/fff-nodewatcher/Makefile
> > b/src/packages/fff/fff-nodewatcher/Makefile
> > index 02ee78b..adfab26 100644
> > --- a/src/packages/fff/fff-nodewatcher/Makefile
> > +++ b/src/packages/fff/fff-nodewatcher/Makefile
> > @@ -1,7 +1,7 @@
> > include $(TOPDIR)/rules.mk
> > 
> > PKG_NAME:=fff-nodewatcher
> > -PKG_VERSION:=43
> > +PKG_VERSION:=44
> > PKG_RELEASE:=1
> > 
> > PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> > diff --git a/src/packages/fff/fff-
> > nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-
> > nodewatcher/files/usr/sbin/nodewatcher
> > index e4a9bc9..7a9dbe6 100755
> > --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> > +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> > @@ -2,7 +2,7 @@
> > # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
> > # License; GPL v3
> > 
> > -SCRIPT_VERSION="43"
> > +SCRIPT_VERSION="44"
> > 
> > test -f /tmp/started || exit
> > 
> > @@ -30,7 +30,7 @@ else
> >     }
> > fi
> > 
> > -#this method checks id the logfile has bekome too big and deletes
> > the first X lines
> > +#This method checks if the log file has become too big and deletes
> > the first X lines
> > delete_log() {
> >     if [ -f "$SCRIPT_LOGFILE" ]; then
> >         if [ "$(find "$SCRIPT_LOGFILE" -printf "%s")" -gt "6000" ];
> > then
> > @@ -50,7 +50,7 @@ inArray() {
> >     return 1
> > }
> > 
> > -#this method generates the crawl data xml file that is beeing
> > fetched by netmon
> > +#This method generates the crawl data XML file that is being
> > fetched by netmon
> > #and provided by a small local httpd
> > crawl() {
> >     #Get system data from other locations
> > @@ -199,7 +199,16 @@ crawl() {
> >             /ESSID/ { split($0, e, "\""); printf
> > "<wlan_essid>"e[2]"</wlan_essid>" }
> >             /Freq/{ split($3, f, " "); printf
> > "<wlan_frequency>"f[1]f[2]"</wlan_frequency>" }
> >             /Tx-Power/{ split($0, p, "="); sub(/[[:space:]]*$/, "",
> > p[2]); printf "<wlan_tx_power>"p[2]"</wlan_tx_power>" }
> > -        ')"</$iface>"
> > +        ')
> > +
> > +        interface_data=$interface_data$(iw dev "${iface}" info
> > 2>/dev/null | awk '
> > +            /ssid/{ split($0, s, " "); printf
> > "<wlan_ssid>"s[2]"</wlan_ssid>" }
> > +            /type/ { split($0, t, " "); printf
> > "<wlan_type>"t[2]"</wlan_type>" }
> > +            /channel/{ split($0, c, " "); printf
> > "<wlan_channel>"c[2]"</wlan_channel>" }
> > +            /width/{ split($0, w, ": "); sub(/ .*/, "", w[2]);
> > printf "<wlan_width>"w[2]"</wlan_width>" }
> > +        ')
> > +
> > +        interface_data=$interface_data"</$iface>"
> >     done
> > 
> >     err "$(date): Collecting information from batman advanced and
> > its interfaces"
> > --
> > 2.7.4
> > 
> > --
> > franken-dev mailing list
> > franken-dev@freifunk.net
> > http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
> 
>