diff --git a/files/etc/config.mesh/_setup b/files/etc/config.mesh/_setup index 1315c765..b83b193a 100644 --- a/files/etc/config.mesh/_setup +++ b/files/etc/config.mesh/_setup @@ -8,11 +8,12 @@ wifi_channel = 1 wifi_chanbw = 20 wifi_distance = 0 wifi_country = 00 +wifi_enable = 1 wifi2_enable = 0 wifi2_ssid = NoCall-AREDN wifi2_channel = 36 -wifi2_encryption = none +wifi2_encryption = wifi2_key = dmz_mode = 3 diff --git a/files/etc/config.mesh/_setup.default b/files/etc/config.mesh/_setup.default index bfb76658..eea9c4f4 100644 --- a/files/etc/config.mesh/_setup.default +++ b/files/etc/config.mesh/_setup.default @@ -8,6 +8,7 @@ wifi_channel = 1 wifi_chanbw = 20 wifi_distance = 0 wifi_country = 00 +wifi_enable = 1 wifi2_enable = 0 wifi2_ssid = NoCAll-AREDN diff --git a/files/usr/local/bin/clean_zombie.sh b/files/usr/local/bin/clean_zombie.sh index 58b7692e..261ad280 100755 --- a/files/usr/local/bin/clean_zombie.sh +++ b/files/usr/local/bin/clean_zombie.sh @@ -36,6 +36,12 @@ LICENSE # Look for hung 'iw' zombie processes prone to hang # when available memory is low. +# if Mesh RF is disabled, then nothing to do +iface=$(uci -q get 'network.wifi.ifname') +if [ "$iface" = "${iface##wlan*}" ]; then + exit +fi + zombiepid="/tmp/clean_zombie.pid" [ -e $zombiepid ] && [ -d "/proc/$(cat $zombiepid)" ] && exit diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index 64aee771..c2c48d93 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -124,15 +124,23 @@ foreach $line (`cat /etc/config.mesh/_setup`) } chomp ($lanintf=`jsonfilter -e '@.network.lan.ifname' < /etc/board.json`); -$cfg{"lan_intf"} = "$lanintf"; -if ( ! $cfg{"wifi_intf"} ) -{ - $cfg{"wifi_intf"} = get_interface("wifi"); -} -$cfg{"wan_intf"} = get_bridge_interfaces("wan"); -$cfg{"dtdlink_intf"} = get_bridge_interfaces("dtdlink"); +$cfg{lan_intf} = "$lanintf"; -$cfg{"wifi_intf"} =~ /wlan(\d+)/; +$cfg{wan_intf} = get_bridge_interfaces("wan"); +$cfg{dtdlink_intf} = get_bridge_interfaces("dtdlink"); + +if ( $cfg{wifi_enable} == 1 ) +{ + $cfg{wifi_intf} = `jsonfilter -e '@.network.wifi.ifname' < /etc/board.json | cut -f1`; + $cfg{wifi_intf} =~ /wlan(\d+)/; + chomp $cfg{wifi_intf}; +} +else +{ + $wifi_sudo_intf = "$lanintf"; + $wifi_sudo_intf =~ s/^([^\. \t]+).*$/$1/; + $cfg{wifi_intf} = $wifi_sudo_intf . ".3975"; +} die "configuration load failed\n" unless keys %cfg; @@ -417,7 +425,10 @@ unless($cfg{wifi_proto} eq "disabled") { $cfg{wifi_txpower} = wifi_maxpower($cfg{wifi_channel}) if not defined $cfg{wifi_txpower} or $cfg{wifi_txpower} > wifi_maxpower($cfg{wifi_channel}); $cfg{wifi_txpower} = 1 if $cfg{wifi_txpower} < 1; - print FILE "/usr/sbin/iw dev $cfg{wifi_intf} set txpower fixed $cfg{wifi_txpower}00\n"; + if ( $cfg{wifi_enable} == 1 ) + { + print FILE "/usr/sbin/iw dev $cfg{wifi_intf} 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}; @@ -467,8 +478,6 @@ if(-f "/etc/config.mesh/olsrd") print OUT "config LoadPlugin\n"; print OUT " option library 'olsrd_dyn_gw.so.0.5'\n"; print OUT " option Interval '60'\n"; - print OUT " list Ping '71.42.236.91'\n"; # hsmm-mesh.org\n"; - print OUT " list Ping '71.42.236.90'\n"; # hsmm-mesh.org\n"; print OUT " list Ping '8.8.8.8'\n"; # google dns\n"; print OUT " list Ping '8.8.4.4'\n"; # google dns\n"; print OUT "\n\n"; diff --git a/files/usr/local/bin/rssi_monitor b/files/usr/local/bin/rssi_monitor index e97bfe1a..6e94699a 100755 --- a/files/usr/local/bin/rssi_monitor +++ b/files/usr/local/bin/rssi_monitor @@ -39,6 +39,11 @@ # The wireless driver poorly tunes and treats these neighbors as noise in error. # This is a workaround until root cause driver updates occur. +chomp ($iface=`uci -q get 'network.wifi.ifname'`); # wireless interface +$wifi_disable = ( $iface =~ /eth.*$/ )? 1 : 0; +exit 0 if $wifi_disable; + + $now=`cat /proc/uptime | cut -f1 -d" "`; chomp $now; exit 0 unless $now > 119; @@ -75,7 +80,6 @@ if ( -f "$snrlogpid" ) sleep 7; -chomp ($iface=`uci -q get 'network.wifi.ifname'`); # wireless interface foreach(`iwinfo $iface info`) { next unless /^.*PHY name:\s*([a-z0-4]+)/; diff --git a/files/usr/local/bin/snrlog b/files/usr/local/bin/snrlog index 4b643a17..2809e7ff 100755 --- a/files/usr/local/bin/snrlog +++ b/files/usr/local/bin/snrlog @@ -256,6 +256,14 @@ end -- Neighbor Class END -- MAIN() ------------------------------------------------------------------------------------- +-- get wifi interface name +wifiiface=get_ifname("wifi") + +-- if Mesh RF is turned off do nothing +if ( wifiiface == string.match(wifiiface,'eth.*')) then + return +end + -- check to make sure a prior instance is not still running local f = io.open(pidfile,"r") if (f) then @@ -285,9 +293,6 @@ if (f) then end end --- get wifi interface name -wifiiface=get_ifname("wifi") - -- load the lasttime table if file_exists(lastdat) then local f,err=io.open(lastdat,"r") diff --git a/files/usr/local/bin/wifi-setup b/files/usr/local/bin/wifi-setup index 15c7717c..c38f5635 100755 --- a/files/usr/local/bin/wifi-setup +++ b/files/usr/local/bin/wifi-setup @@ -52,6 +52,7 @@ done < $configfile meshif="$(uci -q get network.wifi.ifname)" meshphy="phy${meshif#wlan}" +hwtype="$(/usr/local/bin/get_hardwaretype)" rm -f "${dropdir}/wireless" touch "${dropdir}/wireless" @@ -109,7 +110,6 @@ for _dev in /sys/class/ieee80211/*; do key="" network="wifi" else - # mesh AP bridged with lan disabled="${wifi2_disabled}" channel="${wifi2_channel}" chanbw="" @@ -126,39 +126,42 @@ for _dev in /sys/class/ieee80211/*; do network="lan" fi - uci -c ${dropdir} -q batch > /dev/null <<-EOF - set wireless.${radio}=wifi-device - set wireless.${radio}.type=mac80211 - set wireless.${radio}.disabled=${disabled} - set wireless.${radio}.channel=${channel} - set wireless.${radio}.chanbw=${chanbw} - set wireless.${radio}.country=${country} - set wireless.${radio}.distance=${distance} - set wireless.${radio}.hwmode=${hwmode} - set wireless.${radio}.htmode=${htmode} - ${dev_id} - add wireless wifi-iface - set wireless.@wifi-iface[${ifacenum}].device=${radio} - set wireless.@wifi-iface[${ifacenum}].network=${network} - set wireless.@wifi-iface[${ifacenum}].mode=${mode} - set wireless.@wifi-iface[${ifacenum}].ssid="${ssid}" - set wireless.@wifi-iface[${ifacenum}].encryption=${encryption} - set wireless.@wifi-iface[${ifacenum}].key="${key}" -EOF - uci -c ${dropdir} -q commit wireless - - if [ ${is_mesh_rf} -eq 1 ]; then - # add monitor interface on mesh rf - ifacenum=$((ifacenum + 1)) + # test for devices with 2 wireless cards -- don't setup 2 APs + if [ "$hwtype" != "rb-952ui-5ac2nd" -o "$hwmode" != "11g" -o ${is_mesh_rf} -eq 1 ]; then uci -c ${dropdir} -q batch > /dev/null <<-EOF + set wireless.${radio}=wifi-device + set wireless.${radio}.type=mac80211 + set wireless.${radio}.disabled=${disabled} + set wireless.${radio}.channel=${channel} + set wireless.${radio}.chanbw=${chanbw} + set wireless.${radio}.country=${country} + set wireless.${radio}.distance=${distance} + set wireless.${radio}.hwmode=${hwmode} + set wireless.${radio}.htmode=${htmode} + ${dev_id} add wireless wifi-iface - set wireless.@wifi-iface[${ifacenum}].device=${radio} - set wireless.@wifi-iface[${ifacenum}].network=wifi_mon - set wireless.@wifi-iface[${ifacenum}].mode=monitor + set wireless.@wifi-iface[${ifacenum}].device=${radio} + set wireless.@wifi-iface[${ifacenum}].network=${network} + set wireless.@wifi-iface[${ifacenum}].mode=${mode} + set wireless.@wifi-iface[${ifacenum}].ssid="${ssid}" + set wireless.@wifi-iface[${ifacenum}].encryption=${encryption} + set wireless.@wifi-iface[${ifacenum}].key="${key}" EOF - uci -q -c ${dropdir} commit wireless - fi + uci -c ${dropdir} -q commit wireless + if [ ${is_mesh_rf} -eq 1 ]; then + # add monitor interface on mesh rf + ifacenum=$((ifacenum + 1)) + uci -c ${dropdir} -q batch > /dev/null <<-EOF + add wireless wifi-iface + set wireless.@wifi-iface[${ifacenum}].device=${radio} + set wireless.@wifi-iface[${ifacenum}].network=wifi_mon + set wireless.@wifi-iface[${ifacenum}].mode=monitor +EOF + uci -q -c ${dropdir} commit wireless + fi + fi + ifacenum=$((ifacenum + 1)) done diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 487991fe..90e45c2f 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -128,7 +128,7 @@ else } # make sure unchecked checkboxes are accounted for -foreach(qw(lan_dhcp olsrd_bridge olsrd_gw wifi2_enable lan_dhcp_noroute)) +foreach(qw(lan_dhcp olsrd_bridge olsrd_gw wifi2_enable lan_dhcp_noroute wifi_enable)) { $parms{$_} = 0 unless $parms{$_}; } @@ -187,7 +187,7 @@ $parms{wifi_txpower} = $wifi_txpower; # apply the wifi settings # -if($parms{button_apply} or $parms{button_save}) +if(($parms{button_apply} or $parms{button_save}) and $wifi_enable ) { if($wifi_distance < 1 or $wifi_distance =~ /\D/) { @@ -682,6 +682,14 @@ print "