Merge branch 'release-1.1.0'

This commit is contained in:
Conrad Lara - KG6JEI 2014-07-07 22:44:09 -07:00
commit 9a7cdf8874
15 changed files with 138 additions and 100 deletions

View File

1
files/etc/crontabs/root Normal file
View File

@ -0,0 +1 @@
*/5 * * * * /usr/local/bin/fccid

View File

@ -51,7 +51,7 @@ is_olsrgw=`cat /etc/config.mesh/_setup|grep -i olsrd_gw|cut -d ' ' -f 3`
echo "Setting routing rules."
if [ "$INTERFACE" == "wifi" ] || [ "$INTERFACE" == "dtdlink" ]; then
if [ -z /etc/config/dmz-mode ] ; then
if [ -e /etc/config/dmz-mode ] ; then
ip rule add pref 20010 iif $DEVICE lookup 29
fi
ip rule add pref 20020 iif $DEVICE lookup 30

View File

@ -1,4 +1,4 @@
src/gz packages http://www.broadband-hamnet.org/download/backfire/10.03.1/ar71xx/packages
src/gz packages http://www.broadband-hamnet.org/download/attitude_adjustment/12.09/ar71xx/generic/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists

View File

@ -1,56 +1,66 @@
base-files
bridge
busybox
crda
dnsmasq
dropbear
firewall
hotplug2
ip
ip6tables
iptables
iptables-mod-conntrack
iptables-mod-nat
iptables-mod-ipopt
iw
iwinfo
jshn
kernel
kmod-ath
kmod-ath9k
kmod-ath9k-common
kmod-button-hotplug
kmod-cfg80211
kmod-crc-ccitt
kmod-crypto-aes
kmod-crypto-arc4
kmod-crypto-core
kmod-input-core
kmod-input-gpio-buttons
kmod-input-polldev
kmod-gpio-button-hotplug
kmod-ip6tables
kmod-ipt-conntrack
kmod-ipt-core
kmod-ipt-ipopt
kmod-ipt-nat
kmod-ipt-nathelper
kmod-ipv6
kmod-leds-gpio
kmod-ledtrig-default-on
kmod-ledtrig-netdev
kmod-ledtrig-timer
kmod-ledtrig-usbdev
kmod-lib-crc-ccitt
kmod-mac80211
kmod-nls-base
kmod-ppp
kmod-pppoe
kmod-pppox
kmod-usb-core
kmod-usb-ohci
kmod-usb-uhci
kmod-usb2
kmod-wdt-ath79
libblobmsg-json
libc
libgcc
libip4tc
libip6tc
libiwinfo
libjson
libnl-tiny
libpcap
libpthread
librt
libubox
libubus
libuci
libxtables
microperl
mtd
netifd
ntpclient
olsrd
olsrd-mod-arprefresh
@ -58,6 +68,7 @@ olsrd-mod-dot-draw
olsrd-mod-dyn-gw
olsrd-mod-httpinfo
olsrd-mod-nameservice
olsrd-mod-secure
olsrd-mod-txtinfo
olsrd-mod-watchdog
opkg
@ -68,11 +79,13 @@ perlbase-perlio
perlbase-xsloader
ppp
ppp-mod-pppoe
ssidident
swconfig
tcpdump-mini
uboot-envtools
ubus
ubusd
uci
udevtrigger
uhttpd
wireless-tools
wpad-mini
xinetd

9
files/usr/local/bin/fccid Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
[ -f /etc/config/run-fccid ] || exit
# stagger the beacons between nodes
N=`ifconfig wlan0 | grep "inet addr" | cut -f4 -d. | cut -c1-3`
sleep $N
echo "ID: `uname -n`" | socat - udp4:10.255.255.255:4919,broadcast,so-bindtodevice=wlan0

View File

@ -227,6 +227,7 @@ print HOSTS "127.0.0.1\tlocalhost\n";
print HOSTS "$cfg{lan_ip}\tlocalnode ";
print HOSTS "\n$cfg{wifi_ip}\t" if $cfg{wifi_ip};
print HOSTS "$node $tactical\n";
print HOSTS "$cfg{dtdlink_ip}\tdtdlink.$node.local.mesh dtdlink.$node" if $cfg{dtdlink_ip};
print HOSTS add_ip_address($cfg{lan_ip}, 1), "\tlocalap\n" unless $cfg{dmz_mode};
open(ETHER, ">/etc/ethers") or die;
@ -384,7 +385,7 @@ unless($cfg{wifi_proto} eq "disabled")
if(wifi_useschains()){
print FILE "/usr/local/bin/wifi-onbootchains\n";
}
print FILE "/usr/sbin/iwconfig wlan0 txpower $cfg{wifi_txpower}\n";
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})
{
printf FILE "echo %s,%s > /tmp/latlon.txt\n", $cfg{aprs_lat}, $cfg{aprs_lon};

View File

@ -25,6 +25,14 @@ if(-f "/etc/config/dmz-mode")
}
}
# Add a name for the dtdlink interface.
if ($name = nvram_get("node"))
{
my ($dtdip,$dtdmask,$dtdbcast,$dtdnet);
($dtdip, $dtdmask, $dtdbcast, $dtdnet) = get_ip4_network("eth0.2");
push @hosts, qq("$dtdip" "dtdlink.$name.local.mesh");
}
# load the services
foreach(`cat /etc/config/services 2>/dev/null`)
{

View File

@ -186,7 +186,7 @@ sub pushAP
if($ssid eq "") { $ssid = "(hidden)" }
if($key eq "off") { $key = " " }
if($key eq "none") { $key = " " }
else { $key = "*" }
$mac =~ /^(\w\w):(\w\w):(\w\w):(\w\w):(\w\w):(\w\w)/;
@ -248,22 +248,22 @@ die "bad interface" if not defined $iface;
if($raw)
{
system("/usr/sbin/iwlist $iface scan");
system("/usr/bin/iwinfo $iface scan");
exit;
}
while(1)
{
open(FILE, "/usr/sbin/iwlist $iface scan 2>&1 |") or die "iwlist failed";
open(FILE, "/usr/bin/iwinfo $iface scan 2>&1 |") or die "iwinfo failed";
$mode = "";
@list = ();
++$iters;
while($line = <FILE>)
{
if($line =~ /\s+Cell \d+ - Address: (\S+)/)
if($line =~ /Cell \d+ - Address: (\S+)/)
{
if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $mac, $mode) }
pushAP($signal, $chan, $key, $ssid, $mac, $mode);
$mac = $1;
$mode = "";
}
@ -271,13 +271,12 @@ while(1)
if($line =~ /\bESSID: "(.*)"/) { $ssid = $1 }
if($line =~ /\bMode: (\S+)/) { $mode = $1 }
if($line =~ /\bChannel: (\d+)/) { $chan = $1 }
if($line =~ /\bSignal level=([\d-]+)/) { $signal = $1 }
if($line =~ /\bEncryption key:(\w+)/) { $key = $1 }
if($line =~ /\bExtra: Last beacon: (\d+)ms/) { $lastseen = $1 }
if($line =~ /\bSignal: ([\d-]+)/) { $signal = $1 }
if($line =~ /\bEncryption: (\w+)/) { $key = $1 }
}
close(FILE);
if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $mac, $mode) }
pushAP($signal, $chan, $key, $ssid, $mac, $mode);
sleep 1 if not scalar @list and $loops != 1;
if(not $batch)

View File

@ -321,7 +321,7 @@ foreach(`cat /etc/permpkg 2>/dev/null`)
if($parms{button_ul_pkg} and -f "/tmp/web/upload/file")
{
system "mv -f /tmp/web/upload/file /tmp/web/upload/newpkg.ipk";
push @pkg_output, `yes | opkg -force-overwrite install /tmp/web/upload/newpkg.ipk 2>&1`;
push @pkg_output, `opkg -force-overwrite install /tmp/web/upload/newpkg.ipk 2>&1`;
system "rm -rf /tmp/opkg-*";
}
@ -330,7 +330,7 @@ if($parms{button_dl_pkg} and $parms{dl_pkg} ne "default")
{
if(get_default_gw() ne "none")
{
push @pkg_output, `yes | opkg -force-overwrite install $parms{dl_pkg} 2>&1`;
push @pkg_output, `opkg -force-overwrite install $parms{dl_pkg} 2>&1`;
}
else
{

View File

@ -99,9 +99,10 @@ sub is_channel_valid
# We don't have the device band in the data file so lets fall back to checking manually
else {
my $channelok=0;
foreach (`iwlist wlan0 channel`)
foreach (`iwinfo wlan0 freqlist`)
{
next unless /Channel $channel/;
next if /\[restricted\]/;
$channelok=1;
}
return $channelok;
@ -125,11 +126,12 @@ sub rf_channels_list
else
{
my %channels = ();
foreach (`iwlist wlan0 channel` )
foreach (`iwinfo wlan0 freqlist` )
{
next unless /([0-9]+) : ([0-9]+.[0-9]+)/;
my $channelnum = $1;
my $channelfreq = $2;
next unless /([0-9]+.[0-9]+) GHz \(Channel ([0-9]+)\)/;
next if /\[restricted\]/;
my $channelnum = $2;
my $channelfreq = $1;
$channelnum =~s/^0+//g;
$channels->{$channelnum} = "$channelfreq GHZ" ;
}

View File

@ -73,7 +73,7 @@ foreach(`cat /etc/hosts`)
next unless /^10[.]/;
chomp;
($ip, $name, $tactical) = split /\s+/, $_;
next if $name =~ /^(localhost|localnode|localap)$/;
next if $name =~ /^(localhost|localnode|localap|dtdlink\..*)$/;
if($ip eq $my_ip)
{
$tactical = "" unless $tactical;
@ -94,10 +94,18 @@ foreach(`cat /var/run/hosts_olsr 2>/dev/null`)
($ip, $name, $junk, $originator, $mid, $midnum) = split /\s+/, $_;
next unless $originator;
next if $originator eq "myself";
if ( $name =~ /^dtdlink\..*$/ )
{
$hosts{$ip}{name} = $name;
next;
}
if(defined $mid and $midnum =~ /^\#(\d+)/)
{
if ( !exists $hosts{$ip}{name} )
{
$hosts{$ip}{name} = $name;
}
$hosts{$ip}{hide} = 1;
$hosts{$originator}{mid} = $1;
}

View File

@ -1,4 +1,4 @@
#############################
##########################
# html functions
# emit the http server response
@ -83,13 +83,13 @@ sub read_query_string
# c-style fgets for read_postdata
$stdinbuffer = "";
sub fgets
{
my($size) = @_;
my $line = "";
while(1)
{
unless(length $stdinbuffer)
@ -118,12 +118,12 @@ sub fgets
# (from STDIN in method=post form)
sub read_postdata
{
if ( $ENV{REQUEST_METHOD} != "POST" || !$ENV{CONTENT_LENGTH}){ return; };
my ($line, $parm, $file, $handle, $tmp);
my $state = "boundary";
my ($boundary) = $ENV{CONTENT_TYPE} =~ /boundary=(\S+)/ if $ENV{CONTENT_TYPE};
my $parsedebug = 0;
push(@parse_errors, "[$boundary]") if $parsedebug;
while(length ($line = fgets(1000)))
{
$line =~ s/[\r\n]+$//; # chomp doesn't strip \r!
@ -546,25 +546,15 @@ sub save_setup
sub get_wifi_signal
{
# CMLARA:
# this would be easy if /proc/net/wireless updated automatically, but it doesn't.
# the hack is to re-scan
# also iwlist doesnt correctly limit to single ssid
# and we have to call from 2 programs now instead of 1
my ($ssid) = (`uci -q get wireless.\@wifi-iface[0].ssid`);
chomp $ssid;
my $wifiintf = `uci -q get network.wifi.ifname`;
chomp $wifiintf;
my ($SignalLevel) = "N/A";
my ($NoiseFloor) = "N/A";
foreach(`iwlist $_[0] scanning essid "$ssid" |tr '\n' ' '|sed 's/Cell \\([0-9]\\{2,\\}\\) - Address:/\\nCell \\1 - Address:/g'|grep -i "$ssid"`)
foreach(`iwinfo $wifiintf info`)
{
next unless /.*Signal level=([\d\-]+) dBm.* Extra: Last beacon: ([\d]+)ms/;
if ( $2 < 10000 ) {$SignalLevel=$1;}
}
foreach(`iw dev $_[0] survey dump|grep -A 1 \"\\[in use\\]\"`)
{
next unless /([\d\-]+) dBm/;
$NoiseFloor=$1;
next unless /.*Signal: ([\d\-]+) dBm.*Noise: ([\d\-]+) dBm/;
$SignalLevel=$1;
$NoiseFloor=$2;
}
if ( $SignalLevel == "N/A" || $NoiseFloor == "N/A" )
@ -592,9 +582,9 @@ sub get_free_mem
{
foreach(`free`)
{
next unless /^\s+Mem[:]/;
next unless /^Mem[:]/;
my @tmp = split /\s+/, $_;
return $tmp[4] + $tmp[6];
return $tmp[3] + $tmp[5];
}
return "N/A";
}
@ -946,8 +936,8 @@ sub hardware_info
},
'0xe1b5' => {
'name' => 'Rocket M5',
'comment' => 'Rocket M5 in testing',
'supported' => '-2',
'comment' => 'Rocket M5',
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '5',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
@ -968,8 +958,8 @@ sub hardware_info
},
'0xe205' => {
'name' => 'Bullet M5',
'comment' => 'Bullet M5 In testing.',
'supported' => '-2',
'comment' => 'Bullet M5',
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '6',
'antennas' => { 1 => 'N Connector' },
@ -979,8 +969,8 @@ sub hardware_info
},
'0xe215' => {
'name' => 'airGrid M5',
'comment' => 'airGrid M5 in testing',
'supported' => '-2',
'comment' => 'airGrid M5',
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '1',
'antennas' => { 1 => 'airGrid' },
@ -990,8 +980,8 @@ sub hardware_info
},
'0xe232' => {
'name' => 'NannoBridge M2',
'comment' => 'NanoBridge M2 in testing',
'supported' => '-2',
'comment' => 'NanoBridge M2',
'supported' => '1',
'maxpower' => '21',
'pwroffset' => '2',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
@ -1001,8 +991,8 @@ sub hardware_info
},
'0xe242' => {
'name' => 'airGrid M2 HP',
'comment' => 'airGrid M2 HP in testing',
'supported' => '-2',
'comment' => 'airGrid M2 HP',
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '9',
'antennas' => { 1 => 'airGrid' },
@ -1013,7 +1003,7 @@ sub hardware_info
'0xe243' => {
'name' => 'NannoBridge M3',
'comment' => 'Not Tested',
'supported' => '-1',
'supported' => '-2',
'maxpower' => '22',
'pwroffset' => '3',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
@ -1034,8 +1024,8 @@ sub hardware_info
},
'0xe255' => {
'name' => 'airGrid M5 HP',
'comment' => 'airGrid M5 HP in testing',
'supported' => '-2',
'comment' => 'airGrid M5',
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '6',
'antennas' => { 1 => 'airGrid' },
@ -1045,8 +1035,8 @@ sub hardware_info
},
'0xe2b5' => {
'name' => 'NannoBridge M5',
'comment' => 'NanoBridge M5 in testing',
'supported' => '-2',
'comment' => 'NanoBridge M5',
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '1',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
@ -1056,8 +1046,8 @@ sub hardware_info
},
'0xe2c2' => {
'name' => 'NannoBeam M2 International',
'comment' => 'NanoBeam M2 International in testing',
'supported' => '-2',
'comment' => 'NanoBeam M2 International -- XW board unsupported at this time',
'supported' => '-1',
'maxpower' => '18',
'pwroffset' => '10',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
@ -1067,8 +1057,8 @@ sub hardware_info
},
'0xe2d2' => {
'name' => 'Bullet M2 Titanium HP',
'comment' => 'Bullet M2 TI in testing',
'supported' => '-2',
'comment' => 'Bullet M2 Titanium',
'supported' => '1',
'maxpower' => '16',
'pwroffset' => '12',
'antennas' => { 1 => 'N Connector' },
@ -1078,8 +1068,8 @@ sub hardware_info
},
'0xe2d5' => {
'name' => 'Bullet M5 Titanium',
'comment' => 'Bullet M5 TI in testing',
'supported' => '-2',
'comment' => 'Bullet M5 Titanium',
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '6',
'antennas' => { 1 => 'N Connector' },
@ -1089,8 +1079,8 @@ sub hardware_info
},
'0xe302' => {
'name' => 'PicoStation M2',
'comment' => 'PicoStation M2 in testing',
'supported' => '-2',
'comment' => 'PicoStation M2',
'supported' => '1',
'maxpower' => '16',
'pwroffset' => '12',
'antennas' => { 1 => 'Antenna' },
@ -1100,8 +1090,8 @@ sub hardware_info
},
'0xe4e5' => {
'name' => 'NannoBeam M5 International',
'comment' => 'NanoBeam M5 International in testing',
'supported' => '-2',
'comment' => 'NanoBeam M5 International XW series unsuported at this time',
'supported' => '-1',
'maxpower' => '22',
'pwroffset' => '1',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
@ -1111,8 +1101,8 @@ sub hardware_info
},
'0xe805' => {
'name' => 'NanoStation M5',
'comment' => 'NanoStation M5 in testing',
'supported' => '-2',
'comment' => 'NanoStation M5',
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '5',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
@ -1122,8 +1112,8 @@ sub hardware_info
},
'0xe8a5' => {
'name' => 'NanoStation Loco M5',
'comment' => 'NanoStation Loco M5 in testing',
'supported' => '-2',
'comment' => 'NanoStation Loco M5',
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '1',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
@ -1199,7 +1189,11 @@ sub wifi_useschains
#has increased it to a higher level.
sub wifi_txpoweroffset
{
my $doesiwoffset=`iwinfo wlan0 info 2>/dev/null` =~ /TX power offset: (\d+)/;
if ( $doesiwoffset ) {
return $1;
} else
{
$boardinfo = hardware_info();
if ( exists $boardinfo->{'pwroffset'} ) {
return $boardinfo->{'pwroffset'};
@ -1207,6 +1201,7 @@ sub wifi_txpoweroffset
{
return 0;
}
}
}

View File

@ -5,7 +5,6 @@ $debug = 0;
BEGIN {push @INC, '/www/cgi-bin'};
use perlfunc;
use channelmaps;
#
# load the config parms
#
@ -95,7 +94,11 @@ $parms{dmz_dhcp_limit} = $dmz_dhcp_limit = $dmz_dhcp_end - $dmz_dhcp_start;
unless($parms{reload})
{
($wifi_txpower) = `iwconfig wlan0 2>/dev/null` =~ /Tx-Power=(\d+)/;
($wifi_txpower) = `iwinfo wlan0 info 2>/dev/null` =~ /Tx-Power: (\d+)/;
(my $doesiwoffset) = `iwinfo wlan0 info 2>/dev/null` =~ /TX power offset: (\d+)/;
if ( $doesiwoffset ) {
$wifi_txpower -= $1;
}
if (wifi_useschains()){
$wifi_txant = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask`;
$wifi_rxant = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask`;
@ -146,7 +149,7 @@ if($parms{button_apply} or $parms{button_save})
$cmd .= "ifup wifi_mon >/dev/null 2>&1;";
}
$cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;";
$cmd .= "iwconfig wlan0 txpower $wifi_txpower >/dev/null 2>&1;";
$cmd .= "iw dev wlan0 set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
system $cmd;
}
@ -553,7 +556,8 @@ if($wifi_proto ne "disabled")
print "<tr><td><nobr>Tx Power</nobr></td>\n";
print "<td><select name=wifi_txpower>\n";
for($i = wifi_maxpower(); $i >= 1; --$i) { selopt($i+wifi_txpoweroffset()." dBm", $i, $wifi_txpower) }
my $txpoweroffset = wifi_txpoweroffset();
for($i = wifi_maxpower(); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) }
print "</select></td></tr>\n";
print "<tr><td>Distance</td>\n";

View File

@ -1,10 +1,8 @@
#!/usr/bin/perl
$debug = 0;
BEGIN {push @INC, '/www/cgi-bin'};
use perlfunc;
# collect some variables
$node = nvram_get("node");
$node = "NOCALL" if $node eq "";