diff --git a/files/etc/config.ap/network b/files/etc/config.ap/network index d4b1d333..47a08581 100644 --- a/files/etc/config.ap/network +++ b/files/etc/config.ap/network @@ -25,3 +25,4 @@ config interface wan option netmask option gateway +include /etc/aredn_include/swconfig diff --git a/files/etc/config.ap/system b/files/etc/config.ap/system index 1913afb5..0127dd7f 100644 --- a/files/etc/config.ap/system +++ b/files/etc/config.ap/system @@ -15,3 +15,4 @@ config button option min '12' option max '20' +include /etc/aredn_include/system_netled diff --git a/files/etc/config.ap/wireless b/files/etc/config.ap/wireless index ae29939f..8a2e9c95 100644 --- a/files/etc/config.ap/wireless +++ b/files/etc/config.ap/wireless @@ -1,9 +1,9 @@ config wifi-device radio0 option type mac80211 - option phy phy0 option channel option chanbw option distance +include /etc/aredn_include/radio0path config wifi-iface option device radio0 diff --git a/files/etc/config.client/network b/files/etc/config.client/network index 8d7b4a09..b419368c 100644 --- a/files/etc/config.client/network +++ b/files/etc/config.client/network @@ -19,3 +19,5 @@ config interface lan config interface wan option ifname "" option proto + +include /etc/aredn_include/swconfig diff --git a/files/etc/config.client/system b/files/etc/config.client/system index 1913afb5..0127dd7f 100644 --- a/files/etc/config.client/system +++ b/files/etc/config.client/system @@ -15,3 +15,4 @@ config button option min '12' option max '20' +include /etc/aredn_include/system_netled diff --git a/files/etc/config.client/wireless b/files/etc/config.client/wireless index 6219d6c5..7c783c00 100644 --- a/files/etc/config.client/wireless +++ b/files/etc/config.client/wireless @@ -1,7 +1,7 @@ config wifi-device radio0 option type mac80211 - option phy phy0 option distance +include /etc/aredn_include/radio0path config wifi-iface option device radio0 diff --git a/files/etc/config.mesh/network b/files/etc/config.mesh/network index 5767110a..9854d6a5 100644 --- a/files/etc/config.mesh/network +++ b/files/etc/config.mesh/network @@ -41,3 +41,5 @@ config interface dtdlink config interface wifi_mon option proto none + +include /etc/aredn_include/swconfig diff --git a/files/etc/config.mesh/system b/files/etc/config.mesh/system index 1913afb5..0127dd7f 100644 --- a/files/etc/config.mesh/system +++ b/files/etc/config.mesh/system @@ -15,3 +15,4 @@ config button option min '12' option max '20' +include /etc/aredn_include/system_netled diff --git a/files/etc/config.mesh/wireless b/files/etc/config.mesh/wireless index 912a073e..61de2eb9 100644 --- a/files/etc/config.mesh/wireless +++ b/files/etc/config.mesh/wireless @@ -1,10 +1,10 @@ config wifi-device radio0 option type mac80211 - option phy phy0 option channel option chanbw option distance option country +include /etc/aredn_include/radio0path config wifi-iface option device radio0 diff --git a/files/etc/config.mesh_ap/network b/files/etc/config.mesh_ap/network index dc15b270..49001fd9 100644 --- a/files/etc/config.mesh_ap/network +++ b/files/etc/config.mesh_ap/network @@ -21,3 +21,5 @@ config interface lan config interface wan option ifname "" option proto + +include /etc/aredn_include/swconfig diff --git a/files/etc/config.mesh_ap/system b/files/etc/config.mesh_ap/system index 1913afb5..0127dd7f 100644 --- a/files/etc/config.mesh_ap/system +++ b/files/etc/config.mesh_ap/system @@ -15,3 +15,4 @@ config button option min '12' option max '20' +include /etc/aredn_include/system_netled diff --git a/files/etc/config.mesh_ap/wireless b/files/etc/config.mesh_ap/wireless index ae29939f..8a2e9c95 100644 --- a/files/etc/config.mesh_ap/wireless +++ b/files/etc/config.mesh_ap/wireless @@ -1,9 +1,9 @@ config wifi-device radio0 option type mac80211 - option phy phy0 option channel option chanbw option distance +include /etc/aredn_include/radio0path config wifi-iface option device radio0 diff --git a/files/etc/config.router/network b/files/etc/config.router/network index 84dfa2e4..d5d3933d 100644 --- a/files/etc/config.router/network +++ b/files/etc/config.router/network @@ -25,3 +25,4 @@ config interface wan option netmask option gateway +include /etc/aredn_include/swconfig diff --git a/files/etc/config.router/system b/files/etc/config.router/system index 1913afb5..0127dd7f 100644 --- a/files/etc/config.router/system +++ b/files/etc/config.router/system @@ -15,3 +15,4 @@ config button option min '12' option max '20' +include /etc/aredn_include/system_netled diff --git a/files/etc/config.router/wireless b/files/etc/config.router/wireless index d64e39f7..470a9072 100644 --- a/files/etc/config.router/wireless +++ b/files/etc/config.router/wireless @@ -1,9 +1,9 @@ config wifi-device radio0 option type mac80211 - option phy phy0 option channel option chanbw option disabled 1 +include /etc/aredn_include/radio0path config wifi-iface option device radio0 diff --git a/files/etc/config/wireless b/files/etc/config/wireless deleted file mode 100644 index 128d4516..00000000 --- a/files/etc/config/wireless +++ /dev/null @@ -1,12 +0,0 @@ -config wifi-device radio0 - option type mac80211 - option phy phy0 - option distance 0 - -config wifi-iface - option device radio0 - option network lan - option mode ap - option ssid "MeshNode" - option hidden 0 - option encryption none diff --git a/files/etc/init.d/local b/files/etc/init.d/local index b94bdcc1..5b4ce990 100755 --- a/files/etc/init.d/local +++ b/files/etc/init.d/local @@ -5,11 +5,115 @@ START=99 boot() { [ -x /usr/local/bin/bbhn-postupgrade ] && /usr/local/bin/bbhn-postupgrade - - # extract kamikaze generated vlan config - #CMLARA Not needed on BULLETM's maybe needed on other devices - #[ -f /etc/vlan ] || head -n5 /etc/config/network > /etc/vlan - + + # extract auto-generated first boot switch config settings + # and store them for future use + if [ ! -f /etc/aredn_include/swconfig ] + then + mkdir -p /etc/aredn_include + touch /etc/aredn_include/swconfig + i=0 + while true; do + uci -q get network.\@switch\[$i\] > /dev/null + local status=$? + if [ $status == 1 ] + then + break + fi + echo "config switch" >> /etc/aredn_include/swconfig + echo " option name '`uci -q get network.\@switch\[$i\].name`'" >> /etc/aredn_include/swconfig + echo " option reset '`uci -q get network.\@switch\[$i\].reset`'" >> /etc/aredn_include/swconfig + echo " option enable_vlan '`uci -q get network.\@switch\[$i\].enable_vlan`'" >> /etc/aredn_include/swconfig + echo "" >> /etc/aredn_include/swconfig + let i++ + done + + i=0 + while true; do + uci -q get network.\@switch_vlan\[$i\] > /dev/null + local status=$? + if [ $status == 1 ] + then + break + fi + echo "config switch_vlan" >> /etc/aredn_include/swconfig + echo " option device '`uci -q get network.\@switch_vlan\[$i\].device`'" >> /etc/aredn_include/swconfig + echo " option vlan '`uci -q get network.\@switch_vlan\[$i\].vlan`'" >> /etc/aredn_include/swconfig + echo " option ports '`uci -q get network.\@switch_vlan\[$i\].ports`'" >> /etc/aredn_include/swconfig + echo "" >> /etc/aredn_include/swconfig + let i++ + done + + i=0 + while true; do + uci -q get network.\@switch_port\[$i\] > /dev/null + local status=$? + if [ $status == 1 ] + then + break + fi + echo "config switch_port" >> /etc/aredn_include/swconfig + echo " option device '`uci -q get network.\@switch_port\[$i\].device`'" >> /etc/aredn_include/swconfig + echo " option port '`uci -q get network.\@switch_port\[$i\].port`'" >> /etc/aredn_include/swconfig + echo " option pvid '`uci -q get network.\@switch_port\[$i\].pvid`'" >> /etc/aredn_include/swconfig + echo "" >> /etc/aredn_include/swconfig + let i++ + done + + fi + + +# Store the unique information about the card, such as its path, mac, and phy +# so it can be used later. + if [ ! -f /etc/aredn_include/radio0path ] + then + mkdir -p /etc/aredn_include + touch /etc/aredn_include/radio0path + local radio0path=`uci -q get wireless.radio0.path` + local radio0phy=`uci -q get wireless.radio0.phy` + local radio0mac=`uci -q get wireless.radio0.macaddr` + if [ "$radio0path" != "" ] + then + echo " option path '$radio0path'" >> /etc/aredn_include/radio0path + fi + if [ "$radio0phy" != "" ] + then + echo " option phy '$radio0phy'" >> /etc/aredn_include/radio0path + fi + if [ "$radio0mac" != "" ] + then + echo " option macaddr '$radio0mac'" >> /etc/aredn_include/radio0path + fi + + fi + + + # Save system NET LED settings + if [ ! -f /etc/aredn_include/system_netled] + then + mkdir -p /etc/aredn_include + touch /etc/aredn_include/system_netled + i=0 + while true; do + uci -q get system.led_lan$i > /dev/null + local status=$? + if [ $status == 1 ] + then + break + fi + echo "config led 'led_lan$i'" >> /etc/aredn_include/system_netled + echo " option name '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled + echo " option sysfs '`uci -q get system.led_lan$i.sysfs`'" >> /etc/aredn_include/system_netled + echo " option trigger '`uci -q get system.led_lan$i.trigger`'" >> /etc/aredn_include/system_netled + echo " option port_mask '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled + echo "" >> /etc/aredn_include/system_netled + let i++ + done + + fi + + + # setup nvram variables [ -x /usr/local/bin/nvram-setup ] && /usr/local/bin/nvram-setup diff --git a/files/usr/local/bin/get_model b/files/usr/local/bin/get_model index 6e8cc220..4451ce0d 100755 --- a/files/usr/local/bin/get_model +++ b/files/usr/local/bin/get_model @@ -1,7 +1,11 @@ #!/bin/sh #CMLARA: Temporary shell script for ar71xx platform models -# Just resport what is on the /proc/cpuinfo field --- this will work for most ar71xx devices -# This doesn't work for linksys however since they have multiple devices -#Eventually we will want to to clean this up to a diffrent method +# Return the model of the device -echo `awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo`; +if [ ! -f /tmp/sysinfo/model ]; then + . /lib/functions.sh + . /lib/ar71xx.sh + ar71xx_board_detect +fi + +cat /tmp/sysinfo/model diff --git a/files/usr/local/bin/linkled b/files/usr/local/bin/linkled index 127c0db1..016c4fc0 100755 --- a/files/usr/local/bin/linkled +++ b/files/usr/local/bin/linkled @@ -18,13 +18,15 @@ LICENSE +LINK1LED=`readlink -f /sys/class/leds/*link1` + { while true; do sleep 5; if echo /neighbors | nc 127.0.0.1 2006 2>/dev/null | grep -q YES; then - echo 1 > /sys/class/leds/ubnt:red:link1/brightness + echo 1 > $LINK1LED/brightness else - echo 0 > /sys/class/leds/ubnt:red:link1/brightness + echo 0 > $LINK1LED//brightness fi done; } & diff --git a/files/usr/local/bin/nvram-setup b/files/usr/local/bin/nvram-setup index 88fe6617..17a43d09 100755 --- a/files/usr/local/bin/nvram-setup +++ b/files/usr/local/bin/nvram-setup @@ -54,13 +54,17 @@ sub fail $commit = 0; -# Added new wifimac parm, the radio0 wont startup without it, use pci device location -# may need to find a better way to allow for wider hardware support +# Added new wifimac parm, the radio0 wont startup without it, use the path location in wifi config +# Actually it just needs some path to get to the radio. + +# Using radio0.path as it seems to always be set as method to get to the card. +chomp ($wifi_path = `uci -q get wireless.radio0.path`); + chomp ($wifi_mac = `uci -c /etc/local/uci/ -q get hsmmmesh.settings.wifimac`); if($wifi_mac eq "") { - open(FILE, "/sys/devices/pci0000:00/0000:00:00.0/ieee80211/phy0/macaddress") or fail("ERROR: wireless mac not available"); + open(FILE, "/sys/devices/$wifi_path/ieee80211/phy0/macaddress") or fail("ERROR: wireless mac not available"); while() { next unless /(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/; @@ -78,7 +82,7 @@ chomp ($mac2 = `uci -c /etc/local/uci/ -q get hsmmmesh.settings.mac2`); if($mac2 eq "") { - open(FILE, "/sys/devices/pci0000:00/0000:00:00.0/ieee80211/phy0/macaddress") or fail("ERROR: wireless mac not available"); + open(FILE, "/sys/devices/$wifi_path/ieee80211/phy0/macaddress") or fail("ERROR: wireless mac not available"); while() { next unless /\w\w:\w\w:\w\w:(\w\w):(\w\w):(\w\w)/; diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index a58357db..9d6c7c5a 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -1,12 +1,13 @@ #!/usr/bin/perl -w =for commnet - Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks Copyright (C) 2015 Conrad Lara See Contributors file for additional contributors Copyright (c) 2013 David Rivenburg et al. BroadBand-HamNet + 2015-04-01 AE6XE update to display neighbor nodes, replace vendor with mode + 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. @@ -49,170 +50,6 @@ sub usage exit; } - -%vendors = -( - "000D72" => "2Wire", - "001288" => "2Wire", - "001495" => "2Wire", - "00183F" => "2Wire", - "0019E4" => "2Wire", - "001AC4" => "2Wire", - "001B5B" => "2Wire", - "001EC7" => "2Wire", - "001FB3" => "2Wire", - "00217C" => "2Wire", - "0022A4" => "2Wire", - "002351" => "2Wire", - "002456" => "2Wire", - "00253C" => "2Wire", - "002650" => "2Wire", - "00D09E" => "2Wire", - "34EF44" => "2Wire", - "B0E754" => "2Wire", - "001D5A" => "2Wire", - "001CB3" => "Apple", - "001EC2" => "Apple", - "001F5B" => "Apple", - "001FF3" => "Apple", - "0021E9" => "Apple", - "002241" => "Apple", - "002312" => "Apple", - "002332" => "Apple", - "00236C" => "Apple", - "0023DF" => "Apple", - "002436" => "Apple", - "002500" => "Apple", - "00254B" => "Apple", - "0025BC" => "Apple", - "002608" => "Apple", - "00264A" => "Apple", - "0026B0" => "Apple", - "0026BB" => "Apple", - "041E64" => "Apple", - "34159E" => "Apple", - "40D32D" => "Apple", - "58B035" => "Apple", - "60FB42" => "Apple", - "64B9E8" => "Apple", - "7C6D62" => "Apple", - "90840D" => "Apple", - "D49A20" => "Apple", - "F81EDF" => "Apple", - "000393" => "Apple", - "000502" => "Apple", - "000A27" => "Apple", - "000A95" => "Apple", - "000D93" => "Apple", - "001124" => "Apple", - "0016CB" => "Apple", - "0017F2" => "Apple", - "003065" => "Apple", - "0050E4" => "Apple", - "00A040" => "Apple", - "001E52" => "Apple", - "001451" => "Apple", - "0019E3" => "Apple", - "001B63" => "Apple", - "001D4F" => "Apple", - "080007" => "Apple", - "0010FA" => "Apple", - "0030BD" => "Belkin", - "001150" => "Belkin", - "00173F" => "Belkin", - "002275" => "Belkin", - "944452" => "Belkin", - "001CDF" => "Belkin", - "0050BA" => "D-Link", - "000D88" => "D-Link", - "000F3D" => "D-Link", - "001195" => "D-Link", - "001346" => "D-Link", - "0015E9" => "D-Link", - "00179A" => "D-Link", - "00195B" => "D-Link", - "001B11" => "D-Link", - "001CF0" => "D-Link", - "001E58" => "D-Link", - "002191" => "D-Link", - "0022B0" => "D-Link", - "002401" => "D-Link", - "00265A" => "D-Link", - "1CAFF7" => "D-Link", - "1CBDB9" => "D-Link", - "00055D" => "D-Link", - "0080C8" => "D-Link", - "0016F0" => "Dell", - "00188B" => "Dell", - "00065B" => "Dell", - "000874" => "Dell", - "00B0D0" => "Dell", - "00C04F" => "Dell", - "000BDB" => "Dell", - "00123F" => "Dell", - "0015C5" => "Dell", - "001AA0" => "Dell", - "001C23" => "Dell", - "001D09" => "Dell", - "001EC9" => "Dell", - "002170" => "Dell", - "00219B" => "Dell", - "002219" => "Dell", - "0026B9" => "Dell", - "B8AC6F" => "Dell", - "001143" => "Dell", - "001372" => "Dell", - "001422" => "Dell", - "0019B9" => "Dell", - "001E4F" => "Dell", - "0023AE" => "Dell", - "0024E8" => "Dell", - "002564" => "Dell", - "A4BADB" => "Dell", - "00045A" => "Linksys", - "000625" => "Linksys", - "000E08" => "Cisco-Linksys", - "000C41" => "Cisco-Linksys", - "000F66" => "Cisco-Linksys", - "001217" => "Cisco-Linksys", - "001310" => "Cisco-Linksys", - "0016B6" => "Cisco-Linksys", - "001A70" => "Cisco-Linksys", - "001C10" => "Cisco-Linksys", - "001D7E" => "Cisco-Linksys", - "001EE5" => "Cisco-Linksys", - "002129" => "Cisco-Linksys", - "00226B" => "Cisco-Linksys", - "002369" => "Cisco-Linksys", - "00259C" => "Cisco-Linksys", - "687F74" => "Cisco-Linksys", - "0014BF" => "Cisco-Linksys", - "001839" => "Cisco-Linksys", - "0018F8" => "Cisco-Linksys", - "00095B" => "Netgear", - "0024B2" => "Netgear", - "0026F2" => "Netgear", - "30469A" => "Netgear", - "C03F0E" => "Netgear", - "000FB5" => "Netgear", - "00146C" => "Netgear", - "00184D" => "Netgear", - "001B2F" => "Netgear", - "001E2A" => "Netgear", - "001F33" => "Netgear", - "00223F" => "Netgear", - "000E3B" => "Hawking", - "00A0C5" => "Zyxel", - "004001" => "Zyxel", - "001349" => "Zyxel", - "0019CB" => "Zyxel", - "0023F8" => "Zyxel", - "404A03" => "Zyxel", - "002722" => "Ubiquiti", - "00156D" => "Ubiquiti", -); - - sub pushAP { my($signal, $chan, $key, $ssid, $mac, $mode) = @_; @@ -229,27 +66,30 @@ sub pushAP $mac1 = $1 . $2 . $3; $mac2 = $4 . $5 . $6; $mac = $mac1 . $mac2; - if(exists $vendors{$mac1}) { $vendor = $vendors{$mac1} } - else { $vendor = "" } - $vendor = "Ad-Hoc" if $mode eq "Ad-Hoc"; + if ($ssid =~ /AREDN-(5|10|20)-v[3456]$/) {$typenet = "AREDN" } + elsif ($ssid =~ /BroadbandHamnet-(5|10|20)-v[3456]$/) {$typenet = "BroadbandHament" } + elsif ($mode eq "Master") {$typenet = "AP" } + elsif ($mode eq "Managed") {$typenet = "Client"} + elsif ($mode eq "Ad-Hoc" and $ssid =~ /(.*)-(5|10|20)-v[3456]$/ ) {$typenet = $1 } + 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, $vendor; + $chan, $key, $ssid, $mac1, $mac2, $typenet; } elsif($web) { push @list, sprintf "%03d|%d|%s|%s|%s:%s|%s", - $signal, $chan, $key, $ssid, $mac1, $mac2, $vendor; + $signal, $chan, $key, $ssid, $mac1, $mac2, $typenet; } else { push @list, sprintf "%3d %2d %s %-32s %s:%s %s\n", - $signal, $chan, $key, $ssid, $mac1, $mac2, $vendor; + $signal, $chan, $key, $ssid, $mac1, $mac2, $typenet; } } @@ -285,54 +125,101 @@ die "bad interface" if not defined $iface; if($raw) { system("/usr/bin/iwinfo $iface scan"); + system("/usr/sbin/iw $iface station dump"); exit; } 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; + open(FILE, "/usr/bin/iwinfo $iface scan 2>&1 |") or die "iwinfo failed"; $mode = ""; + $ssid = ""; + $signal = 0; + $chan = 99; @list = (); - ++$iters; while($line = ) { - if($line =~ /Cell \d+ - Address: (\S+)/) + if($line =~ /Cell \d+ - Address: (\S+)/ ) { - pushAP($signal, $chan, $key, $ssid, $mac, $mode); + if ($ssid ne $myssid) { pushAP($signal, $chan, $key, $ssid, $mac, $mode)} $mac = $1; - $mode = ""; } 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 =~ /\bSignal: ([\d-]+)/) { $signal = $1 } + if($line =~ /\bEncryption: (\w+)/) { $key = $1 } } close(FILE); - pushAP($signal, $chan, $key, $ssid, $mac, $mode); + + if ($ssid ne $myssid) {pushAP($signal, $chan, $key, $ssid, $mac, $mode)} sleep 1 if not scalar @list and $loops != 1; + + $mode = ""; + $signal = 0; + $key = "none"; + ++$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"; + + while($line = ) + { + if($line =~ /Station (\S+) \(on $iface\)/) + { + pushAP($signal, $bbchan, $key, $ssid, $mac, $mode); + $mac = $1; + $ip = `grep $mac /proc/net/arp`; + $mac = uc $mac; + if ( $ip ne "" ) + { + $ip =~ s/[ \t].*$// ; + chomp($ip); + $ssid = $ip; + if( $ip ne "") + { + foreach(`nslookup $ip`){ next unless ($ssid) = /Address 1: $ip (\S+)\.local\.mesh/ } + if ( $ssid eq "" ) { $ssid = $ip } + } + } + else { $ssid = "????" } + $mode=$mymode; + } + + if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } + } + + close(FILE); + pushAP($signal, $bbchan, $key, $ssid, $mac, $mode); + sleep 1 if not scalar @list and $loops != 1; + if(not $batch) { if($avg) { system "clear"; - printf "Sig Rel Ch E SSID MAC Vendor %6d\n", $iters; + printf "Sig Rel Ch E SSID or Hostname MAC Mode %6d\n", $iters; print "--- --- -- - -------------------------------- ------------- ------\n"; } elsif($web) { print "\n"; - print "\n"; + print "\n"; } else { - system "clear"; - printf "Sig Ch E SSID MAC Vendor %6d\n", $iters; + #system "clear"; + printf "Sig Ch E SSID or Hostname MAC Mode %6d\n", $iters; print "--- -- - -------------------------------- ------------- ------\n"; } } @@ -354,7 +241,9 @@ while(1) { foreach $line (sort @list) { - print ""; + if ( $line =~ /AREDN/) { print ""} + else { print ""} + my $i = 0; foreach $val (split /\|/, $line) { diff --git a/files/www/day.css b/files/www/aredn.css similarity index 91% rename from files/www/day.css rename to files/www/aredn.css index cc3df1cc..2b30bc9f 100644 --- a/files/www/day.css +++ b/files/www/aredn.css @@ -26,3 +26,6 @@ body table { .LogoDiv { position:absolute left:0px; width:100%; height:95; } .AREDNLogo { background:rgb(231,231,231); position:absolute; left:10%; width:175; height:95; } .PartOfAREDN { font-family:Verdana; font-size:xx-small; text-align:center; } + +/* Used to indicate NODES in the WSCAN output */ +.wscan-row-node { background-color: lightseagreen} \ No newline at end of file diff --git a/files/www/black_on_white.css b/files/www/black_on_white.css new file mode 100644 index 00000000..c7dd5f06 --- /dev/null +++ b/files/www/black_on_white.css @@ -0,0 +1,28 @@ +body { font-family:Verdana; background: white; color:black } +a:link { background: white; color: black } +a:visited { background: white; color: black } +a:active { background: white; color: black } +h1 { font-family:Verdana; color: black} + +hr { + width: 100%; + height: 2px; + margin-left: auto; + margin-right: auto; + color: black; + background-color: white; +} + +body table { + font-size: 16px; + +} +.navbar_select { background:white; color:black } +.navbar_select a:link { background:white; color:black } +.navbar_select a:visited { background:white; color:black } +.navbar_select a:active { background:white; color:black } + +.TopBanner { width:100%; } +.LogoDiv { position:absolute left:0px; width:100%; height:95; } +.AREDNLogo { background: white; position:absolute; left:10%; width:175; height:95; } +.PartOfAREDN { font-family:Verdana; font-size:xx-small; text-align:center; } diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index f672f363..96b10ece 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -217,7 +217,9 @@ if($fw_install and -f "$tmpdir/firmware") { my $junk; http_header(); - html_header("FIRMWARE UPDATE IN PROGRESS", 1); + html_header("FIRMWARE UPDATE IN PROGRESS", 0); + print ""; + print "\n"; print "
\n"; print "

The firmware is being updated.

\n"; print "

DO NOT REMOVE POWER UNTIL UPDATE IS FINISHED

\n"; @@ -234,7 +236,8 @@ DHCP lease and reset any name service caches you may be using.

The node will reboot twice while the configuration is applied
Wait for the Status 4 LED to start blinking, then stop blinking twice.
When the Status 4 LED is solid on you can get your new DHCP lease and reconnect with
-http://localnode.local.mesh:8080/

+http://$node.local.mesh:8080/
+(This page will automatically reload in 150 seconds)
"; open(FILE, "/sbin/sysupgrade -q $tmpdir/firmware 2>&1 |") or die; @@ -250,7 +253,8 @@ When the Status 4 LED is solid on you can get your new DHCP lease and reconnect DHCP lease and reset any name service caches you may be using.

Wait for the Status 4 LED to start blinking, then stop blinking.
When the Status 4 LED is solid on you can get your new DHCP lease and reconnect with
-http://localnode.local.mesh:8080/

+http://localnode.local.mesh:8080/
+(This page will automatically reload in 150 seconds) "; page_footer(); diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index bc405a99..39a4c173 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -61,7 +61,10 @@ sub html_header print "\n"; print "\n"; print "\n"; - print "\n"; + # Prevent browser caching of the css file + my $rnum=`date +%s`; + chomp($rnum); + print "\n"; print "\n" if $close; } @@ -79,9 +82,9 @@ sub navbar vpnc => "Tunnel
Client", admin => "Administration"); - my($active_bg, $active_fg); - if(-f "/tmp/.night") { $active_bg = "red"; $active_fg = "black" } - else { $active_bg = "black"; $active_fg = "white" } + #my($active_bg, $active_fg); + #if(-f "/tmp/.night") { $active_bg = "red"; $active_fg = "black" } + #else { $active_bg = "black"; $active_fg = "white" } print "
SigChanEncSSIDMACVendor
SigChanEncSSID or HostnameMACMode
\n"; @@ -906,8 +909,16 @@ sub validate_longitude # Get boardid sub hardware_boardid { - my $boardid = `cat /sys/devices/pci0000:00/0000:00:00.0/subsystem_device`; - chomp($boardid); + my $boarid=""; + # Ubiquiti hardware + if ( -f '/sys/devices/pci0000:00/0000:00:00.0/subsystem_device' ) { + $boardid = `cat /sys/devices/pci0000:00/0000:00:00.0/subsystem_device`; + chomp($boardid); + } else { + # Can't use the subsystem_device so instead use the model + $boardid = `/usr/local/bin/get_model`; + chomp($boardid); + } return $boardid; } @@ -916,6 +927,17 @@ sub hardware_boardid sub hardware_info { %model = ( + 'TP-Link CPE510 v1.0' => { + 'name' => 'TP-Link CPE510 v1.0', + 'comment' => '', + 'supported' => '-2', + 'maxpower' => '27', + 'pwroffset' => '0', + 'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" }, + 'defaultant' => 3, + 'usechains' => 1, + 'rfband' => '5800ubntus', + }, '0xc2a2' => { 'name' => 'Bullet 2 HP', 'comment' => 'Not enough Ram or flash', @@ -1384,6 +1406,18 @@ sub reboot_required() print "
\n"; exit; } +sub css_options +{ + print ""; + my @cssfiles = `ls /www/*.css`; + foreach $css (@cssfiles) + { + chomp($css); + $css =~ m#^(.*?)([^/]*)(\.css)$#; + ($dir,$file) = ($1,$2); + print "" unless $file eq "style"; + } +} #weird uhttpd/busybox error requires a 1 at the end of this file 1 diff --git a/files/www/cgi-bin/status b/files/www/cgi-bin/status index 86b344e4..753f3ef7 100755 --- a/files/www/cgi-bin/status +++ b/files/www/cgi-bin/status @@ -48,19 +48,19 @@ $config = "not set" if $config eq "" or not -d "/etc/config.$config"; read_postdata(); -# set up the day/night style sheet -system "mkdir -p /tmp/web; cp -f /www/day.css /tmp/web/style.css" unless -f "/tmp/web/style.css"; +# set up the style sheet +mkdir "/tmp/web" unless -d "/tmp/web"; # make sure /tmp/web exists +symlink "/www/aredn.css","/tmp/web/style.css" unless -l "/tmp/web/style.css"; # default to aredn.css -if($parms{night}) { system "touch /tmp/.night; cp -f /www/night.css /tmp/web/style.css" } -elsif(not $parms{reload}) { $parms{night} = 1 if -f "/tmp/.night" } -else { system "rm -f /tmp/.night; cp -f /www/day.css /tmp/web/style.css" } - -#system "rm -rf /tmp/web"; +if($parms{css} and -f "/www/$parms{css}" and $parms{css} =~ /\.css$/i) { + unlink "/tmp/web/style.css"; + symlink "/www/$parms{css}","/tmp/web/style.css"; +} # generate the page http_header(); html_header("AREDN™ Node $node", 1); -print "
\n"; +print "\n"; print "
\n"; alert_banner(); @@ -100,10 +100,11 @@ print "   "; print "\n"; print "   "; -print "Night Mode\n"; + +print ""; + print "\n"; diff --git a/files/www/help.html b/files/www/help.html index 972c8c33..0eb5b0de 100644 --- a/files/www/help.html +++ b/files/www/help.html @@ -85,9 +85,7 @@ the Basic Setup page. If the node has not yet been configured, the password is "hsmm". Note that the password given to log in to the setup pages is encrypted in transit, so this is safe to do over a wireless connection.

-
  • Night Mode switches the normal black on white color -scheme to red on black. Black on white was chosen because it provides the best -screen visibility on a laptop exposed to direct sunlight. Red on black is much +
  • Select Theme switches display themes/styles. Black on white was chosen because it provides the best screen visibility on a laptop exposed to direct sunlight. Red on black is much better suited for night time use as it helps preserve night vision.
  • diff --git a/files/www/night.css b/files/www/night.css deleted file mode 100644 index b4ba6e3c..00000000 --- a/files/www/night.css +++ /dev/null @@ -1,20 +0,0 @@ -body { background:black; color:red } -a:link { background:black; color:gray } -a:visited { background:black; color:gray } -a:active { background:black; color:gray } - -button { background-color:gray; font-weight:bold } -input { background-color:gray; font-weight:bold } -option { background-color:gray; font-weight:bold } -select { background-color:gray; font-weight:bold } - -.navbar_select { background:red; color:black } -.navbar_select a:link { background:red; color:black } -.navbar_select a:visited { background:red; color:black } -.navbar_select a:active { background:red; color:black } - - -.TopBanner { width:100%; } -.LogoDiv { position:absolute left:0px; width:100%; height:95; } -.AREDNLogo { background:rgb(231,231,231); position:absolute; left:10%; width:175; height:95; } -.PartOfAREDN { font-family:Verdana; font-size:xx-small; text-align:center; } diff --git a/files/www/red_on_black.css b/files/www/red_on_black.css new file mode 100644 index 00000000..eddad85f --- /dev/null +++ b/files/www/red_on_black.css @@ -0,0 +1,28 @@ +body { font-family:Verdana; background: black; color:red } +a:link { background: black; color: red } +a:visited { background: black; color: red } +a:active { background: black; color: red } +h1 { font-family:Verdana; color: red} + +hr { + width: 100%; + height: 2px; + margin-left: auto; + margin-right: auto; + color: red; + background-color: black; +} + +body table { + font-size: 16px; + +} +.navbar_select { background:black; color:red } +.navbar_select a:link { background:black; color:red } +.navbar_select a:visited { background:black; color:red } +.navbar_select a:active { background:black; color:red } + +.TopBanner { width:100%; } +.LogoDiv { position:absolute left:0px; width:100%; height:95; } +.AREDNLogo { background: white; position:absolute; left:10%; width:175; height:95; } +.PartOfAREDN { font-family:Verdana; font-size:xx-small; text-align:center; } diff --git a/files/www/white_on_black.css b/files/www/white_on_black.css new file mode 100644 index 00000000..9b0e50c4 --- /dev/null +++ b/files/www/white_on_black.css @@ -0,0 +1,28 @@ +body { font-family:Verdana; background: black; color:white } +a:link { background: black; color: white } +a:visited { background: black; color: white } +a:active { background: black; color: white } +h1 { font-family:Verdana; color: white} + +hr { + width: 100%; + height: 2px; + margin-left: auto; + margin-right: auto; + color: white; + background-color: black; +} + +body table { + font-size: 16px; + +} +.navbar_select { background:black; color:white } +.navbar_select a:link { background:black; color:white } +.navbar_select a:visited { background:black; color:white } +.navbar_select a:active { background:black; color:white } + +.TopBanner { width:100%; } +.LogoDiv { position:absolute left:0px; width:100%; height:95; } +.AREDNLogo { background: white; position:absolute; left:10%; width:175; height:95; } +.PartOfAREDN { font-family:Verdana; font-size:xx-small; text-align:center; } diff --git a/files/www/yellow_on_black.css b/files/www/yellow_on_black.css new file mode 100644 index 00000000..fb797547 --- /dev/null +++ b/files/www/yellow_on_black.css @@ -0,0 +1,28 @@ +body { font-family:Verdana; background: black; color:yellow } +a:link { background: black; color: yellow } +a:visited { background: black; color: yellow } +a:active { background: black; color: yellow } +h1 { font-family:Verdana; color: yellow} + +hr { + width: 100%; + height: 2px; + margin-left: auto; + margin-right: auto; + color: yellow; + background-color: black; +} + +body table { + font-size: 16px; + +} +.navbar_select { background:black; color:yellow } +.navbar_select a:link { background:black; color:yellow } +.navbar_select a:visited { background:black; color:yellow } +.navbar_select a:active { background:black; color:yellow } + +.TopBanner { width:100%; } +.LogoDiv { position:absolute left:0px; width:100%; height:95; } +.AREDNLogo { background: white; position:absolute; left:10%; width:175; height:95; } +.PartOfAREDN { font-family:Verdana; font-size:xx-small; text-align:center; }