From 0359796a33b5062504bcdc3616478cdbc8a9b09c Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Mon, 6 Jul 2015 23:32:41 -0500 Subject: [PATCH 01/41] bugfix: detect tun passwords with only numbers --- files/www/cgi-bin/vpn | 1 + 1 file changed, 1 insertion(+) diff --git a/files/www/cgi-bin/vpn b/files/www/cgi-bin/vpn index a84f2f88..69184397 100755 --- a/files/www/cgi-bin/vpn +++ b/files/www/cgi-bin/vpn @@ -148,6 +148,7 @@ foreach $val (@list) # password MUST be alphanumeric (no special chars) push @cli_err, "The password cannot contain non-alphanumeric characters (#$client_num)" if ($passwd =~ m/[^a-zA-Z0-9@]/); + push @cli_err, "The password must contain at least one alphabetic character (#$client_num)" if ($passwd !~ /\D/); push @cli_err, "A client name is required" if($name eq ""); push @cli_err, "A client password is required" if($passwd eq ""); From 3872261893406da955b736c2837217ca9cd3a010 Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Tue, 7 Jul 2015 21:31:24 -0500 Subject: [PATCH 02/41] Revert "bugfix: define tun hostname for olsrd" This reverts commit d4f6aea68e7f4ec5dd2c72961360b28d143033b1. --- files/usr/local/bin/olsrd-config | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/files/usr/local/bin/olsrd-config b/files/usr/local/bin/olsrd-config index 7c690692..35e2a5ae 100755 --- a/files/usr/local/bin/olsrd-config +++ b/files/usr/local/bin/olsrd-config @@ -101,9 +101,7 @@ foreach (@tunnelnames) $section=&uci_get_named_section("vtun",$_); if ($section->{enabled} eq 1) { - my $sip=$section->{serverip}; push(@tunnels,"tun${tunnum}"); - push @hosts, qq("$sip" "tun${tunnum}.$name.local.mesh"); $tunnum++; } } @@ -115,13 +113,15 @@ foreach (@tunnelnames) $section=&uci_get_named_section("vtun",$_); if ($section->{enabled} eq 1) { - my $cip=$section->{clientip}; push(@tunnels,"tun${tunnum}"); - push @hosts, qq("$cip" "tun${tunnum}.$name.local.mesh"); $tunnum++; } } + + + + # add the nameservice plugin push @file, qq(\nLoadPlugin "olsrd_nameservice.so.0.3"\n); push @file, qq({\n); @@ -145,5 +145,6 @@ push @file, qq(\n{\n); push @file, qq( Ip4Broadcast 255.255.255.255\n); push @file, qq(}\n); + # write the file print @file; From d7be9104d9829d9675ee0c3d6e7bb3b31372c5b3 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 9 Jul 2015 09:25:00 -0700 Subject: [PATCH 03/41] bugfix: We need to only pull a small selection of files over through sysupgrade instead of all config files. opkg config can cause issues on OS upgrade among others. ref AREDN->ticket:131 --- files/etc/arednsysupgrade.conf | 32 ++++++++++++++++++++++++++++++++ files/www/cgi-bin/admin | 29 ++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 files/etc/arednsysupgrade.conf diff --git a/files/etc/arednsysupgrade.conf b/files/etc/arednsysupgrade.conf new file mode 100644 index 00000000..a8a58c79 --- /dev/null +++ b/files/etc/arednsysupgrade.conf @@ -0,0 +1,32 @@ +# This file contains a list of files to retain over a sysupgrade with "Keep Settings" in the GUI. +# This list will be used instead of the list normally used by sysupgrade. +/etc/config/ +/etc/config.ap/_setup +/etc/config.ap/_setup.dhcp +/etc/config.ap/_setup.ports +/etc/config.client/_setup +/etc/config.client/_setup.dhcp +/etc/config.client/_setup.ports +/etc/config.mesh_ap/_setup +/etc/config.mesh_ap/_setup.dhcp +/etc/config.mesh_ap/_setup.ports +/etc/config.mesh/_setup +/etc/config.mesh/_setup.dhcp.dmz +/etc/config.mesh/_setup.dhcp.nat +/etc/config.mesh/_setup.ports.dmz +/etc/config.mesh/_setup.ports.nat +/etc/config.mesh/_setup.services.dmz +/etc/config.mesh/_setup.services.nat +/etc/config.router/_setup +/etc/config.router/_setup.dhcp +/etc/config.router/_setup.ports +/etc/dropbear/dropbear_dss_host_key +/etc/dropbear/dropbear_rsa_host_key +/etc/firewall.user +/etc/group +/etc/hosts +/etc/httpd.conf +/etc/local/services +/etc/local/uci/hsmmmesh +/etc/passwd +/etc/shadow diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index bc2c1c4a..d05d03b8 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -228,6 +228,33 @@ if($fw_install and -f "$tmpdir/firmware") { if ( $parms{checkbox_keep_settings} ) { + open (my $SYSUPGRADECONF, "/etc/arednsysupgrade.conf") or die "Failed to open arednsysupgrade.conf"; + open (my $TMPSYSUPGRADECONF, '>', "/tmp/sysupgradefilelist") or die "Failed to open TMPSYSUPGRADECONF"; + while (<$SYSUPGRADECONF>){ + chomp; + next if /^\#/ ; + if ( -e "$_" ) { + print $TMPSYSUPGRADECONF "$_\n"; + } + } + close $SYSUPGRADECONF; + close $TMPSYSUPGRADECONF; + + system("tar -czf /tmp/arednsysupgradebackup.tgz -T /tmp/sysupgradefilelist"); + if ($? == 1) { + print " +

ERROR: Could not backup filesystem.

+

An error occured trying to backup the file system +

+"; + page_footer(); + print ""; + exit 1; + } + + system("rm -f /tmp/sysupgradefilelist"); + + nvram_set("nodeupgraded","1"); print "

Firmware will be written in the background.

@@ -240,7 +267,7 @@ When the Status 4 LED is solid on you can get your new DHCP lease and reconnect (This page will automatically reload in 2½ minutes)
"; - open(FILE, "/sbin/sysupgrade -q $tmpdir/firmware 2>&1 |") or die; + open(FILE, "/sbin/sysupgrade -f /tmp/arednsysupgradebackup.tgz -q $tmpdir/firmware 2>&1 |") or die; } else { From 442b7e98225555823a1c0c84c1819e33c72495cd Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 9 Jul 2015 16:10:50 -0700 Subject: [PATCH 04/41] bugfix: Make sure httpd.conf is up to date on first boot. --- .../uci-defaults/40_aredn_migrate-httpdconf | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 files/etc/uci-defaults/40_aredn_migrate-httpdconf diff --git a/files/etc/uci-defaults/40_aredn_migrate-httpdconf b/files/etc/uci-defaults/40_aredn_migrate-httpdconf new file mode 100644 index 00000000..7aa6b2df --- /dev/null +++ b/files/etc/uci-defaults/40_aredn_migrate-httpdconf @@ -0,0 +1,20 @@ +#!/bin/sh + +IFS=" +" + +addedpaths="/cgi-bin/vpn +/cgi-bin/vpnc +/cgi-bin/supporttool +" + +currentpwd=$(grep "/cgi-bin/setup" /etc/httpd.conf |cut -d ':' -f 3) + +for protectedpath in $addedpaths +do + if grep -q "$protectedpath" "/etc/httpd.conf"; then + continue + fi + echo "$protectedpath:root:$currentpwd" >> /etc/httpd.conf +done + From 650d1bca28a9f3bf2100532bf0cab45fc1a12273 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 9 Jul 2015 20:01:32 -0700 Subject: [PATCH 05/41] bugfix: nodeupgraded needs to be set before taring up the archive ref AREDN->ticket:131 --- files/www/cgi-bin/admin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index d05d03b8..56608d69 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -239,6 +239,7 @@ if($fw_install and -f "$tmpdir/firmware") } close $SYSUPGRADECONF; close $TMPSYSUPGRADECONF; + nvram_set("nodeupgraded","1"); system("tar -czf /tmp/arednsysupgradebackup.tgz -T /tmp/sysupgradefilelist"); if ($? == 1) { @@ -249,13 +250,12 @@ if($fw_install and -f "$tmpdir/firmware") "; page_footer(); print ""; + nvram_set("nodeupgraded","0"); exit 1; } system("rm -f /tmp/sysupgradefilelist"); - - nvram_set("nodeupgraded","1"); print "

Firmware will be written in the background.

If you are connected to the LAN of this node you may need to acquire a new
From 51272c37df128d7533970390e06eb3a37bb5f5e2 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 9 Jul 2015 20:58:32 -0700 Subject: [PATCH 06/41] bugfix: migrate wscan from iwinfo to iw due to new rf channels and iwinfo issues --- files/usr/local/bin/wscan | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index fc158bd2..848324bb 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -55,11 +55,11 @@ sub pushAP my($signal, $chan, $key, $ssid, $mac, $mode) = @_; return if $mode eq ""; - return if $openap and ($key ne "off" or $mode ne "Master"); + return if $openap and ($key ne "" or $mode ne "ESS"); if($ssid eq "") { $ssid = "(hidden)" } - if($key eq "none") { $key = " " } + if($key eq "") { $key = " " } else { $key = "*" } $mac =~ /^(\w\w):(\w\w):(\w\w):(\w\w):(\w\w):(\w\w)/; @@ -69,9 +69,10 @@ sub pushAP if ($ssid =~ /AREDN-(5|10|20)-v[3456]$/) {$typenet = "AREDN" } elsif ($ssid =~ /BroadbandHamnet-(5|10|20)-v[3456]$/) {$typenet = "BroadbandHamnet" } - elsif ($mode eq "Master") {$typenet = "AP" } + elsif ($mode eq "ESS") {$typenet = "AP" } elsif ($mode eq "Managed") {$typenet = "Client"} - elsif ($mode eq "Ad-Hoc" and $ssid =~ /(.*)-(5|10|20)-v[3456]$/ ) {$typenet = $1 } + elsif ($mode eq "IBSS" and $ssid =~ /(.*)-(5|10|20)-v[3456]$/ ) {$typenet = $1 } + elsif ($mode eq "IBSS") {$typenet = "Ad-Hoc"} else {$typenet = $mode} if($avg) @@ -124,8 +125,8 @@ die "bad interface" if not defined $iface; if($raw) { - system("/usr/bin/iwinfo $iface scan"); - system("/usr/sbin/iw $iface station dump"); + system("/usr/bin/iw dev $iface wlan0 scan"); + system("/usr/sbin/iw dev $iface station dump"); exit; } @@ -137,27 +138,34 @@ while(1) $myssid =~ /(.*)-(5|10|20)-v[3456]/; $mymode = $1; - open(FILE, "/usr/bin/iwinfo $iface scan 2>&1 |") or die "iwinfo failed"; + open(FILE, "/usr/sbin/iw dev $iface scan 2>&1 |") or die "iw scan failed"; $mode = ""; $ssid = ""; $signal = 0; - $chan = 99; + $chan = 0; @list = (); while($line = ) { - if($line =~ /Cell \d+ - Address: (\S+)/ ) + if($line =~ /BSS\s+(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/ ) { if ($ssid ne $myssid) { pushAP($signal, $chan, $key, $ssid, $mac, $mode)} $mac = $1; + + $mode = ""; + $ssid = ""; + $signal = 0; + $chan = 0; + $key = ""; + } - if($line =~ /\bESSID: "(.*)"/) { $ssid = $1 } - if($line =~ /\bESSID: unknown/) { $ssid = "unknown" } - if($line =~ /\bMode: (\S+)/) { $mode = $1 } - if($line =~ /\bChannel: (\d+)/) { $chan = $1 } - if($line =~ /\bSignal: ([\d-]+)/) { $signal = $1 } - if($line =~ /\bEncryption: (\w+)/) { $key = $1 } + if($line =~ /\bSSID: (.*)/) { $ssid = $1 } + if($line =~ /\bSSID: unknown/) { $ssid = "unknown" } + if($line =~ /\bcapability: (ESS|IBSS)/) { $mode = $1 } ## WORK ME STILL CMLARA + if($line =~ /\bchannel (\d+)/) { $chan = $1 } + if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 } + if($line =~ /\bGroup cipher:(.+)/) { $key = $1 } } close(FILE); From 0fdeb4e7ebe78e2707da99ed1af8a6acbcde9469 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 9 Jul 2015 21:03:06 -0700 Subject: [PATCH 07/41] bugfix: extend support tool to capture more info from iw as we now use it more than iwinfo --- files/www/cgi-bin/supporttool | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/www/cgi-bin/supporttool b/files/www/cgi-bin/supporttool index ec2c9636..6d94f97f 100755 --- a/files/www/cgi-bin/supporttool +++ b/files/www/cgi-bin/supporttool @@ -74,6 +74,9 @@ use perlfunc; "iwinfo", "iwinfo wlan0 assoclist", "iw phy phy0 info", + "iw dev wlan0 info", + "iw dev wlan0 scan", + "iw dev wlan0 station dump", "logread", "md5sum /www/cgi-bin/*", "echo /all | nc 127.0.0.1 2006", From 311b9d5ffe2328e1ddb8d1c70871b5a6184ebef7 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 10 Jul 2015 18:50:28 -0700 Subject: [PATCH 08/41] bugfix: Nodes are showing up as encrypted when they are not. The code makes the assumption that the connection has not been modified to be encrypted (Standard is not under AREDN V3 protocol) but this may need to be changed in the future. --- files/usr/local/bin/wscan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 848324bb..ac17c245 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -175,7 +175,7 @@ while(1) $mode = ""; $signal = 0; - $key = "none"; + $key = ""; ++$iters; $bbchan = `iw $iface info | grep channel | cut -d\\ -f2`; From cc74123ad32d893086ba28470195a4a6f3092bc2 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 10 Jul 2015 18:56:30 -0700 Subject: [PATCH 09/41] bugfix: vtund was missing from arednsysupgrad.conf --- files/etc/arednsysupgrade.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/files/etc/arednsysupgrade.conf b/files/etc/arednsysupgrade.conf index a8a58c79..4adbe891 100644 --- a/files/etc/arednsysupgrade.conf +++ b/files/etc/arednsysupgrade.conf @@ -17,6 +17,7 @@ /etc/config.mesh/_setup.ports.nat /etc/config.mesh/_setup.services.dmz /etc/config.mesh/_setup.services.nat +/etc/config.mesh/vtun /etc/config.router/_setup /etc/config.router/_setup.dhcp /etc/config.router/_setup.ports From 3c0f3ad14415322728c5c6c54083a904f38df129 Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Sun, 12 Jul 2015 23:26:09 -0500 Subject: [PATCH 10/41] bugfix: tunnel install not posting to same page --- files/www/cgi-bin/tunfunc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/www/cgi-bin/tunfunc.pm b/files/www/cgi-bin/tunfunc.pm index cd894e03..e10dd6d8 100644 --- a/files/www/cgi-bin/tunfunc.pm +++ b/files/www/cgi-bin/tunfunc.pm @@ -198,7 +198,7 @@ sub vpn_setup_required() } print "
"; print "Tunnel software needs to be installed.
"; - print "
\n"; + print "\n"; print ""; print "
"; print "
\n"; From 9294e790eb895b9808f3dde9f63c49e2841d8990 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Wed, 15 Jul 2015 19:27:06 -0700 Subject: [PATCH 11/41] bugfix: AREDN->ticket:132 show AREDN networks on other channels fixed --- files/usr/local/bin/wscan | 93 ++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 848324bb..0ddf748b 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -52,45 +52,38 @@ sub usage sub pushAP { - my($signal, $chan, $key, $ssid, $mac, $mode) = @_; + my($signal, $chan, $key, $ssid, $host, $mac, $mode) = @_; - return if $mode eq ""; + return if $mac eq ""; return if $openap and ($key ne "" or $mode ne "ESS"); if($ssid eq "") { $ssid = "(hidden)" } + if($chan eq "") { $chan = "?" } if($key eq "") { $key = " " } else { $key = "*" } - $mac =~ /^(\w\w):(\w\w):(\w\w):(\w\w):(\w\w):(\w\w)/; - $mac1 = $1 . $2 . $3; - $mac2 = $4 . $5 . $6; - $mac = $mac1 . $mac2; - - if ($ssid =~ /AREDN-(5|10|20)-v[3456]$/) {$typenet = "AREDN" } - elsif ($ssid =~ /BroadbandHamnet-(5|10|20)-v[3456]$/) {$typenet = "BroadbandHamnet" } - elsif ($mode eq "ESS") {$typenet = "AP" } - elsif ($mode eq "Managed") {$typenet = "Client"} - elsif ($mode eq "IBSS" and $ssid =~ /(.*)-(5|10|20)-v[3456]$/ ) {$typenet = $1 } - elsif ($mode eq "IBSS") {$typenet = "Ad-Hoc"} - else {$typenet = $mode} + if ($mode eq "ESS") {$typenet = "AP" } + elsif ($mode eq "Managed") {$typenet = "AP Client"} + elsif ($mode eq "IBSS") {$typenet = "Foreign Ad-Hoc Network"} + else {$typenet = $mode} if($avg) { $avgs{"$mac total"} += $signal; $avgs{"$mac num"} += 1; - $aphash{$mac} = sprintf "%2d %s %-32s %s:%s %s\n", - $chan, $key, $ssid, $mac1, $mac2, $typenet; + $aphash{$mac} = sprintf "% 3d %s %-32s\t%s\t%s\t%s\n", + $chan, $key, $ssid, $host, $mac, $typenet; } elsif($web) { - push @list, sprintf "%03d|%d|%s|%s|%s:%s|%s", - $signal, $chan, $key, $ssid, $mac1, $mac2, $typenet; + push @list, sprintf "% 3d|%d|%s|%s|%s|%s|%s", + $signal, $chan, $key, $ssid, $host, $mac, $typenet; } else { - push @list, sprintf "%3d %2d %s %-32s %s:%s %s\n", - $signal, $chan, $key, $ssid, $mac1, $mac2, $typenet; + push @list, sprintf "% 3d %2d %s %-32s\t%s\t%s\t%s\n", + $signal, $chan, $key, $ssid, $host, $mac, $typenet; } } @@ -135,49 +128,52 @@ while(1) $line = `grep ssid /etc/config/wireless | tail -1`; $line =~ /['"](.*-(5|10|20)-v[3456])/; $myssid = $1; - $myssid =~ /(.*)-(5|10|20)-v[3456]/; - $mymode = $1; + $mychan = `iw dev $iface info | grep channel | cut -d\\ -f2`; open(FILE, "/usr/sbin/iw dev $iface scan 2>&1 |") or die "iw scan failed"; - $mode = ""; - $ssid = ""; - $signal = 0; - $chan = 0; + $mac = ""; + $host = "N/A"; @list = (); while($line = ) { - if($line =~ /BSS\s+(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/ ) + if($line =~ /BSS\s+(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/) { - if ($ssid ne $myssid) { pushAP($signal, $chan, $key, $ssid, $mac, $mode)} - $mac = $1; + pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode); + $mac = uc $1; $mode = ""; $ssid = ""; $signal = 0; - $chan = 0; + $chan = ""; $key = ""; } + if($line =~ /BSS(\s+)([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}.*joined/) + { + $mode = "My Ad-Hoc Network"; + $chan = $mychan; + } if($line =~ /\bSSID: (.*)/) { $ssid = $1 } if($line =~ /\bSSID: unknown/) { $ssid = "unknown" } - if($line =~ /\bcapability: (ESS|IBSS)/) { $mode = $1 } ## WORK ME STILL CMLARA - if($line =~ /\bchannel (\d+)/) { $chan = $1 } + if($line =~ /\bcapability: (ESS|IBSS)/ and $mode eq "") + { $mode = $1 } + if($line =~ /\bchannel ([\d-]+)/) { $chan = $1 } if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 } if($line =~ /\bGroup cipher:(.+)/) { $key = $1 } } close(FILE); - if ($ssid ne $myssid) {pushAP($signal, $chan, $key, $ssid, $mac, $mode)} + pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode); sleep 1 if not scalar @list and $loops != 1; - $mode = ""; + $mac = ""; + $mode = "Connected Ad-Hoc Station"; $signal = 0; - $key = "none"; + $key = ""; ++$iters; - $bbchan = `iw $iface info | grep channel | cut -d\\ -f2`; open(FILE, "/usr/sbin/iw $iface station dump 2>&1 |") or die "/usr/sbin/iw failed"; @@ -185,7 +181,7 @@ while(1) { if($line =~ /Station (\S+) \(on $iface\)/) { - pushAP($signal, $bbchan, $key, $ssid, $mac, $mode); + pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); $mac = $1; $ip = `grep $mac /proc/net/arp`; $mac = uc $mac; @@ -193,22 +189,21 @@ while(1) { $ip =~ s/[ \t].*$// ; chomp($ip); - $ssid = $ip; + $host = $ip; if( $ip ne "") { - foreach(`nslookup $ip`){ next unless ($ssid) = /Address 1: $ip (\S+)\.local\.mesh/ } - if ( $ssid eq "" ) { $ssid = $ip } + foreach(`nslookup $ip`){ next unless ($host) = /Address 1: $ip (\S+)/ } + if ( $host eq "" ) { $host = $ip } } } - else { $ssid = "????" } - $mode=$mymode; + else { $host = "????" } } if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } } close(FILE); - pushAP($signal, $bbchan, $key, $ssid, $mac, $mode); + pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); sleep 1 if not scalar @list and $loops != 1; if(not $batch) @@ -216,19 +211,19 @@ while(1) if($avg) { system "clear"; - printf "Sig Rel Ch E SSID or Hostname MAC Mode %6d\n", $iters; - print "--- --- -- - -------------------------------- ------------- ------\n"; + printf "Sig Rel Ch E SSID Hostname MAC/BSSID 802.11 Mode %6d\n", $iters; + print "--- --- -- - -------------------------------- ----------------- ------------- -----------\n"; } elsif($web) { print "\n"; - print "\n"; + print "\n"; } else { #system "clear"; - printf "Sig Ch E SSID or Hostname MAC Mode %6d\n", $iters; - print "--- -- - -------------------------------- ------------- ------\n"; + printf "Sig Ch E SSID Hostname MAC/BSSID 802.11 Mode %6d\n", $iters; + print "--- -- - -------------------------------- --------------------- ------------- ------------\n"; } } @@ -259,7 +254,7 @@ while(1) if($i++ == 3) { print "" } else { print "" } } - print "" if $i < 6; + print "" if $i < 7; print "\n"; } print "
SigChanEncSSID or HostnameMACMode
SigChanEncSSIDHostnameMAC/BSSID802.11 Mode
$val$val  
\n"; From 0efbd5b2f51c39ebc953a7234c2c7cbca2f0f893 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Wed, 15 Jul 2015 21:10:51 -0700 Subject: [PATCH 12/41] bugfix: wifi scan documentation update for changes made --- files/www/help.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/files/www/help.html b/files/www/help.html index bd1dc53d..a4359a53 100644 --- a/files/www/help.html +++ b/files/www/help.html @@ -71,12 +71,14 @@ provided through those nodes. provides which gives you detailed information about the current state of the OLSR routing software.

-
  • WiFi Scan provides a list of the WiFi networks that the -node can see. It cannot show you which other nodes are visible, that is what the -Mesh Status and OLSR Status pages are for. There is an automatic scan mode but it -is recommended that it not be used continuously because the mesh performance -will suffer due to the node spending much of its time on other channels -looking for other networks.

  • +
  • WiFi Scan displays a list of other 802.11 signals that the +node can see and only of the same bandwidth. The 802.11 signals include +Access Points (AP), neighbor nodes (connected ad-hoc stations), and other mesh networks +(foriegn ad-hoc networks). The AREDN mesh is created on top of an 802.11 'ad-hoc' network. +Consequently when multiple ad-hoc networks are visiable to each other (different SSID or +channel), the 'network' is displayed and not individual nodes (stations). There is also an +automatic scan mode. It is not recommend to run a wifi scan continously because this will degrade mesh +performance. A wifi scan transmits queries on all channels to discover other devices.

  • Setup takes you to the setup pages of the web interface. You will need to supply a username and password to access those From 0cd0db2d0d9dae2c66d129d52f1af44ba337648c Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Fri, 10 Jul 2015 21:51:18 -0500 Subject: [PATCH 13/41] feature: add sysinfo.json for programmatic lightweight management interface --- files/www/cgi-bin/sysinfo.json | 184 +++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100755 files/www/cgi-bin/sysinfo.json diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json new file mode 100755 index 00000000..ee5d9fa4 --- /dev/null +++ b/files/www/cgi-bin/sysinfo.json @@ -0,0 +1,184 @@ +#!/usr/bin/perl +=for comment + + Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks + Copyright (C) 2015 Darryl Quinn + See Contributors file for additional contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 3 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Additional Terms: + + Additional use restrictions exist on the AREDN(TM) trademark and logo. + See AREDNLicense.txt for more info. + + Attributions to the AREDN Project must be retained in the source code. + If importing this code into a new or existing project attribution + to the AREDN project must be added to the source code. + + You must not misrepresent the origin of the material conained within. + + Modified versions must be modified to attribute to the original source + and be marked in reasonable ways as differentiate it from the original + version. + +=cut + +BEGIN {push @INC, '/www/cgi-bin'}; +use perlfunc; + +read_query_string(); +&json_header(); + + +my %info; +$info{"json_version"}="1.0"; + +# ============ GENERATE INFO HASH ========= +$node=nvram_get("node"); +chomp($node); +$info{"node"}=$node; + +$model=`/usr/local/bin/get_model`; +chomp($model); +$info{"model"}=$model; + +# ------- Firmware Manufacturer +if (-e "/www/AREDN.png") +{ + $fw_mfg="AREDN"; +} else { + $fw_mfg = "Other"; +} +$info{"firmware_mfg"}=$fw_mfg; + +$fwver=`cat /etc/mesh-release`; +chomp($fwver); +$info{"firmware_version"}=$fwver; + +# ------- Tunnel Installed +if (-e "/usr/sbin/vtund") +{ + $tunnel_installed="YES"; +} else { + $tunnel_installed="NO"; +} +$info{"tunnel_installed"}=$tunnel_installed; + +# ------- SSID +$line = `grep ssid /etc/config/wireless | tail -1`; +$line =~ /['"](.*-(5|10|20)-v[3456])/; +$myssid = $1; +$myssid =~ /(.*)-(5|10|20)-v[3456]/; +$info{"ssid"}=$myssid; + +# ------- ACTIVE TUNNELS +$active_tunnel_count=`ifconfig|grep tun|wc -l`; +chomp($active_tunnel_count); +$info{"active_tunnel_count"}=$active_tunnel_count; + +# ------- LAT/LON +$lat=`head -1 /etc/latlon 2>/dev/null`; +chomp($lat); +$info{"lat"}=$lat; + +$lon=`tail -1 /etc/latlon 2>/dev/null`; +chomp($lon); +$info{"lon"}=$lon; + + +# ----------- GENERATE THE JSON ------------ +print "{"; +foreach $ik (keys %info) +{ + print "\"$ik\":\"",$info{$ik},"\","; +} + +############## INTERFACES +print "\"interfaces\":{"; +$mystr=""; +foreach(`ifconfig -a`) +{ + next unless /^(\S+) .*HWaddr (\S+)/; + $mystr .= sprintf "\"%s\":{", $1; + ($ip, $mask, $bcast, $net, $cidr) = &get_my_ip($1); + $mystr .= sprintf "\"ip\":\"%s\",",$ip; + $mystr .= sprintf "\"mac\":\"%s\"",$2; + $mystr .= sprintf "},"; +} +chop($mystr); +print $mystr; +print "}"; +############## INTERFACES + +if($parms{"hosts"} ) +{ + # Get a list of services, so we can remove them from the host list + foreach(`cat /var/run/services_olsr`) + { + $line = $_; + if ($line =~ /http:\/\/(.*):([0-9]*)\/.*$/ ) + { + if ( $2 > 0 ) # don't filter nodes with a gateway attached + { + $services{$1} = 1; + } + } + } + + print ",\"hosts\":{"; + $mystr=""; + foreach(`cat /var/run/hosts_olsr`) + { + $line = $_; + next unless /^(\d+\.\d+\.\d+\.\d+)\s*(\S+)/; + if ( not $services{$2} and $line !~ /dtdlink|mid1\./ ) { + #if ( not $services{$2} and $line !~ /dtdlink/ ) { + $mystr .= sprintf "\"%s\":\"%s\",",$2,$1; + } + } + + chop($mystr); + print $mystr; + print "}"; + ############## HOSTS +} + +print "}"; # ROOT + +############################## + + + +sub json_header +{ + # THIS MUST BE ONE LINE! + # otherwise an intermittent busybox bug will incorrectly "fix" the generated output + # print "HTTP/1.0 200 OK\r\n"; # Not needed under Uhttpd + print "Content-type: application/json\r\n"; + print "Cache-Control: no-store\r\n"; + print "\r\n"; +} + +sub get_my_ip +{ + my($ip); + foreach(`ifconfig $_[0]`) + { + next unless /inet addr:([\d\.]+)/; + $ip = $1; + last; + } + return ("none") unless defined $ip; + return $ip; +} \ No newline at end of file From 2a63226ad3b5b92af41c21bf4ceca141a794c047 Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Mon, 13 Jul 2015 11:18:53 -0500 Subject: [PATCH 14/41] feature: added board_id to output --- files/www/cgi-bin/sysinfo.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index ee5d9fa4..d8f9b2c4 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -53,6 +53,8 @@ $model=`/usr/local/bin/get_model`; chomp($model); $info{"model"}=$model; +$info{"board_id"}=&hardware_boardid(); + # ------- Firmware Manufacturer if (-e "/www/AREDN.png") { From cb09c22275fdba1cd6202ece69a9fb0bb5e75f87 Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Mon, 13 Jul 2015 20:32:17 -0500 Subject: [PATCH 15/41] feature: changed version element name, added grid square --- files/www/cgi-bin/sysinfo.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index d8f9b2c4..51f291dc 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -42,7 +42,7 @@ read_query_string(); my %info; -$info{"json_version"}="1.0"; +$info{"api_version"}="1.0"; # ============ GENERATE INFO HASH ========= $node=nvram_get("node"); @@ -71,9 +71,9 @@ $info{"firmware_version"}=$fwver; # ------- Tunnel Installed if (-e "/usr/sbin/vtund") { - $tunnel_installed="YES"; + $tunnel_installed="true"; } else { - $tunnel_installed="NO"; + $tunnel_installed="false"; } $info{"tunnel_installed"}=$tunnel_installed; @@ -98,6 +98,11 @@ $lon=`tail -1 /etc/latlon 2>/dev/null`; chomp($lon); $info{"lon"}=$lon; +# ------- GRID SQUARE +$grid=`head -1 /etc/gridsquare 2>/dev/null`; +chomp($grid); +$info{"grid_square"}=$grid; + # ----------- GENERATE THE JSON ------------ print "{"; From 2613a8507c350eb3b381a7b4fc7fbad551f50ade Mon Sep 17 00:00:00 2001 From: AE6XE Date: Sun, 19 Jul 2015 18:53:50 -0700 Subject: [PATCH 16/41] bugfix: wscan bogus hostname lookup when multiple entries in arp table --- files/usr/local/bin/wscan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 0ddf748b..929788d7 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -183,7 +183,7 @@ while(1) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); $mac = $1; - $ip = `grep $mac /proc/net/arp`; + $ip = `grep $mac /proc/net/arp | egrep "^10.*\$" | tail -1`; $mac = uc $mac; if ( $ip ne "" ) { From 661dc23e18792efca5140cae975805dd44bcf798 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Sun, 19 Jul 2015 23:22:45 -0700 Subject: [PATCH 17/41] bugfix: wscan does not show channels sometimes. We should of used the freq: field, not sure why I did not use it to begin with. Corrected and added a small function to convert from frequency to channel. --- files/usr/local/bin/wscan | 40 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 929788d7..e6a79693 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -50,13 +50,49 @@ sub usage exit; } +sub freq_to_chan +{ + my ($freq) = @_; + + if ($freq < 256 ) + { + return $freq; + } + elsif ($freq == 2484) + { + return "14"; + } + elsif ($freq == 2407) + { + return 0; + } + elsif ($freq < 2484) + { + return ($freq-2407)/5; + } + elsif ($freq < 5000) + { + return ($freq-4000)/5; + } + elsif ($freq < 6000) + { + return ($freq-5000)/5; + } + else + { + return $freq; + } +} + sub pushAP { - my($signal, $chan, $key, $ssid, $host, $mac, $mode) = @_; + my($signal, $freq, $key, $ssid, $host, $mac, $mode) = @_; return if $mac eq ""; return if $openap and ($key ne "" or $mode ne "ESS"); + $chan=freq_to_chan($freq); + if($ssid eq "") { $ssid = "(hidden)" } if($chan eq "") { $chan = "?" } @@ -159,7 +195,7 @@ while(1) if($line =~ /\bSSID: unknown/) { $ssid = "unknown" } if($line =~ /\bcapability: (ESS|IBSS)/ and $mode eq "") { $mode = $1 } - if($line =~ /\bchannel ([\d-]+)/) { $chan = $1 } + if($line =~ /\bfreq: (\d+)/) { $chan = $1 } if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 } if($line =~ /\bGroup cipher:(.+)/) { $key = $1 } } From 9aec7e019be2580dd6c69b67e84bd49b1989b0cf Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Sun, 19 Jul 2015 23:34:06 -0700 Subject: [PATCH 18/41] bugfix: regression: Networks that have not been seen in long time still show up in wifi scan. Regression of changeset:e34b7fcee49c3e2b7eb35aa4fb44b6abdc78b3ad/aredn_ar71xx Having moved to iw for iwinfo we have a regression previous commit. Restore fix that if not seen after 10 seconds signal drops from display. --- files/usr/local/bin/wscan | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index e6a79693..51678171 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -175,7 +175,7 @@ while(1) { if($line =~ /BSS\s+(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/) { - pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } $mac = uc $1; $mode = ""; @@ -183,6 +183,7 @@ while(1) $signal = 0; $chan = ""; $key = ""; + $lastseen = 0; } @@ -198,11 +199,12 @@ while(1) if($line =~ /\bfreq: (\d+)/) { $chan = $1 } if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 } if($line =~ /\bGroup cipher:(.+)/) { $key = $1 } + if($line =~ /\blast seen: (\d+)/) { $lastseen = $1 } } close(FILE); - pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } sleep 1 if not scalar @list and $loops != 1; $mac = ""; From 9b30e157bc9f5619373930f19323288e79026e1d Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Mon, 20 Jul 2015 21:38:01 -0700 Subject: [PATCH 19/41] bugfix: Set max power for device to TPLink programed "max power" This is the absolute maximum that can be used by the device from TPLink eprom programming. The value actually goes down on some frequencies. --- files/www/cgi-bin/perlfunc.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 6980ed44..8a63acdf 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -954,7 +954,7 @@ sub hardware_info 'name' => 'TP-Link CPE210 v1.0', 'comment' => '', 'supported' => '-2', - 'maxpower' => '27', + 'maxpower' => '23', 'pwroffset' => '0', 'usechains' => 1, 'rfband' => '2400', @@ -963,7 +963,7 @@ sub hardware_info 'name' => 'TP-Link CPE510 v1.0', 'comment' => '', 'supported' => '-2', - 'maxpower' => '27', + 'maxpower' => '23', 'pwroffset' => '0', 'usechains' => 1, 'rfband' => '5800ubntus', From 108e05088b07ad58f330aaff5bec4b47b2ee2c1c Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Mon, 20 Jul 2015 23:30:49 -0700 Subject: [PATCH 20/41] bugfix: Add max power level tracking control for per channel power on devices Mainly relates to TP-Link devices which have a roving power level programmed into the hardware. The datasheets for the hardware may say higher power but the chip has been programmed to not go above these values. --- files/usr/local/bin/node-setup | 2 +- files/www/cgi-bin/perlfunc.pm | 18 +++++++++++++++++- files/www/cgi-bin/setup | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index 4c958824..f6aa2c7e 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -420,7 +420,7 @@ open(FILE, ">/etc/local/services") or die; print FILE "#!/bin/sh\n"; unless($cfg{wifi_proto} eq "disabled") { - $cfg{wifi_txpower} = wifi_maxpower() if not defined $cfg{wifi_txpower} or $cfg{wifi_txpower} > wifi_maxpower(); + $cfg{wifi_txpower} = wifi_maxpower($cfg{wifi_channel}) if not defined $cfg{wifi_txpower} or $cfg{wifi_txpower} > wifi_maxpower($cfg{wifi_channel}); $cfg{wifi_txpower} = 1 if $cfg{wifi_txpower} < 1; print FILE "/usr/sbin/iw dev wlan0 set txpower fixed $cfg{wifi_txpower}00\n"; if(defined $cfg{aprs_lat} and defined $cfg{aprs_lon}) diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 8a63acdf..481897c4 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -958,6 +958,7 @@ sub hardware_info 'pwroffset' => '0', 'usechains' => 1, 'rfband' => '2400', + 'chanpower' => { 1 => '22', 14 => '23' }, }, 'TP-Link CPE510 v1.0' => { 'name' => 'TP-Link CPE510 v1.0', @@ -967,6 +968,7 @@ sub hardware_info 'pwroffset' => '0', 'usechains' => 1, 'rfband' => '5800ubntus', + 'chanpower' => { 48 => '10', 149 => '17', 184 => '23' }, }, '0xc2a2' => { 'name' => 'Bullet 2 HP', @@ -1268,8 +1270,22 @@ sub hardware_info # Return maximum dbm value for tx power sub wifi_maxpower { + my ($wifichannel) = @_; + $boardinfo = hardware_info(); - if ( exists $boardinfo->{'maxpower'} ) { + + if ( exists $boardinfo->{'chanpower'} ) { + my $chanpower=$boardinfo->{'chanpower'}; + foreach ( sort {$a<=>$b} keys %{$chanpower} ) + { + if ( $wifichannel <= $_ ) + { + return $chanpower->{$_}; + } + } + # We should never get here + return 27; + } elsif ( exists $boardinfo->{'maxpower'} ) { return $boardinfo->{'maxpower'}; } else { diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 5af2495f..821426b8 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -140,7 +140,7 @@ unless($parms{reload}) } # sanitize the active settings -$wifi_txpower = wifi_maxpower() if not defined $wifi_txpower or $wifi_txpower > wifi_maxpower(); +$wifi_txpower = wifi_maxpower($wifi_channel) if not defined $wifi_txpower or $wifi_txpower > wifi_maxpower($wifi_channel); $wifi_txpower = 1 if $wifi_txpower < 1; $wifi_distance = 0 unless defined $wifi_distance; $wifi_distance = 0 if $wifi_distance =~ /\D/; @@ -600,7 +600,7 @@ if($wifi_proto ne "disabled") print "Tx Power\n"; print "\n"; print "Distance\n"; From 912afe3713c3ef2ee6650e98a4b5a01235258971 Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Tue, 21 Jul 2015 12:19:41 -0500 Subject: [PATCH 21/41] added channel bandwidth --- files/www/cgi-bin/sysinfo.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index 51f291dc..ae0c9cec 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -84,6 +84,11 @@ $myssid = $1; $myssid =~ /(.*)-(5|10|20)-v[3456]/; $info{"ssid"}=$myssid; +# ------- Wifi Bandwidth +$line = `uci get wireless.radio0.chanbw`; +chomp($line); +$info{"chanbw"}=$line; + # ------- ACTIVE TUNNELS $active_tunnel_count=`ifconfig|grep tun|wc -l`; chomp($active_tunnel_count); From f209886f76031ff21b93cabfb18373ec39bfde17 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Wed, 22 Jul 2015 23:00:58 -0700 Subject: [PATCH 22/41] add qmark image Part of Freesns Cumulus package https://www.iconfinder.com/icons/183285/help_mark_question_icon#size=16 Free for commerical use Created by Yannick Lung, 2013 Web: www.yanlu.de Twitter: @FreecnsUI or @YanluDE Facebook: www.facebook.com/FreecnsUI Mail: freecns@yanlu.de Google+: Freecns App.net: Freecns Version 2.0 known as Freecns Cumulus LICENSE You are free to use Freecns for commercial and personal purposes without attribution, however a credit for the work would be appreciated. You may not sell or redistribute the icons themselves as icons. Do not claim creative credit. --- files/www/qmark.png | Bin 0 -> 361 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 files/www/qmark.png diff --git a/files/www/qmark.png b/files/www/qmark.png new file mode 100644 index 0000000000000000000000000000000000000000..c27ca652a6338574d048c67649ce529b4b53ed5c GIT binary patch literal 361 zcmV-v0ha!WP)NA=8+t@44ixJ|1gPd z4Df=VV9)5I$msvEgma9i*Z}QZ@ZAi-mEERE(#j{;Kobk0^;7&tntnWU9DEe`7WS}< z`M@0{+CrEqCf9=aIN}Zix14BuO>~ldTm Date: Wed, 22 Jul 2015 23:16:24 -0700 Subject: [PATCH 23/41] add help text and icon for power setting info --- files/www/cgi-bin/setup | 2 +- files/www/help.html | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 821426b8..e22d0469 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -601,7 +601,7 @@ if($wifi_proto ne "disabled") print "\n"; + print "  \n"; print "Distance\n"; print " meters\n"; diff --git a/files/www/help.html b/files/www/help.html index a4359a53..2636fabb 100644 --- a/files/www/help.html +++ b/files/www/help.html @@ -287,6 +287,14 @@ As always a dummy load on unused RF ports is recommended to keep out physical contaminants and to avoid EMI/RFI interference.

    +The Power setting controls the max power +the unit may output. The node may decrease its power output as it enters higher +speed data rates to maintain a linear spectrum. Some devices may have max power +levels that change based on what channel/frequency the hardware is operating on, +in this case the max level will change when you save the settings and will be +capped at the max level supported by the hardware for that frequency. +

    +

    The Distance setting adjusts the packet retry timer to account for stations that are very far away, presumably about 300 meters or more. The value should be set to the distance in meters to the farthest node From 2511f585f0046d77cb10d763f569d526a2237576 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 23 Jul 2015 11:35:54 -0700 Subject: [PATCH 24/41] bugfix: Should not keep /etc/config/* on sysupgrade We don't really need any files in there, and keeping the folder can interfere with the programs that populate /etc/aredn_include on firstboot from uci-default. This will cause the node to boot up in default mode (with an AP on its interface on the default channels) during its first boot, and than very quickly reboot and come up under the mesh. --- files/etc/arednsysupgrade.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/files/etc/arednsysupgrade.conf b/files/etc/arednsysupgrade.conf index 4adbe891..0f94a399 100644 --- a/files/etc/arednsysupgrade.conf +++ b/files/etc/arednsysupgrade.conf @@ -1,6 +1,5 @@ # This file contains a list of files to retain over a sysupgrade with "Keep Settings" in the GUI. # This list will be used instead of the list normally used by sysupgrade. -/etc/config/ /etc/config.ap/_setup /etc/config.ap/_setup.dhcp /etc/config.ap/_setup.ports From ae2bc531b25cadd6a8c9c495015ed77b431707a1 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 23 Jul 2015 21:24:21 -0700 Subject: [PATCH 25/41] hardware: board add: Rocket M5 with USB Port board.info {{{ board.sysid=0xe105 board.cpurevision=0x000000c2 board.name=Rocket M5 board.shortname=R5N board.subtype= board.netmodes=7 board.hwaddr=00156DDC9D53 board.reboot=30 board.upgrade=150 board.phycount=1 board.phy.1.maxmtu=1524 board.phy.2.maxmtu=1524 radio.1.name= radio.1.shortname= radio.1.bus=pci radio.1.subsystemid=0xe105 radio.1.subvendorid=0x0777 radio.1.txpower.max=27 radio.1.txpower.offset=5 radio.1.antennas=1 radio.1.def_antenna=4 radio.1.antenna.1.id=4 radio.1.antenna.1.name=Combined radio.1.antenna.1.gain=0 }}} --- files/www/cgi-bin/perlfunc.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 481897c4..6bc4c56b 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -1038,6 +1038,15 @@ sub hardware_info 'usechains' => 1, 'rfband' => '2400', }, + '0xe105' => { + 'name' => 'Rocket M5', + 'comment' => 'Rocket M5 with USB', + 'supported' => '1', + 'maxpower' => '22', + 'pwroffset' => '5', + 'usechains' => 1, + 'rfband' => '5800ubntus', + }, '0xe1b2' => { 'name' => 'Rocket M2', 'comment' => '', From af97ce3f49ec002311878a07854efa391f22ca77 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Tue, 28 Jul 2015 08:49:48 -0700 Subject: [PATCH 26/41] bugfix: "Disable default route" not kept during OTA upgrade. --- files/etc/config.ap/_setup.default | 1 + files/etc/config.client/_setup.default | 1 + files/etc/config.mesh/_setup.default | 1 + files/etc/config.mesh_ap/_setup.default | 1 + files/etc/config.router/_setup.default | 1 + 5 files changed, 5 insertions(+) diff --git a/files/etc/config.ap/_setup.default b/files/etc/config.ap/_setup.default index 14ac2324..7b57330b 100644 --- a/files/etc/config.ap/_setup.default +++ b/files/etc/config.ap/_setup.default @@ -11,6 +11,7 @@ lan_proto = static lan_ip = 172.27.1.1 lan_mask = 255.255.255.0 lan_dhcp = 1 +lan_dhcp_noroute = 0 dhcp_start = 5 dhcp_end = 25 diff --git a/files/etc/config.client/_setup.default b/files/etc/config.client/_setup.default index 926b43ce..26643e1a 100644 --- a/files/etc/config.client/_setup.default +++ b/files/etc/config.client/_setup.default @@ -8,6 +8,7 @@ lan_proto = static lan_ip = 172.27.2.1 lan_mask = 255.255.255.0 lan_dhcp = 1 +lan_dhcp_noroute = 0 dhcp_start = 5 dhcp_end = 25 diff --git a/files/etc/config.mesh/_setup.default b/files/etc/config.mesh/_setup.default index a418f4b1..31dcec0c 100644 --- a/files/etc/config.mesh/_setup.default +++ b/files/etc/config.mesh/_setup.default @@ -14,6 +14,7 @@ lan_proto = static lan_ip = 172.27.0.1 lan_mask = 255.255.255.0 lan_dhcp = 1 +lan_dhcp_noroute = 0 dhcp_start = 5 dhcp_end = 25 diff --git a/files/etc/config.mesh_ap/_setup.default b/files/etc/config.mesh_ap/_setup.default index ed461bc9..b640013d 100644 --- a/files/etc/config.mesh_ap/_setup.default +++ b/files/etc/config.mesh_ap/_setup.default @@ -12,6 +12,7 @@ lan_ip = 172.27.0.2 lan_mask = 255.255.255.0 lan_dhcp = 0 lan_gw = 172.27.0.1 +lan_dhcp_noroute = 0 dhcp_start = 5 dhcp_end = 25 diff --git a/files/etc/config.router/_setup.default b/files/etc/config.router/_setup.default index fb57dddc..77f3d883 100644 --- a/files/etc/config.router/_setup.default +++ b/files/etc/config.router/_setup.default @@ -4,6 +4,7 @@ lan_proto = static lan_ip = 172.27.3.1 lan_mask = 255.255.255.0 lan_dhcp = 1 +lan_dhcp_noroute = 0 dhcp_start = 5 dhcp_end = 25 From 316cb4f9c9e43ad2ad7f8c2ddf18d991ba558883 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 30 Jul 2015 10:28:13 -0700 Subject: [PATCH 27/41] bugfix: build all arednpackages --- build/buildsteps/001-prepbuild | 1 + 1 file changed, 1 insertion(+) diff --git a/build/buildsteps/001-prepbuild b/build/buildsteps/001-prepbuild index 65a32106..f313bf83 100755 --- a/build/buildsteps/001-prepbuild +++ b/build/buildsteps/001-prepbuild @@ -9,6 +9,7 @@ cat feeds.conf.default >> feeds.conf ./scripts/feeds install -p arednpackages olsrd ./scripts/feeds install perl ./scripts/feeds install -p arednpackages vtun +./scripts/feeds install -a -p arednpackages ./scripts/feeds install snmpd ./scripts/feeds install ntpclient From 28f038edd50413109c14cf1bddbab481e8c56421 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Mon, 3 Aug 2015 15:57:42 -0700 Subject: [PATCH 28/41] bugfix: Correct section reference 10(e) should be 7(e) when referring to the section that grants the additional terms permission in GPL. --- AREDNLicense.txt | 2 +- files/www/about.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AREDNLicense.txt b/AREDNLicense.txt index f3645886..2037cdf0 100644 --- a/AREDNLicense.txt +++ b/AREDNLicense.txt @@ -1,4 +1,4 @@ -In accordance with the permissions granted under section 10(e) of +In accordance with the permissions granted under section 7(e) of the GPLv3 License: The AREDN(TM) trademark and AREDN(TM) logo and for use in official diff --git a/files/www/about.html b/files/www/about.html index 2d5f7493..41de923c 100644 --- a/files/www/about.html +++ b/files/www/about.html @@ -49,7 +49,7 @@ and be marked in reasonable ways as differentiate it from the original version.

    AREDN™ Terms:
    -In accordance with the permissions granted under section 10(e) of the GPLv3 License:
    +In accordance with the permissions granted under section 7(e) of the GPLv3 License:

    The AREDN™ trademark and AREDN™ logo and for use in official Amateur Radio Emergency Data Network (AREDN™) sanctioned builds.

    From 3cd84b3dfce6721a1c237ac264ce47249083a00d Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Wed, 5 Aug 2015 13:40:45 -0500 Subject: [PATCH 29/41] bugfix: wrong syntax for iw --- files/usr/local/bin/wscan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 51678171..13ca1b5d 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -154,7 +154,7 @@ die "bad interface" if not defined $iface; if($raw) { - system("/usr/bin/iw dev $iface wlan0 scan"); + system("/usr/bin/iw dev $iface scan"); system("/usr/sbin/iw dev $iface station dump"); exit; } From 14d7163666121a3cc1ac41a7e6ab53c802c0295e Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Tue, 18 Aug 2015 21:39:30 -0500 Subject: [PATCH 30/41] add wifi channel number --- files/www/cgi-bin/sysinfo.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index ae0c9cec..787d5fc2 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -84,6 +84,11 @@ $myssid = $1; $myssid =~ /(.*)-(5|10|20)-v[3456]/; $info{"ssid"}=$myssid; +# ------- Wifi Channel Number +$mychan = `uci get wireless.radio0.channel`; +chomp($mychan); +$info{"channel"}=$mychan; + # ------- Wifi Bandwidth $line = `uci get wireless.radio0.chanbw`; chomp($line); From 0669217984a2af3ec743dc10993335c3a2c85a0d Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Fri, 28 Aug 2015 20:09:33 -0500 Subject: [PATCH 31/41] check for 3Ghz band channels and report freq instead --- files/www/cgi-bin/sysinfo.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index 787d5fc2..8e5441ea 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -87,7 +87,12 @@ $info{"ssid"}=$myssid; # ------- Wifi Channel Number $mychan = `uci get wireless.radio0.channel`; chomp($mychan); -$info{"channel"}=$mychan; +# 3GHZ channel -> Freq conversion +if ($mychan >= 76 and $mychan <= 99) { + $info{"channel"}=($mychan * 5) + 3000; +} else { + $info{"channel"}=$mychan; +} # ------- Wifi Bandwidth $line = `uci get wireless.radio0.chanbw`; From d0bbeae66bb0d3446369286156fe40394e34f5d2 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Fri, 28 Aug 2015 19:44:54 -0700 Subject: [PATCH 32/41] bugfix: wscan - show 3ghz freq instead of channels, fix blank mode fields --- files/usr/local/bin/wscan | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 13ca1b5d..38056104 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -72,7 +72,15 @@ sub freq_to_chan } elsif ($freq < 5000) { - return ($freq-4000)/5; + return $freq ; # stay in freq, no ch #s + } + elsif ($freq < 5380) # these are 5Ghz channels 75 and below + { + return ($freq-5000)/5 ; + } + elsif ($freq < 5500) # ch 76 to 99 can only be 3Ghz freq, no part 15 here + { + return ($freq-2000); # return 3ghz freq (5ghz boards with -2Ghz transverter) } elsif ($freq < 6000) { @@ -99,27 +107,22 @@ sub pushAP if($key eq "") { $key = " " } else { $key = "*" } - if ($mode eq "ESS") {$typenet = "AP" } - elsif ($mode eq "Managed") {$typenet = "AP Client"} - elsif ($mode eq "IBSS") {$typenet = "Foreign Ad-Hoc Network"} - else {$typenet = $mode} - if($avg) { $avgs{"$mac total"} += $signal; $avgs{"$mac num"} += 1; $aphash{$mac} = sprintf "% 3d %s %-32s\t%s\t%s\t%s\n", - $chan, $key, $ssid, $host, $mac, $typenet; + $chan, $key, $ssid, $host, $mac, $mode; } elsif($web) { push @list, sprintf "% 3d|%d|%s|%s|%s|%s|%s", - $signal, $chan, $key, $ssid, $host, $mac, $typenet; + $signal, $chan, $key, $ssid, $host, $mac, $mode; } else { push @list, sprintf "% 3d %2d %s %-32s\t%s\t%s\t%s\n", - $signal, $chan, $key, $ssid, $host, $mac, $typenet; + $signal, $chan, $key, $ssid, $host, $mac, $mode; } } @@ -165,7 +168,11 @@ while(1) $line =~ /['"](.*-(5|10|20)-v[3456])/; $myssid = $1; $mychan = `iw dev $iface info | grep channel | cut -d\\ -f2`; - + if ($mychan >= 76 and $mychan <= 99) + { + $mychan = ($mychan*5+3000); # ch 76 - 99 are 3ghz since no part 15 usage (5ghz board with -2ghz transverter) + } + open(FILE, "/usr/sbin/iw dev $iface scan 2>&1 |") or die "iw scan failed"; $mac = ""; $host = "N/A"; @@ -175,7 +182,7 @@ while(1) { if($line =~ /BSS\s+(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/) { - if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } + pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) ; $mac = uc $1; $mode = ""; @@ -194,8 +201,10 @@ while(1) } if($line =~ /\bSSID: (.*)/) { $ssid = $1 } if($line =~ /\bSSID: unknown/) { $ssid = "unknown" } - if($line =~ /\bcapability: (ESS|IBSS)/ and $mode eq "") - { $mode = $1 } + if($line =~ /\bcapability: (ESS|PBCC|ChannelAgility|SpectrumMgmt)/) + { $mode = "AP" } + if($line =~ /\bcapability: (IBSS)/ and $mode eq "") + { $mode = "Foreign Ad-Hoc Network" } if($line =~ /\bfreq: (\d+)/) { $chan = $1 } if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 } if($line =~ /\bGroup cipher:(.+)/) { $key = $1 } @@ -204,7 +213,7 @@ while(1) close(FILE); - if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } + pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) ; sleep 1 if not scalar @list and $loops != 1; $mac = ""; From 0f8b82e0740ae19c514a435924da7daecb1fa4bc Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 4 Sep 2015 20:48:17 -0700 Subject: [PATCH 33/41] bugfix: regression: Networks not seen in long time show up in scan commit d0bbeae66bb0d3446369286156fe40394e34f5d2 introduced a regression previously fixed in commit 9aec7e019be2580dd6c69b67e84bd49b1989b0cf Resolves regression --- files/usr/local/bin/wscan | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 38056104..fb697392 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -182,7 +182,7 @@ while(1) { if($line =~ /BSS\s+(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/) { - pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) ; + if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } $mac = uc $1; $mode = ""; @@ -213,7 +213,7 @@ while(1) close(FILE); - pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) ; + if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } sleep 1 if not scalar @list and $loops != 1; $mac = ""; From ba3f3b9b168c94f6ee389e21860bee37b4066847 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 4 Sep 2015 21:38:44 -0700 Subject: [PATCH 34/41] bugfix: initialize lastseen variable before first use. --- files/usr/local/bin/wscan | 1 + 1 file changed, 1 insertion(+) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index fb697392..b9b1c027 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -176,6 +176,7 @@ while(1) open(FILE, "/usr/sbin/iw dev $iface scan 2>&1 |") or die "iw scan failed"; $mac = ""; $host = "N/A"; + $lastseen = 0; @list = (); while($line = ) From c7bde9712a3efb133e71737f30106fb574456778 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 4 Sep 2015 22:11:00 -0700 Subject: [PATCH 35/41] bugfix: station listing includes nodes that have not been seen for some time Also resolves the "0" signal strength as nodes that have not been seen in long time show up as a 0 for signal. This is a regression of the issues seen on the iw scan but in this case applies to station dump which we have not used before. --- files/usr/local/bin/wscan | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index b9b1c027..85ddac3f 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -221,6 +221,7 @@ while(1) $mode = "Connected Ad-Hoc Station"; $signal = 0; $key = ""; + $lastseen = 0; ++$iters; open(FILE, "/usr/sbin/iw $iface station dump 2>&1 |") or die "/usr/sbin/iw failed"; @@ -229,7 +230,9 @@ while(1) { if($line =~ /Station (\S+) \(on $iface\)/) { - pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode) } + + $lastseen = 0; $mac = $1; $ip = `grep $mac /proc/net/arp | egrep "^10.*\$" | tail -1`; $mac = uc $mac; @@ -247,11 +250,13 @@ while(1) else { $host = "????" } } - if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } + if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } + if($line =~ /inactive time:\t(\d+) ms/) { $lastseen = $1 } } close(FILE); - pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode) } + sleep 1 if not scalar @list and $loops != 1; if(not $batch) From a200f49a3749e9fc50a3bb4320838f728705d6a6 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Fri, 4 Sep 2015 22:19:53 -0700 Subject: [PATCH 36/41] bugfix: Better handle AP detection. All devices that respond to an iw scan will be AP's or ADHOCS. All adhoc devices need to have the adhoc designator so if we don't see this we know its an AP. --- files/usr/local/bin/wscan | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 85ddac3f..18c2e1b2 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -97,7 +97,7 @@ sub pushAP my($signal, $freq, $key, $ssid, $host, $mac, $mode) = @_; return if $mac eq ""; - return if $openap and ($key ne "" or $mode ne "ESS"); + return if $openap and ($key ne ""); $chan=freq_to_chan($freq); @@ -186,7 +186,7 @@ while(1) if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $host, $mac, $mode) } $mac = uc $1; - $mode = ""; + $mode = "AP"; $ssid = ""; $signal = 0; $chan = ""; @@ -202,9 +202,7 @@ while(1) } if($line =~ /\bSSID: (.*)/) { $ssid = $1 } if($line =~ /\bSSID: unknown/) { $ssid = "unknown" } - if($line =~ /\bcapability: (ESS|PBCC|ChannelAgility|SpectrumMgmt)/) - { $mode = "AP" } - if($line =~ /\bcapability: (IBSS)/ and $mode eq "") + if($line =~ /\bcapability: (IBSS)/ and $mode eq "AP") { $mode = "Foreign Ad-Hoc Network" } if($line =~ /\bfreq: (\d+)/) { $chan = $1 } if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 } From a5492c0807db7f46f42120a73c279b62d1f88db7 Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Mon, 19 Oct 2015 22:48:09 -0500 Subject: [PATCH 37/41] bugfix: tunnel client not showing errors. allow - in pwd --- files/www/cgi-bin/vpnc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/files/www/cgi-bin/vpnc b/files/www/cgi-bin/vpnc index 3551d292..805231bb 100755 --- a/files/www/cgi-bin/vpnc +++ b/files/www/cgi-bin/vpnc @@ -133,7 +133,7 @@ foreach $val (@list) } # password MUST be alphanumeric (no special chars) - push @conn_err, "The password cannot contain non-alphanumeric characters (#$conn_num)" if ($passwd =~ m/[^a-zA-Z0-9@]/); + push @conn_err, "The password cannot contain non-alphanumeric characters (#$conn_num)" if ($passwd =~ m/[^a-zA-Z0-9@\-]/); push @conn_err, "A connection server is required" if($host eq ""); push @conn_err, "A connection password is required" if($passwd eq ""); push @conn_err, "A connection network IP is required" if($netip eq ""); @@ -222,16 +222,16 @@ push @hidden, ""; ################# # messages ################# -if(@cli_err) +if(@conn_err) { print "ERROR:
    "; - foreach(@cli_err) { print "$_
    " } + foreach(@conn_err) { print "$_
    " } print "
    \n"; } if($parms{button_save}) { - if(@cli_err) + if(@conn_err) { print "Configuration NOT saved!\n"; } @@ -412,18 +412,18 @@ sub save_connections() my $vtun_node_name=uc "$node-$net"; $rc=&uci_set_named_option("vtun","server_$i","clientip",$clientip); - push(@cli_err,"Problem saving UCI vtun connection client IP (#$i)") if $rc; + push(@conn_err,"Problem saving UCI vtun connection client IP (#$i)") if $rc; $rc=&uci_set_named_option("vtun","server_$i","serverip",$serverip); - push(@cli_err,"Problem saving UCI vtun connection server IP (#$i)") if $rc; + push(@conn_err,"Problem saving UCI vtun connection server IP (#$i)") if $rc; $rc=&uci_set_named_option("vtun","server_$i","node",$vtun_node_name); - push(@cli_err,"Problem saving UCI vtun connection name (#$i)") if $rc; + push(@conn_err,"Problem saving UCI vtun connection name (#$i)") if $rc; foreach $var (qw(enabled host passwd netip)) { $rc=&uci_set_named_option("vtun","server_$i",$var,$parms{"conn${i}_$var"}); - push(@cli_err,"Problem saving UCI vtun connection (#$i)") if $rc; + push(@conn_err,"Problem saving UCI vtun connection (#$i)") if $rc; } $enabled_count++ if $parms{"conn${i}_enabled"}; } From 8cd8e0788554c54dad240070ebe2676ec75c4191 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Sun, 1 Nov 2015 18:33:05 -0800 Subject: [PATCH 38/41] bugfix: deaf chain workaround --- files/etc/crontabs/root | 1 + files/usr/local/bin/rssi_monitor | 299 +++++++++++++++++++++++++++++++ 2 files changed, 300 insertions(+) create mode 100755 files/usr/local/bin/rssi_monitor diff --git a/files/etc/crontabs/root b/files/etc/crontabs/root index 8d2a6c30..35e45dd2 100644 --- a/files/etc/crontabs/root +++ b/files/etc/crontabs/root @@ -1 +1,2 @@ */5 * * * * /usr/local/bin/fccid +*/1 * * * * /usr/local/bin/rssi_monitor diff --git a/files/usr/local/bin/rssi_monitor b/files/usr/local/bin/rssi_monitor new file mode 100755 index 00000000..c09d180c --- /dev/null +++ b/files/usr/local/bin/rssi_monitor @@ -0,0 +1,299 @@ +#!/usr/bin/perl +# +# GPL V2 or greater +# work around Atheros ANI overly attenuating recieve chain with tendency to become stuck +# Joe Ayers AE6XE ae6xe@arrl.net 2015-10-29 + +# A receive chain may go deaf at noise prone sites and some neighbors may drop out. +# The wireless driver poorly tunes and treats these neighbors as noise in error. +# This is a workaround until root cause driver updates occur. + +$now=`cat /proc/uptime | cut -f1 -d" "`; +chomp $now; + +exit 0 unless $now > 120; + +$iface = "wlan0" ; # wireless interface +$datfile = "/tmp/rssi.dat"; +$logfile = "/tmp/rssi.log"; + +open(my $lfh, '>>', $logfile) or die "Could not open file $logfile $!"; + +sub getRSSI +{ + for (keys %rssi) + { + delete $rssi{$_}; + } + + open(FILE, "/usr/sbin/iw $iface station dump 2>&1 |") or die "/usr/sbin/iw failed $!"; + + $neighborCount = 0; + while($line = ) + { + if($line =~ /Station (\S+) \(on $iface\)/) { $mac = $1;} + if($antnum and $line =~ /signal:[ \t]+[-\d]+[ \t]*\[([-\d]+),[ \t]*([-\d]+)/) + { + $H = $1; + $V = $2; + } + + if ((not $antnum) and $line =~ /signal:[ \t]+[-\d]+[ \t]*\[([-\d]+)\]/) + { + $H = $1; + } + if ($H) + { + if ($H < -95) { $rssi{$mac}{"Hrssi"}=-96 ; } + else { $rssi{$mac}{"Hrssi"}=$H ; } + undef $H; + $neighborCount += 1; + } + if ($V) + { + if ($V < -95) { $rssi{$mac}{"Vrssi"}=-96 ; } + else { $rssi{$mac}{"Vrssi"}=$V ; } + undef $V; + } + } +} + +$antnum=`iw list | grep "Configured Antennas: TX" | cut -f6 -d" "`; +chomp $antnum; +if ($antnum eq "0x1") +{ + $antnum=0; +} +else +{ + $antnum=1; # more than one +} + +if ( -e $datfile ) +{ + open(FILE, "<$datfile") or die "Unable to read \"$datfile\""; + + while($line = ) + { + if ($antnum) + { + ($mac, $aveH, $aveV, $stdDevH, $stdDevV, $numS, $last) = split /\|/, $line; + $rssiHist{$mac}{"aveV"} = $aveV; + $rssiHist{$mac}{"sdV"} = $stdDevV; + } + else + { + ($mac, $aveH, $stdDevH, $numS, $last) = split /\|/, $line; + } + $rssiHist{$mac}{"aveH"} = $aveH; + $rssiHist{$mac}{"sdH"} = $stdDevH; + $rssiHist{$mac}{"num"} = $numS; + chomp $last; + $rssiHist{$mac}{"last"} = $last; + } + close FILE ; +} + +$ofdm_level = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/ani | grep "OFDM LEVEL" | cut -f2 -d: `; +$now=`cat /proc/uptime | cut -f1 -d" "`; +chomp $now; + +getRSSI() ; + +for (keys %rssi) +{ + if ( $rssiHist{$_} and $now - $rssiHist{$_}{"last"} < 3600 ) + { + $hit = 0 ; + $sdH3 = int(3 * $rssiHist{$_}{"sdH"} + .5); + # is the RSSI attenuated and 3 standard deviations away? Test is only 1 chain has dropped, not both. + if ($rssiHist{$_}{"aveH"} - $rssi{$_}{"Hrssi"} > $sdH3) { $hit += 1; } + if ( $antnum ) + { + $sdV3 = int(3 * $rssiHist{$_}{"sdV"} + .5); + if ($rssiHist{$_}{"aveV"} - $rssi{$_}{"Vrssi"} > $sdV3) { $hit += 1; } + } + + if ($rssiHist{$_}{"num"} > 9 and $ofdm_level <= 2 and $hit == 1) + { # Overly Attenuated Chain Suspected + $datestring = localtime(); + if ($antnum) + { + print $lfh "$datestring: Attenuated Suspect $_ [$rssi{$_}{'Hrssi'},$rssi{$_}{'Vrssi'}] $rssiHist{$_}{'aveH'} "; + print $lfh "$rssiHist{$_}{'aveV'} $rssiHist{$_}{'sdH'} $rssiHist{$_}{'sdV'}\n"; + } + else + { + print $lfh "$datestring: Attenuated Suspect $_ [$rssi{$_}{'Hrssi'}] $rssiHist{$_}{'aveH'} $rssiHist{$_}{'sdH'}\n"; + } + + # find strongest signal to compare RSSI before/after reset + if ( $amac ) + { + if ($antnum) + { + if ($rssi{$amac}{"Hrssi"} < $rssi{$amac}{"Vrssi"} ) { $strong1 = "Vrssi" ;} else {$strong1 = "Hrssi"; } + if ($rssi{$_}{"Hrssi"} < $rssi{$_}{"Vrssi"} ) { $strong2 = "Vrssi" ;} else {$strong2 = "Hrssi"; } + if ($rssi{$amac}{$strong1} < $rssi{$_}{$strong2} ) { $amac = $_ ;} + } + else + { + if ($rssi{$amac}{"Hrssi"} < $rssi{$_}{"Hrssi"} ) { $amac = $_ ;} + } + } + else { $amac = $_ ; } + next ; # do not update statistics when suspected condition + } + + # unpdate statistics + $aveH = (($rssiHist{$_}{"aveH"}*$rssiHist{$_}{"num"})+$rssi{$_}{"Hrssi"}) / ($rssiHist{$_}{"num"} + 1 ); + $sdH = sqrt((($rssiHist{$_}{"num"}-1)*($rssiHist{$_}{"sdH"}**2) + + (($rssi{$_}{"Hrssi"}-$aveH)*($rssi{$_}{"Hrssi"}-$rssiHist{$_}{"aveH"})))/$rssiHist{$_}{"num"}); + chomp $aveH; + chomp $sdH; + + if ($antnum) + { + $aveV = (($rssiHist{$_}{"aveV"}*$rssiHist{$_}{"num"})+$rssi{$_}{"Vrssi"}) / ($rssiHist{$_}{"num"} + 1 ); + $sdV = sqrt((($rssiHist{$_}{"num"}-1)*($rssiHist{$_}{"sdV"}**2) + + (($rssi{$_}{"Vrssi"}-$aveV)*($rssi{$_}{"Vrssi"}-$rssiHist{$_}{"aveV"})))/$rssiHist{$_}{"num"}); + chomp $aveV; + chomp $sdV; + } + + $rssiHist{$_}{"aveH"} = $aveH; + $rssiHist{$_}{"sdH"} = $sdH; + $rssiHist{$_}{"last"} = $now; + if ($rssiHist{$_}{"num"} < 60 ) + { + # keep statistics to 60 sample (minute) moving window + $rssiHist{$_}{"num"} += 1; + } + if ($antnum) + { + $rssiHist{$_}{"aveV"} = $aveV; + $rssiHist{$_}{"sdV"} = $sdV; + } + } + else + { # new neigbor or data too old--restart history + $rssiHist{$_}{"aveH"} = $rssi{$_}{"Hrssi"}; + $rssiHist{$_}{"sdH"} = 0; + $rssiHist{$_}{"num"} = 1; + $rssiHist{$_}{"last"} = $now; + if ($antnum) + { + $rssiHist{$_}{"aveV"} = $rssi{$_}{"Vrssi"}; + $rssiHist{$_}{"sdV"} = 0; + } + } +} + +if ($amac or not $neighborCount) +{ + $chnum = `uci get wireless.radio0.channel`; + $chnum += 1; + if ($chnum == 8 or $chnum == 12 or $chnum == 100 or $chnum == 185) { $chnum -= 2; } + if ($chnum == 0) { $chnum = 1; } + $freq = `iw list | grep "\\\[$chnum\\\]" | head -1`; + $freq =~ /([\d]+)[ \t]+MHz[ \t]+/; + $freq = $1; + + if ($amac) + { + $datestring = localtime(); + if ($antnum) {print $lfh "$datestring: before $amac [ $rssi{$amac}{'Hrssi'}, $rssi{$amac}{'Vrssi'} ]\n";} + else {print $lfh "$datestring: before $amac [ $rssi{$amac}{'Hrssi'}]\n";} + } + + system("/usr/sbin/iw $iface scan freq $freq passive > /dev/null"); + + if ($amac) + { + sleep 5; + + $beforeH = $rssi{$amac}{"Hrssi"}; + if ($antnum) { $beforeV = $rssi{$amac}{"Vrssi"}; } + + getRSSI() ; + $datestring = localtime(); + if ($antnum) {print $lfh "$datestring: after $amac [ $rssi{$amac}{'Hrssi'}, $rssi{$amac}{'Vrssi'} ]\n";} + else {print $lfh "$datestring: after $amac [ $rssi{$amac}{'Hrssi'}]\n";} + + $falpos = 0; + if ($antnum) + { + if (abs ( $beforeH - $rssi{$amac}{"Hrssi"} ) <= 2 and + abs ( $beforeV - $rssi{$amac}{"Vrssi"} ) <= 2 ) { $falpos = 1; } + } + elsif (abs ( $beforeH - $rssi{$amac}{"Hrssi"} ) <= 2 ) { $falpos = 1; } + + if ( $falpos ) + { + # if a false-positive (within 2dB change after a reset), then add data point to statistics + $aveH = (($rssiHist{$amac}{"aveH"}*$rssiHist{$amac}{"num"})+ $beforeH ) + / ($rssiHist{$amac}{"num"} + 1 ); + $sdH = sqrt((($rssiHist{$amac}{"num"}-1)*($rssiHist{$amac}{"sdH"}**2) + + (($beforeH-$aveH)*($beforeH-$rssiHist{$amac}{"aveH"}))) + /$rssiHist{$amac}{"num"}); + chomp $aveH; + chomp $sdH; + $rssiHist{$amac}{"aveH"} = $aveH; + $rssiHist{$amac}{"sdH"} = $sdH; + + if ($antnum) + { + $aveV = (($rssiHist{$amac}{"aveV"}*$rssiHist{$amac}{"num"})+ $beforeV ) / + ($rssiHist{$amac}{"num"} + 1 ); + $sdV = sqrt((($rssiHist{$amac}{"num"}-1)*($rssiHist{$amac}{"sdV"}**2) + + (($beforeV-$aveV)*($beforeV-$rssiHist{$amac}{"aveV"}))) / + $rssiHist{$amac}{"num"}); + chomp $aveV; + chomp $sdV; + $rssiHist{$amac}{"aveV"} = $aveV; + $rssiHist{$amac}{"sdV"} = $sdV; + } + + if ($rssiHist{$amac}{"num"} < 60 ) + { + # keep statistics to 60 sample (minute) moving window + $rssiHist{$amac}{"num"} += 1; + } + $rssiHist{$amac}{"last"} = $now + 5 ; + + $datestring = localtime(); + print $lfh "$datestring: $amac Possible valid data point, adding to statistics.\n"; + } + } +} + +close $lfh; + +open($dfh, ">$datfile") or die "Unable to create \"$datfile\" $!"; +for (keys %rssiHist) +{ + if ($antnum) + { + print $dfh "$_|$rssiHist{$_}{'aveH'}|$rssiHist{$_}{'aveV'}|$rssiHist{$_}{'sdH'}|"; + print $dfh "$rssiHist{$_}{'sdV'}|$rssiHist{$_}{'num'}|$rssiHist{$_}{'last'}\n"; + } + else + { + print $dfh "$_|$rssiHist{$_}{'aveH'}|$rssiHist{$_}{'sdH'}|$rssiHist{$_}{'num'}|$rssiHist{$_}{'last'}\n"; + } +} + +close $dfh; + +# when logfile gets 1k over $MAXSIZE, then chop down +$MAXSIZE = 2**14; +exit 0 unless -s $logfile > $MAXSIZE + 1024; +@ARGV = $logfile; +undef $/; +$^I = ""; +while (<>) +{ + substr($_, 0, $MAXSIZE - length) = ""; + s/.*\n//; + print; +} From 79bf05f7d90d045d7105746ecf70772c32f26668 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Mon, 2 Nov 2015 22:15:22 -0800 Subject: [PATCH 39/41] bugfix: rssi_monitor log file size trim calculation error --- files/usr/local/bin/rssi_monitor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/usr/local/bin/rssi_monitor b/files/usr/local/bin/rssi_monitor index c09d180c..d39f4d62 100755 --- a/files/usr/local/bin/rssi_monitor +++ b/files/usr/local/bin/rssi_monitor @@ -293,7 +293,7 @@ undef $/; $^I = ""; while (<>) { - substr($_, 0, $MAXSIZE - length) = ""; + substr($_, 0, length() - $MAXSIZE) = ""; s/.*\n//; print; } From 5b945229fa57ee58ef85659e82ac375b67ae5db3 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Tue, 3 Nov 2015 20:32:36 -0800 Subject: [PATCH 40/41] bugfix: add rssi_monitor data and logfiles to download support data --- files/www/cgi-bin/supporttool | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/www/cgi-bin/supporttool b/files/www/cgi-bin/supporttool index 6d94f97f..8e652302 100755 --- a/files/www/cgi-bin/supporttool +++ b/files/www/cgi-bin/supporttool @@ -48,6 +48,8 @@ use perlfunc; "/etc/mesh-release", "/tmp/etc/", "/var/run/hosts_olsr", + "/tmp/rssi.dat", + "/tmp/rssi.log", ); @sensitive = ( "/etc/config/vtun", From 854a536629bfb6c6b4110e5e10384d74a89f201d Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Sun, 15 Nov 2015 10:59:17 -0800 Subject: [PATCH 41/41] bugfix: Settings set to 0(off/disabled) are not copied over during OTA. Some settings would not copy correctly and would fall back to the config default due to faulty if checks logic when the value was set to 0 ending up in if(0) checks. --- files/usr/local/bin/bbhn-postupgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/usr/local/bin/bbhn-postupgrade b/files/usr/local/bin/bbhn-postupgrade index 6137bc3a..342b5cdf 100755 --- a/files/usr/local/bin/bbhn-postupgrade +++ b/files/usr/local/bin/bbhn-postupgrade @@ -48,7 +48,7 @@ foreach $config ("ap","client","mesh","mesh_ap","router") foreach $variable( sort keys %defaultcfg ) { - if ( $cfg{$variable} ) + if ( defined $cfg{$variable} ) { print TMPCONFFILE "$variable = $cfg{$variable}\n"; } @@ -61,7 +61,7 @@ foreach $config ("ap","client","mesh","mesh_ap","router") # Specific settings for variables that are not in the default config but are added by the system foreach $variable( 'dmz_dhcp_end', 'dmz_dhcp_limit', 'dmz_dhcp_start', 'dmz_lan_ip', 'dmz_lan_mask', 'wifi_rxant', 'wifi_txant' ) { - if ( $cfg{$variable} ) + if ( defined $cfg{$variable} ) { print TMPCONFFILE "$variable = $cfg{$variable}\n"; }