mirror of https://github.com/aredn/aredn.git
merged from develop
This commit is contained in:
commit
e6d08f5606
|
@ -25,3 +25,4 @@ config interface wan
|
|||
option netmask <wan_mask>
|
||||
option gateway <wan_gw>
|
||||
|
||||
include /etc/aredn_include/swconfig
|
||||
|
|
|
@ -15,3 +15,4 @@ config button
|
|||
option min '12'
|
||||
option max '20'
|
||||
|
||||
include /etc/aredn_include/system_netled
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option phy phy0
|
||||
option channel <wifi_channel>
|
||||
option chanbw <wifi_chanbw>
|
||||
option distance <wifi_distance>
|
||||
include /etc/aredn_include/radio0path
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
|
|
|
@ -19,3 +19,5 @@ config interface lan
|
|||
config interface wan
|
||||
option ifname "<wifi_intf>"
|
||||
option proto <wifi_proto>
|
||||
|
||||
include /etc/aredn_include/swconfig
|
||||
|
|
|
@ -15,3 +15,4 @@ config button
|
|||
option min '12'
|
||||
option max '20'
|
||||
|
||||
include /etc/aredn_include/system_netled
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option phy phy0
|
||||
option distance <wifi_distance>
|
||||
include /etc/aredn_include/radio0path
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
|
|
|
@ -41,3 +41,5 @@ config interface dtdlink
|
|||
|
||||
config interface wifi_mon
|
||||
option proto none
|
||||
|
||||
include /etc/aredn_include/swconfig
|
||||
|
|
|
@ -15,3 +15,4 @@ config button
|
|||
option min '12'
|
||||
option max '20'
|
||||
|
||||
include /etc/aredn_include/system_netled
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option phy phy0
|
||||
option channel <wifi_channel>
|
||||
option chanbw <wifi_chanbw>
|
||||
option distance <wifi_distance>
|
||||
option country <wifi_country>
|
||||
include /etc/aredn_include/radio0path
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
|
|
|
@ -21,3 +21,5 @@ config interface lan
|
|||
config interface wan
|
||||
option ifname "<wan_intf>"
|
||||
option proto <wan_proto>
|
||||
|
||||
include /etc/aredn_include/swconfig
|
||||
|
|
|
@ -15,3 +15,4 @@ config button
|
|||
option min '12'
|
||||
option max '20'
|
||||
|
||||
include /etc/aredn_include/system_netled
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option phy phy0
|
||||
option channel <wifi_channel>
|
||||
option chanbw <wifi_chanbw>
|
||||
option distance <wifi_distance>
|
||||
include /etc/aredn_include/radio0path
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
|
|
|
@ -25,3 +25,4 @@ config interface wan
|
|||
option netmask <wan_mask>
|
||||
option gateway <wan_gw>
|
||||
|
||||
include /etc/aredn_include/swconfig
|
||||
|
|
|
@ -15,3 +15,4 @@ config button
|
|||
option min '12'
|
||||
option max '20'
|
||||
|
||||
include /etc/aredn_include/system_netled
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option phy phy0
|
||||
option channel <wifi_channel>
|
||||
option chanbw <wifi_chanbw>
|
||||
option disabled 1
|
||||
include /etc/aredn_include/radio0path
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
} &
|
||||
|
|
|
@ -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(<FILE>)
|
||||
{
|
||||
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(<FILE>)
|
||||
{
|
||||
next unless /\w\w:\w\w:\w\w:(\w\w):(\w\w):(\w\w)/;
|
||||
|
|
|
@ -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 = <FILE>)
|
||||
{
|
||||
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 = <FILE>)
|
||||
{
|
||||
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 "<table border=1 cellpadding=5>\n";
|
||||
print "<tr><th>Sig</th><th>Chan</th><th>Enc</th><th>SSID</th><th>MAC</th><th>Vendor</th></tr>\n";
|
||||
print "<tr><th>Sig</th><th>Chan</th><th>Enc</th><th>SSID or Hostname</th><th>MAC</th><th>Mode</th></tr>\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 "<tr>";
|
||||
if ( $line =~ /AREDN/) { print "<tr class=\"wscan-row-node\">"}
|
||||
else { print "<tr>"}
|
||||
|
||||
my $i = 0;
|
||||
foreach $val (split /\|/, $line)
|
||||
{
|
||||
|
|
|
@ -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}
|
|
@ -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; }
|
|
@ -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 "<meta http-equiv='refresh' content='150;URL=http://$node.local.mesh:8080'>";
|
||||
print "</head>\n";
|
||||
print "<body><center>\n";
|
||||
print "<h2>The firmware is being updated.</h2>\n";
|
||||
print "<h1>DO NOT REMOVE POWER UNTIL UPDATE IS FINISHED</h1>\n";
|
||||
|
@ -234,7 +236,8 @@ DHCP lease and reset any name service caches you may be using.</h3>
|
|||
<h3>The node will reboot twice while the configuration is applied<br>
|
||||
Wait for the Status 4 LED to start blinking, then stop blinking twice.<br>
|
||||
When the Status 4 LED is solid on you can get your new DHCP lease and reconnect with<br>
|
||||
<a href='http://localnode.local.mesh:8080/'>http://localnode.local.mesh:8080/</a></h3>
|
||||
<a href='http://$node.local.mesh:8080/'>http://$node.local.mesh:8080/</a><br>
|
||||
(This page will automatically reload in 150 seconds)</h3>
|
||||
</center></body></html>
|
||||
";
|
||||
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.</h3>
|
||||
<h3>Wait for the Status 4 LED to start blinking, then stop blinking.<br>
|
||||
When the Status 4 LED is solid on you can get your new DHCP lease and reconnect with<br>
|
||||
<a href='http://localnode.local.mesh:8080/'>http://localnode.local.mesh:8080/</a></h3>
|
||||
<a href='http://localnode.local.mesh:8080/'>http://localnode.local.mesh:8080/</a><br>
|
||||
(This page will automatically reload in 150 seconds)</h3>
|
||||
</center>
|
||||
";
|
||||
page_footer();
|
||||
|
|
|
@ -61,7 +61,10 @@ sub html_header
|
|||
print "<meta http-equiv='expires' content='0'>\n";
|
||||
print "<meta http-equiv='cache-control' content='no-cache'>\n";
|
||||
print "<meta http-equiv='pragma' content='no-cache'>\n";
|
||||
print "<link rel=StyleSheet href='/", (-f "/tmp/.night") ? "night" : "day", ".css' type='text/css'>\n";
|
||||
# Prevent browser caching of the css file
|
||||
my $rnum=`date +%s`;
|
||||
chomp($rnum);
|
||||
print "<link id='stylesheet_css' rel=StyleSheet href='/style.css?", $rnum, "' type='text/css'>\n";
|
||||
print "</head>\n" if $close;
|
||||
}
|
||||
|
||||
|
@ -79,9 +82,9 @@ sub navbar
|
|||
vpnc => "Tunnel<br>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 "<hr><table cellpadding=5 border=0 width=100%><tr>\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 "</table></center></body></html>\n";
|
||||
exit;
|
||||
}
|
||||
sub css_options
|
||||
{
|
||||
print "<option value=\"style.css\">Select a theme</option>";
|
||||
my @cssfiles = `ls /www/*.css`;
|
||||
foreach $css (@cssfiles)
|
||||
{
|
||||
chomp($css);
|
||||
$css =~ m#^(.*?)([^/]*)(\.css)$#;
|
||||
($dir,$file) = ($1,$2);
|
||||
print "<option value=\"$file.css\">$file</option>" unless $file eq "style";
|
||||
}
|
||||
}
|
||||
|
||||
#weird uhttpd/busybox error requires a 1 at the end of this file
|
||||
1
|
||||
|
|
|
@ -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 "<body><form method=post action=/cgi-bin/status enctype='multipart/form-data'>\n";
|
||||
print "<body><form method='post' action='/cgi-bin/status' enctype='multipart/form-data'>\n";
|
||||
print "<center>\n";
|
||||
|
||||
alert_banner();
|
||||
|
@ -100,10 +100,11 @@ print " ";
|
|||
print "<button type=button onClick='window.location=\"setup\"' title='Configure this node'>Setup</button>\n";
|
||||
|
||||
print " ";
|
||||
print "<input type=checkbox name=night value=night onClick='form.submit()' ";
|
||||
if($parms{night}) { print "title='Switch to bright colors' checked" }
|
||||
else { print "title='Switch to dark colors'" }
|
||||
print ">Night Mode</nobr>\n";
|
||||
|
||||
print "<select name=\"css\" size=\"1\" onChange=\"form.submit()\" >";
|
||||
css_options();
|
||||
print "</select>";
|
||||
|
||||
print "<input type=hidden name=reload value=reload>\n";
|
||||
|
||||
|
||||
|
|
|
@ -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.<br><br></li>
|
||||
|
||||
<li><strong>Night Mode</strong> 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
|
||||
<li><strong>Select Theme</strong> 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.</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -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; }
|
|
@ -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; }
|
|
@ -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; }
|
|
@ -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; }
|
Loading…
Reference in New Issue