diff --git a/files/etc/config.ap/_setup b/files/etc/config.ap/_setup index 46b3eb3f..14ac2324 100644 --- a/files/etc/config.ap/_setup +++ b/files/etc/config.ap/_setup @@ -3,6 +3,7 @@ wifi_mode = ap wifi_ssid = wifi_txpower = 19 wifi_channel = 6 +wifi_chanbw = 20 wifi_distance = 0 wifi_hidden = 0 diff --git a/files/etc/config.ap/_setup.default b/files/etc/config.ap/_setup.default index 46b3eb3f..14ac2324 100644 --- a/files/etc/config.ap/_setup.default +++ b/files/etc/config.ap/_setup.default @@ -3,6 +3,7 @@ wifi_mode = ap wifi_ssid = wifi_txpower = 19 wifi_channel = 6 +wifi_chanbw = 20 wifi_distance = 0 wifi_hidden = 0 diff --git a/files/etc/config.ap/system b/files/etc/config.ap/system index 868f1606..1913afb5 100644 --- a/files/etc/config.ap/system +++ b/files/etc/config.ap/system @@ -1,3 +1,17 @@ config 'system' option 'hostname' '' +config button + option button 'reset' + option action 'released' + option handler '/usr/local/bin/bbhnrecoverymode' + option min '3' + option max '7' + +config button + option button 'reset' + option action 'released' + option handler 'firstboot && reboot' + option min '12' + option max '20' + diff --git a/files/etc/config.ap/wireless b/files/etc/config.ap/wireless index 853802b6..ae29939f 100644 --- a/files/etc/config.ap/wireless +++ b/files/etc/config.ap/wireless @@ -2,6 +2,7 @@ config wifi-device radio0 option type mac80211 option phy phy0 option channel + option chanbw option distance config wifi-iface diff --git a/files/etc/config.client/system b/files/etc/config.client/system index 868f1606..1913afb5 100644 --- a/files/etc/config.client/system +++ b/files/etc/config.client/system @@ -1,3 +1,17 @@ config 'system' option 'hostname' '' +config button + option button 'reset' + option action 'released' + option handler '/usr/local/bin/bbhnrecoverymode' + option min '3' + option max '7' + +config button + option button 'reset' + option action 'released' + option handler 'firstboot && reboot' + option min '12' + option max '20' + diff --git a/files/etc/config.mesh/_setup b/files/etc/config.mesh/_setup index b2151d78..f50ac8eb 100644 --- a/files/etc/config.mesh/_setup +++ b/files/etc/config.mesh/_setup @@ -1,10 +1,11 @@ wifi_proto = static wifi_ip = 10. wifi_mask = 255.0.0.0 -wifi_ssid = BroadbandHamnet-v2 +wifi_ssid = BroadbandHamnet wifi_mode = adhoc wifi_txpower = 19 wifi_channel = 1 +wifi_chanbw = 20 wifi_distance = 0 wifi_country = 00 diff --git a/files/etc/config.mesh/_setup.default b/files/etc/config.mesh/_setup.default index 49cf423b..d232109e 100644 --- a/files/etc/config.mesh/_setup.default +++ b/files/etc/config.mesh/_setup.default @@ -1,10 +1,11 @@ wifi_proto = static wifi_ip = 10. wifi_mask = 255.0.0.0 -wifi_ssid = BroadbandHamnet-v2 +wifi_ssid = BroadbandHamnet wifi_mode = adhoc wifi_txpower = 19 wifi_channel = 1 +wifi_chanbw = 20 wifi_distance = 0 wifi_country = 00 diff --git a/files/etc/config.mesh/olsrd b/files/etc/config.mesh/olsrd index 010ce927..19b86493 100644 --- a/files/etc/config.mesh/olsrd +++ b/files/etc/config.mesh/olsrd @@ -21,15 +21,20 @@ config LoadPlugin option library 'olsrd_txtinfo.so.0.1' option accept '0.0.0.0' -config LoadPlugin - option library 'olsrd_secure.so.0.6' - option keyfile '/etc/olsrd.d/olsrd_secure_key' +#config LoadPlugin +# option library 'olsrd_secure.so.0.6' +# option keyfile '/etc/olsrd.d/olsrd_secure_key' config LoadPlugin option library 'olsrd_dot_draw.so.0.3' option accept '127.0.0.1' option port '2003' +config LoadPlugin + option library 'olsrd_watchdog.so.0.1' + option file '/tmp/olsrd.watchdog' + option interval '5' + config Interface list interface 'wifi' diff --git a/files/etc/config.mesh/system b/files/etc/config.mesh/system index 868f1606..1913afb5 100644 --- a/files/etc/config.mesh/system +++ b/files/etc/config.mesh/system @@ -1,3 +1,17 @@ config 'system' option 'hostname' '' +config button + option button 'reset' + option action 'released' + option handler '/usr/local/bin/bbhnrecoverymode' + option min '3' + option max '7' + +config button + option button 'reset' + option action 'released' + option handler 'firstboot && reboot' + option min '12' + option max '20' + diff --git a/files/etc/config.mesh/wireless b/files/etc/config.mesh/wireless index 06125f20..912a073e 100644 --- a/files/etc/config.mesh/wireless +++ b/files/etc/config.mesh/wireless @@ -2,6 +2,7 @@ config wifi-device radio0 option type mac80211 option phy phy0 option channel + option chanbw option distance option country @@ -9,7 +10,7 @@ config wifi-iface option device radio0 option network wifi option mode - option ssid "" + option ssid "--v3" option encryption none config wifi-iface diff --git a/files/etc/config.mesh_ap/_setup b/files/etc/config.mesh_ap/_setup index 10aa592c..ed461bc9 100644 --- a/files/etc/config.mesh_ap/_setup +++ b/files/etc/config.mesh_ap/_setup @@ -3,6 +3,7 @@ wifi_mode = ap wifi_ssid = wifi_txpower = 19 wifi_channel = 6 +wifi_chanbw = 20 wifi_distance = 0 wifi_hidden = 0 diff --git a/files/etc/config.mesh_ap/_setup.default b/files/etc/config.mesh_ap/_setup.default index 10aa592c..ed461bc9 100644 --- a/files/etc/config.mesh_ap/_setup.default +++ b/files/etc/config.mesh_ap/_setup.default @@ -3,6 +3,7 @@ wifi_mode = ap wifi_ssid = wifi_txpower = 19 wifi_channel = 6 +wifi_chanbw = 20 wifi_distance = 0 wifi_hidden = 0 diff --git a/files/etc/config.mesh_ap/system b/files/etc/config.mesh_ap/system index 868f1606..1913afb5 100644 --- a/files/etc/config.mesh_ap/system +++ b/files/etc/config.mesh_ap/system @@ -1,3 +1,17 @@ config 'system' option 'hostname' '' +config button + option button 'reset' + option action 'released' + option handler '/usr/local/bin/bbhnrecoverymode' + option min '3' + option max '7' + +config button + option button 'reset' + option action 'released' + option handler 'firstboot && reboot' + option min '12' + option max '20' + diff --git a/files/etc/config.mesh_ap/wireless b/files/etc/config.mesh_ap/wireless index 853802b6..ae29939f 100644 --- a/files/etc/config.mesh_ap/wireless +++ b/files/etc/config.mesh_ap/wireless @@ -2,6 +2,7 @@ config wifi-device radio0 option type mac80211 option phy phy0 option channel + option chanbw option distance config wifi-iface diff --git a/files/etc/config.router/system b/files/etc/config.router/system index 868f1606..1913afb5 100644 --- a/files/etc/config.router/system +++ b/files/etc/config.router/system @@ -1,3 +1,17 @@ config 'system' option 'hostname' '' +config button + option button 'reset' + option action 'released' + option handler '/usr/local/bin/bbhnrecoverymode' + option min '3' + option max '7' + +config button + option button 'reset' + option action 'released' + option handler 'firstboot && reboot' + option min '12' + option max '20' + diff --git a/files/etc/config.router/wireless b/files/etc/config.router/wireless index bb43b0be..d64e39f7 100644 --- a/files/etc/config.router/wireless +++ b/files/etc/config.router/wireless @@ -2,6 +2,7 @@ config wifi-device radio0 option type mac80211 option phy phy0 option channel + option chanbw option disabled 1 config wifi-iface diff --git a/files/etc/config/system b/files/etc/config/system index 2f0b909d..4e827de6 100644 --- a/files/etc/config/system +++ b/files/etc/config/system @@ -1,3 +1,16 @@ config 'system' option 'hostname' 'NOCALL' +config button + option button 'reset' + option action 'released' + option handler '/usr/local/bin/bbhnrecoverymode' + option min '3' + option max '7' + +config button + option button 'reset' + option action 'released' + option handler 'firstboot && reboot' + option min '12' + option max '20' diff --git a/files/etc/hotplug.d/button/00-button b/files/etc/hotplug.d/button/00-button new file mode 100644 index 00000000..63cc217d --- /dev/null +++ b/files/etc/hotplug.d/button/00-button @@ -0,0 +1,24 @@ +. /lib/functions.sh +do_button () { + local button + local action + local handler + local min + local max + + config_get button $1 button + config_get action $1 action + config_get handler $1 handler + config_get min $1 min + config_get max $1 max + + [ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && { + [ -z "$min" -o -z "$max" ] && eval $handler + [ -n "$min" -a -n "$max" ] && { + [ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler + } + } +} + +config_load system +config_foreach do_button button diff --git a/files/usr/local/bin/aimer b/files/usr/local/bin/aimer index 46a083ad..4a3005a6 100755 --- a/files/usr/local/bin/aimer +++ b/files/usr/local/bin/aimer @@ -18,7 +18,7 @@ if ( $ARGV[0] ) { } else { - $SSIDName= lc "BroadbandHamnet-v2"; + $SSIDName= lc "BroadbandHamnet-20-v3"; } diff --git a/files/usr/local/bin/bbhnrecoverymode b/files/usr/local/bin/bbhnrecoverymode new file mode 100755 index 00000000..05b2ca6e --- /dev/null +++ b/files/usr/local/bin/bbhnrecoverymode @@ -0,0 +1,20 @@ +#!/bin/sh + +DHCPLANSECTION=`uci show dhcp|grep interface=lan|sed "s/dhcp.\@dhcp\[\(.*\)\].interface=lan/\1/"` + +logger "BBHN Recovery: Reseting password to BBHN default" +/usr/local/bin/setpasswd hsmm + +logger "BBHN Recovery: Restarting uhttpd" +/etc/init.d/uhttpd restart + +if [ "$DHCPLANSECTION" != "" ] + then + logger "BBHN Recovery: Enable DHCP on lan interface" + uci set dhcp.@dhcp\[$DHCPLANSECTION\].ignore=0 + uci -q commit + + logger "BBHN Recovery: Restart dnsmasq" + /etc/init.d/dnsmasq restart +fi + diff --git a/files/usr/local/bin/olsrd-watchdog b/files/usr/local/bin/olsrd-watchdog index 94181dae..fdb4da4d 100755 --- a/files/usr/local/bin/olsrd-watchdog +++ b/files/usr/local/bin/olsrd-watchdog @@ -3,17 +3,21 @@ # wait for the watchdog file to appear while(not -e "/tmp/olsrd.watchdog") { sleep 15 } -$stamp = 0; +$failcount = 0; +$last_olsrstamp = 0; + while(1) { - $last_stamp = $stamp; - $stamp = time; chomp ($olsr = `cat /tmp/olsrd.watchdog`); - $olsr = 0 unless $olsr; - # avoid false restarts due to changes in system time - if($stamp - $last_stamp < 20 and $stamp - $olsr > 20) + if ( $olsr && $olsr ne $last_olsrstamp ){ + $failcount = 0; + } else { + $failcount += 1; + } + + if( $failcount >= 3 ) { ($uptime) = `cat /proc/uptime` =~ /^(\d+)/; $date = `date`; @@ -21,5 +25,7 @@ while(1) system "/etc/init.d/olsrd restart"; } - sleep 15; + $last_olsrstamp = $olsr; + + sleep 10; } diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 596e8abd..51e11136 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -269,6 +269,7 @@ while(1) } 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 } diff --git a/files/www/cgi-bin/channelmaps.pm b/files/www/cgi-bin/channelmaps.pm index 9d568d7e..2bb6004e 100644 --- a/files/www/cgi-bin/channelmaps.pm +++ b/files/www/cgi-bin/channelmaps.pm @@ -8,6 +8,12 @@ use perlfunc; sub rf_channel_map { %channellist = ( + '900' => { + 4 => "(907)", + 5 => "(912)", + 6 => "(917)", + 7 => "(922)", + }, '2400' => { 1 => "1 (2412)", 2 => "2 (2417)", @@ -139,6 +145,25 @@ sub rf_channels_list } } +sub is_wifi_chanbw_valid +{ + my ($wifi_chanbw,$wifi_ssid) = @_; + my $boardinfo=hardware_info(); + if ( ( exists($boardinfo->{'rfband'}) ) && ( $boardinfo->{'rfband'} == "2400" ) && ( $wifi_chanbw != 20 ) ) + { + if ( (( length $wifi_ssid >= 33 ) || ( length $wifi_ssid == 0 )) || ( $wifi_ssid =~ /BroadBandHamnet/i )) + { + # 2.4ghz and default ssid not 20mhz wide -- Invalid chan_bw + return 0; + } else { + # chan_bw valid + return 1; + } + } + # Not 2.4ghz or device is unknown, trust the user submission. + return 1; +} + #weird uhttpd/busybox error requires a 1 at the end of this file 1 diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 4fac7946..8c9e71c7 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -911,6 +911,17 @@ sub hardware_info 'usechains' => 0, 'rfband' => '2400', }, + '0xe009' => { + 'name' => 'NanoStation Loco M9', + 'comment' => 'NanoStation Loco M9', + 'supported' => '1', + 'maxpower' => '22', + 'pwroffset' => '6', + 'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" }, + 'defaultant' => 3, + 'usechains' => 1, + 'rfband' => '900', + }, '0xe012' => { 'name' => 'NanoStation M2', 'comment' => '', @@ -955,6 +966,17 @@ sub hardware_info 'usechains' => 1, 'rfband' => '5800ubntus', }, + '0xe1b9' => { + 'name' => 'Rocket M9', + 'comment' => 'Rocket M9', + 'supported' => '1', + 'maxpower' => '22', + 'pwroffset' => '6', + 'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"}, + 'defaultant' => 3, + 'usechains' => 1, + 'rfband' => '900', + }, '0xe202' => { 'name' => 'Bullet M2 HP', 'comment' => '', @@ -999,6 +1021,17 @@ sub hardware_info 'usechains' => 1, 'rfband' => '2400', }, + '0xe239' => { + 'name' => 'NannoBridge M9', + 'comment' => 'NanoBridge M9', + 'supported' => '1', + 'maxpower' => '22', + 'pwroffset' => '6', + 'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" }, + 'defaultant' => 3, + 'usechains' => 1, + 'rfband' => '900', + }, '0xe242' => { 'name' => 'airGrid M2 HP', 'comment' => 'airGrid M2 HP', diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index c4799ad4..1eeb2e36 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -85,8 +85,8 @@ if($dmz_mode) } # derive values which are not explicitly defined -$parms{dhcp_limit} = $dhcp_limit = $dhcp_end - $dhcp_start; -$parms{dmz_dhcp_limit} = $dmz_dhcp_limit = $dmz_dhcp_end - $dmz_dhcp_start; +$parms{dhcp_limit} = $dhcp_limit = $dhcp_end - $dhcp_start + 1; +$parms{dmz_dhcp_limit} = $dmz_dhcp_limit = $dmz_dhcp_end - $dmz_dhcp_start + 1; # # get the active wifi settings on a fresh page load @@ -171,14 +171,25 @@ if($parms{button_save}) push @errors, "invalid WiFi IP address"; } } - - push (@errors, "invalid WiFi SSID") unless length $wifi_ssid <= 32; + + if ($config eq "mesh"){ + push (@errors, "invalid WiFi SSID") unless length $wifi_ssid <= 27; + } else + { + push (@errors, "invalid WiFi SSID") unless length $wifi_ssid <= 32; + } if ( is_channel_valid($wifi_channel) != 1 ) { push (@errors, "invalid WiFi channel") } + if ( !is_wifi_chanbw_valid($wifi_chanbw,$wifi_ssid) ) + { + push (@errors, "Invalid WiFi channel width"); + $wifi_chanbw = 20; + } + push (@errors, "invalid WiFi distance") if $wifi_distance < 0 or $wifi_distance =~ /\D/; $wifi_country_validated=0; @@ -482,7 +493,14 @@ else if($wifi_proto ne "disabled") { print "SSID\n"; - print "\n"; + print ""; + if ($config eq "mesh") + { + print "-$wifi_chanbw-v3\n"; + } else + { + print "\n"; + } if($wifi_mode eq "ap") { @@ -523,6 +541,15 @@ if($wifi_proto ne "disabled") push @hidden, ""; } + { + print "Channel Width\n"; + print "\n"; + } + if ($config ne "mesh") { print "Country\n";