mirror of https://github.com/aredn/aredn.git
remove non-mesh modes from setup options
fixes AREDN->ticket:175 Change-Id: I7517df178a5ce82ef79ec4af844932fe6569d8da
This commit is contained in:
parent
4ada350a4c
commit
d4b7617e03
|
@ -9,73 +9,72 @@ if ( ! $needsrun ){
|
|||
exit 0;
|
||||
}
|
||||
|
||||
$config=nvram_get('config');
|
||||
if ($config ne "mesh")
|
||||
{
|
||||
print "This node was previously configured in non-mesh mode and is no longer implemented. Returning to \"firstboot\".\n";
|
||||
system ("firstboot -y && reboot");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
#Prep some variables
|
||||
$node = nvram_get("node");
|
||||
$mac2 = mac2ip(get_mac(get_interface("wifi")), 0);
|
||||
$dtdmac = mac2ip(get_mac(get_interface("lan")), 0);
|
||||
|
||||
$cfg = ();
|
||||
$defaultcfg = ();
|
||||
|
||||
foreach $config ("ap","client","mesh","mesh_ap","router")
|
||||
open(TMPCONFFILE, ">/tmp/.mesh_setup") or die;
|
||||
|
||||
foreach $line (`cat /etc/config.mesh/_setup`)
|
||||
{
|
||||
next if $line =~ /^\s*#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
$line =~ /^(\w+)\s*=\s*(.*)$/;
|
||||
|
||||
|
||||
$cfg = ();
|
||||
$defaultcfg = ();
|
||||
|
||||
open(TMPCONFFILE, ">/tmp/.${config}_setup") or die;
|
||||
|
||||
foreach $line (`cat /etc/config.$config/_setup`)
|
||||
{
|
||||
next if $line =~ /^\s*#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
$line =~ /^(\w+)\s*=\s*(.*)$/;
|
||||
|
||||
$cfg{$1} = $2;
|
||||
}
|
||||
|
||||
foreach $line (`cat /etc/config.$config/_setup.default`)
|
||||
{
|
||||
next if $line =~ /^\s*#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
$line =~ s/<NODE>/$node/;
|
||||
$line =~ s/<MAC2>/$mac2/;
|
||||
$line =~ s/<DTDMAC>/$dtdmac/;
|
||||
$line =~ /^(\w+)\s*=\s*(.*)$/;
|
||||
$defaultcfg{$1} = $2;
|
||||
}
|
||||
|
||||
foreach $variable( sort keys %defaultcfg )
|
||||
{
|
||||
if ( defined $cfg{$variable} )
|
||||
{
|
||||
print TMPCONFFILE "$variable = $cfg{$variable}\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print TMPCONFFILE "$variable = $defaultcfg{$variable}\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Specific settings for variables that are not in the default config but are added by the system
|
||||
foreach $variable( 'dmz_dhcp_end', 'dmz_dhcp_limit', 'dmz_dhcp_start', 'dmz_lan_ip', 'dmz_lan_mask', 'wifi_rxant', 'wifi_txant' )
|
||||
{
|
||||
if ( defined $cfg{$variable} )
|
||||
{
|
||||
print TMPCONFFILE "$variable = $cfg{$variable}\n";
|
||||
}
|
||||
}
|
||||
|
||||
close (TMPCONFFILE);
|
||||
|
||||
system ("mv /tmp/.${config}_setup /etc/config.$config/_setup");
|
||||
print "Updated mode: $config\n";
|
||||
$cfg{$1} = $2;
|
||||
}
|
||||
|
||||
$LASTMODE=nvram_get('config');
|
||||
foreach $line (`cat /etc/config.mesh/_setup.default`)
|
||||
{
|
||||
next if $line =~ /^\s*#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
$line =~ s/<NODE>/$node/;
|
||||
$line =~ s/<MAC2>/$mac2/;
|
||||
$line =~ s/<DTDMAC>/$dtdmac/;
|
||||
$line =~ /^(\w+)\s*=\s*(.*)$/;
|
||||
$defaultcfg{$1} = $2;
|
||||
}
|
||||
|
||||
foreach $variable( sort keys %defaultcfg )
|
||||
{
|
||||
if ( defined $cfg{$variable} )
|
||||
{
|
||||
print TMPCONFFILE "$variable = $cfg{$variable}\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print TMPCONFFILE "$variable = $defaultcfg{$variable}\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Specific settings for variables that are not in the default config but are added by the system
|
||||
foreach $variable( 'dmz_dhcp_end', 'dmz_dhcp_limit', 'dmz_dhcp_start', 'dmz_lan_ip', 'dmz_lan_mask', 'wifi_rxant', 'wifi_txant' )
|
||||
{
|
||||
if ( defined $cfg{$variable} )
|
||||
{
|
||||
print TMPCONFFILE "$variable = $cfg{$variable}\n";
|
||||
}
|
||||
}
|
||||
|
||||
close (TMPCONFFILE);
|
||||
|
||||
system ("mv /tmp/.mesh_setup /etc/config.mesh/_setup");
|
||||
print "Updated mode: mesh\n";
|
||||
|
||||
#Commit the new combined config
|
||||
system ("/usr/local/bin/node-setup -a $LASTMODE");
|
||||
system ("/usr/local/bin/node-setup -a mesh");
|
||||
nvram_set("nodeupgraded","0");
|
||||
print "Rebooting node";
|
||||
system ("reboot");
|
||||
|
|
|
@ -65,7 +65,7 @@ while(defined $ARGV[0] and $ARGV[0] =~ /^-/)
|
|||
$config = shift;
|
||||
usage() unless defined $config;
|
||||
|
||||
die "'$config' is not a valid configuration\n" unless -f "/etc/config.$config/_setup";
|
||||
die "'$config' is not a valid configuration\n" unless ($config eq "mesh" and -f "/etc/config.mesh/_setup");
|
||||
|
||||
#chomp ($node = `nvram get node`);
|
||||
#chomp ($mac2 = `nvram get mac2`);
|
||||
|
@ -115,7 +115,7 @@ unless($auto)
|
|||
# load and verify the selected configuration
|
||||
#
|
||||
|
||||
foreach $line (`cat /etc/config.$config/_setup`)
|
||||
foreach $line (`cat /etc/config.mesh/_setup`)
|
||||
{
|
||||
next if $line =~ /^\s*#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
|
@ -151,7 +151,7 @@ if($cfg{lan_dhcp}) { $cfg{lan_dhcp} = 0 }
|
|||
else { $cfg{lan_dhcp} = 1 }
|
||||
|
||||
# verify that we have all the variables we need
|
||||
chdir "/etc/config.$config" or die;
|
||||
chdir "/etc/config.mesh" or die;
|
||||
foreach(`grep "^[^#].*<" *`)
|
||||
{
|
||||
($file, $parm) = /^(\S+):.*<(\w+)>/;
|
||||
|
@ -176,10 +176,10 @@ if($cfg{dmz_mode})
|
|||
}
|
||||
|
||||
# select ports and dhcp files based on mode
|
||||
$portfile = "/etc/config.$config/_setup.ports";
|
||||
$dhcpfile = "/etc/config.$config/_setup.dhcp";
|
||||
$portfile .= ($cfg{dmz_mode} ? ".dmz" : ".nat") if $config eq "mesh";
|
||||
$dhcpfile .= ($cfg{dmz_mode} ? ".dmz" : ".nat") if $config eq "mesh";
|
||||
$portfile = "/etc/config.mesh/_setup.ports";
|
||||
$dhcpfile = "/etc/config.mesh/_setup.dhcp";
|
||||
$portfile .= ($cfg{dmz_mode} ? ".dmz" : ".nat");
|
||||
$dhcpfile .= ($cfg{dmz_mode} ? ".dmz" : ".nat");
|
||||
|
||||
|
||||
# basic configuration
|
||||
|
@ -192,7 +192,7 @@ if($do_basic)
|
|||
|
||||
# copy and process the new configuration
|
||||
|
||||
chdir "/etc/config.$config" or die;
|
||||
chdir "/etc/config.mesh" or die;
|
||||
|
||||
foreach $file (glob "*")
|
||||
{
|
||||
|
@ -243,14 +243,14 @@ if($do_basic)
|
|||
system "rm -f /etc/config/*";
|
||||
system "mv /tmp/new_config/* /etc/config";
|
||||
unlink "/tmp/new_config";
|
||||
system "cp -f /etc/config.$config/firewall.user /etc/";
|
||||
system "cp -f /etc/config.mesh/firewall.user /etc/";
|
||||
|
||||
#system "nvram set config=$config";
|
||||
#system "nvram set config=mesh";
|
||||
#system "nvram set node=$node";
|
||||
#system "nvram set tactical=$tactical";
|
||||
#system "nvram commit";
|
||||
|
||||
nvram_set("config", $config);
|
||||
nvram_set("config", "mesh");
|
||||
nvram_set("node", $node);
|
||||
nvram_set("tactical", $tactical);
|
||||
|
||||
|
@ -300,8 +300,8 @@ system "cat /etc/ethers.user >> /etc/ethers" if -e "/etc/ethers.user";
|
|||
|
||||
unless($do_basic)
|
||||
{
|
||||
system "cp -f /etc/config.$config/firewall /etc/config";
|
||||
system "cp -f /etc/config.$config/firewall.user /etc/";
|
||||
system "cp -f /etc/config.mesh/firewall /etc/config";
|
||||
system "cp -f /etc/config.mesh/firewall.user /etc/";
|
||||
}
|
||||
|
||||
open(FILE, ">>/etc/config/firewall") or die;
|
||||
|
@ -322,7 +322,7 @@ if($cfg{dmz_mode}) {
|
|||
print FILE " option 'path' '/etc/firewall.natmode'\n";
|
||||
print FILE " option 'reload' '1'\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($cfg{olsrd_gw}) {
|
||||
print FILE "\nconfig forwarding\n";
|
||||
|
@ -394,25 +394,21 @@ close(FILE);
|
|||
|
||||
# generate the services file
|
||||
|
||||
if($config eq "mesh")
|
||||
$servfile = "/etc/config.mesh/_setup.services." . ($cfg{dmz_mode} ? "dmz" : "nat");
|
||||
open(SERV, ">/etc/config/services") or die;
|
||||
foreach(`cat $servfile 2>/dev/null`)
|
||||
{
|
||||
$servfile = "/etc/config.$config/_setup.services." . ($cfg{dmz_mode} ? "dmz" : "nat");
|
||||
open(SERV, ">/etc/config/services") or die;
|
||||
foreach(`cat $servfile 2>/dev/null`)
|
||||
{
|
||||
next if /^\s*#/;
|
||||
next if /^\s*$/;
|
||||
chomp;
|
||||
($name, $link, $proto, $host, $port, $suffix) = split /\|/, $_;
|
||||
$proto = "http" unless $proto;
|
||||
$port = 0 unless $link;
|
||||
$suffix = "" unless $suffix;
|
||||
next unless defined $name and $name ne "" and defined $host and $host ne "";
|
||||
printf SERV "%s://%s:%s/%s|%s|%s\n", $proto, $host, $port, $suffix, "tcp", $name;
|
||||
}
|
||||
close(SERV);
|
||||
next if /^\s*#/;
|
||||
next if /^\s*$/;
|
||||
chomp;
|
||||
($name, $link, $proto, $host, $port, $suffix) = split /\|/, $_;
|
||||
$proto = "http" unless $proto;
|
||||
$port = 0 unless $link;
|
||||
$suffix = "" unless $suffix;
|
||||
next unless defined $name and $name ne "" and defined $host and $host ne "";
|
||||
printf SERV "%s://%s:%s/%s|%s|%s\n", $proto, $host, $port, $suffix, "tcp", $name;
|
||||
}
|
||||
|
||||
close(SERV);
|
||||
|
||||
# generate the local config script
|
||||
|
||||
|
@ -427,11 +423,8 @@ unless($cfg{wifi_proto} eq "disabled")
|
|||
{
|
||||
printf FILE "echo %s,%s > /tmp/latlon.txt\n", $cfg{aprs_lat}, $cfg{aprs_lon};
|
||||
}
|
||||
if($config eq "mesh")
|
||||
{
|
||||
print FILE "/usr/local/bin/olsrd-watchdog &\n";
|
||||
print FILE "/usr/local/bin/olsrd-namechange-loop &\n";
|
||||
}
|
||||
print FILE "/usr/local/bin/olsrd-watchdog &\n";
|
||||
print FILE "/usr/local/bin/olsrd-namechange-loop &\n";
|
||||
}
|
||||
close(FILE);
|
||||
system "chmod +x /etc/local/services";
|
||||
|
@ -439,9 +432,9 @@ system "chmod +x /etc/local/services";
|
|||
|
||||
# generate olsrd.conf
|
||||
|
||||
if(-f "/etc/config.$config/olsrd")
|
||||
if(-f "/etc/config.mesh/olsrd")
|
||||
{
|
||||
open(IN, "/etc/config.$config/olsrd") or die;
|
||||
open(IN, "/etc/config.mesh/olsrd") or die;
|
||||
open(OUT, ">/etc/config/olsrd") or die;
|
||||
|
||||
while(defined ($line = <IN>))
|
||||
|
@ -510,13 +503,6 @@ unless($auto)
|
|||
{
|
||||
print "configuration complete.\n";
|
||||
print "you should now reboot the router.\n";
|
||||
|
||||
if($config eq "client")
|
||||
{
|
||||
print "\nCurrent ssid setting in /etc/config/wireless:\n";
|
||||
system "grep ssid /etc/config/wireless";
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
|
|
@ -84,7 +84,7 @@ $node = nvram_get("node");
|
|||
$node = "NOCALL" if $node eq "";
|
||||
$tactical = nvram_get("tactical");
|
||||
$config = nvram_get("config");
|
||||
$config = "not set" if $config eq "" or not -d "/etc/config.$config";
|
||||
$config = "not set" if $config eq "" or not -d "/etc/config.mesh";
|
||||
($my_ip) = get_ip4_network(get_interface("wifi"));
|
||||
|
||||
chomp ($chanbw = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/chanbw`);
|
||||
|
@ -123,7 +123,7 @@ foreach(`echo /all | nc 127.0.0.1 2006 2>$tmperr`)
|
|||
$mac =~ s/^.*(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).*$/$1/;
|
||||
chomp $mac;
|
||||
|
||||
if (! $mac or ! -e "/sys/kernel/debug/ieee80211/phy0/netdev:wlan0/stations/$mac" )
|
||||
if (! $mac or ! -e "/sys/kernel/debug/ieee80211/phy0/netdev:wlan0/stations/$mac" )
|
||||
{
|
||||
$mbps = "";
|
||||
}
|
||||
|
@ -131,28 +131,28 @@ foreach(`echo /all | nc 127.0.0.1 2006 2>$tmperr`)
|
|||
{
|
||||
#802.11n
|
||||
$mbps = `egrep 'HT(4|2)0\\\/\(L|S\)GI[ \t]+(A|T)' /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations/$mac/rc_stats`;
|
||||
if ($mbps)
|
||||
{
|
||||
$mbps =~ /HT[42]0\/([LS]GI)[ \tTtPABCD]+(MCS[0-9]+)[ \t]*[0-9\.]+[ \t]*([0-9\.]+).*$/ ;
|
||||
$mbps = $1 eq "LGI" ? $rateL{$2}*$3/100 : $rateS{$2}*$3/100 ;
|
||||
if ($mbps)
|
||||
{
|
||||
$mbps =~ /HT[42]0\/([LS]GI)[ \tTtPABCD]+(MCS[0-9]+)[ \t]*[0-9\.]+[ \t]*([0-9\.]+).*$/ ;
|
||||
$mbps = $1 eq "LGI" ? $rateL{$2}*$3/100 : $rateS{$2}*$3/100 ;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
#802.11a/g
|
||||
$mbps = `egrep \"^A[BCDP \t]+[0-9\.]+\" /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations/$mac/rc_stats`;
|
||||
if ($mbps)
|
||||
{
|
||||
$mbps =~ /^A[ \tBCDP]+([0-9\.]+)[ \t]+[0-9\.]+[ \t]+([0-9\.]+).*$/;
|
||||
if ($mbps)
|
||||
{
|
||||
$mbps =~ /^A[ \tBCDP]+([0-9\.]+)[ \t]+[0-9\.]+[ \t]+([0-9\.]+).*$/;
|
||||
$mbps = $1*$2/100;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
#802.11b
|
||||
$mbps = `egrep \"CCK\/LP[ \t]*T\" /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations/$mac/rc_stats`;
|
||||
if ($mbps)
|
||||
{
|
||||
if ($mbps)
|
||||
{
|
||||
$mbps =~ /CCK\/LP[ \tTtP]+([0-9\.]+)M[ \t]*[0-9\.]+[ \t]*([0-9\.]+).*$/ ;
|
||||
$mbps = $1*$2/100;
|
||||
$mbps = $1*$2/100;
|
||||
}
|
||||
else { $mbps = "0"; }
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ foreach(`echo /all | nc 127.0.0.1 2006 2>$tmperr`)
|
|||
if ( ! $mbps eq "" )
|
||||
{
|
||||
$mbps /= $chanbw;
|
||||
$links{$ip}{mbps} = sprintf "%.1f",$mbps;
|
||||
$links{$ip}{mbps} = sprintf "%.1f",$mbps;
|
||||
}
|
||||
else { $links{$ip}{mbps} = "0.0"; }
|
||||
}
|
||||
|
@ -223,29 +223,29 @@ 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 !~ /\./ ) || ( $name =~ /^mid\.[^\.]*$/ )) { $name="${name}.local.mesh"; }
|
||||
|
||||
|
||||
if ( $ip eq $originator )
|
||||
{
|
||||
if($hosts{$ip}{name}) { $hosts{$ip}{tactical} = $name }
|
||||
else
|
||||
{
|
||||
$hosts{$ip}{name} = $name;
|
||||
if($hosts{$ip}{name}) { $hosts{$ip}{tactical} = $name }
|
||||
else
|
||||
{
|
||||
$hosts{$ip}{name} = $name;
|
||||
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
|
||||
else { $hosts{$ip}{etx} = "99.000"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $name =~ /^dtdlink\..*$/ )
|
||||
{
|
||||
elsif ( $name =~ /^dtdlink\..*$/ )
|
||||
{
|
||||
$hosts{$ip}{name} = $name;
|
||||
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
|
||||
else { $hosts{$ip}{etx} = "99.000"; }
|
||||
$dtd{$originator} = 1 ;
|
||||
$dtd{$originator} = 1 ;
|
||||
}
|
||||
elsif ( $name =~ /^mid\d+\..*$/ )
|
||||
{
|
||||
$midcount{$originator} = $midcount{$originator} ? $midcount{$originator}+1: 1 ;
|
||||
elsif ( $name =~ /^mid\d+\..*$/ )
|
||||
{
|
||||
$midcount{$originator} = $midcount{$originator} ? $midcount{$originator}+1: 1 ;
|
||||
if (! $hosts{$ip}{name} )
|
||||
{
|
||||
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
|
||||
|
@ -311,7 +311,7 @@ if(-f "/tmp/web/automesh")
|
|||
{
|
||||
print "<input type=submit name=stop value=Stop title='Abort continuous status'>\n";
|
||||
}
|
||||
elsif($config eq "mesh")
|
||||
else
|
||||
{
|
||||
print "<input type=submit name=refresh value=Refresh title='Refresh this page'>\n";
|
||||
print " \n";
|
||||
|
@ -321,15 +321,7 @@ elsif($config eq "mesh")
|
|||
print "  ";
|
||||
print "<button type=button onClick='window.location=\"status\"' title='Return to the status page'>Quit</button>\n";
|
||||
|
||||
if($config ne "mesh")
|
||||
{
|
||||
print "<br><br><b>This page is available only when the router is acting as a Mesh Node.</b>\n";
|
||||
print "</center></form>";
|
||||
page_footer();
|
||||
print "</body></html>\n";
|
||||
exit;
|
||||
}
|
||||
elsif($txtinfo_err)
|
||||
if($txtinfo_err)
|
||||
{
|
||||
print "<br><br><b>Whoops! OLSR is not running, try again later.</b>\n";
|
||||
print "</center></form>";
|
||||
|
@ -414,8 +406,8 @@ foreach $ip (keys %hosts)
|
|||
next if $ipalias{$ip};
|
||||
|
||||
$isNeig=0;
|
||||
foreach $aip (keys %ipalias)
|
||||
{
|
||||
foreach $aip (keys %ipalias)
|
||||
{
|
||||
if ($ipalias{$aip} eq $ip ) { if ($links{$aip} ) { $isNeig=1; last;} }
|
||||
}
|
||||
next if $isNeig;
|
||||
|
@ -428,9 +420,9 @@ foreach $ip (keys %hosts)
|
|||
$rows{$host} = sprintf "<tr><td valign=top><nobr><a href='http://%s:8080/'>%s</a>", $host, $host . $tactical;
|
||||
|
||||
undef $nodeiface;
|
||||
#if ( $dtd{$ip} )
|
||||
#{
|
||||
#$nodeiface = "dtd";
|
||||
#if ( $dtd{$ip} )
|
||||
#{
|
||||
#$nodeiface = "dtd";
|
||||
#if ( $midcount{$ip} ) { $midcount{$ip} -= 1; } # extra mid entry matching and with dtdlink in hosts_olsrd
|
||||
#}
|
||||
#if ( $hosts{$ip}{tactical} ) { $midcount{$ip} -= 1; } # extra mid entry if tactical name defined
|
||||
|
@ -438,7 +430,7 @@ foreach $ip (keys %hosts)
|
|||
if ( $wangateway{$ip} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; }
|
||||
|
||||
if ( $nodeiface ) { $rows{$host} .= " <small>($nodeiface)</small>"; }
|
||||
|
||||
|
||||
$rows{$host} .= sprintf "</nobr></td><td></td><td align=right valign=top>%s</td><td></td><td>\n", $etx;
|
||||
foreach(sort keys %{$services{$host}})
|
||||
{
|
||||
|
@ -497,7 +489,7 @@ if(keys %links)
|
|||
{
|
||||
if ( $hosts{$ip}{name} =~ /^dtdlink\..*$/ ){ $nodeiface="dtd" ; }
|
||||
#elsif ( $hosts{$ip}{name} =~ /^mid\d+\..*$/ ) { $nodeiface="tun" ; }
|
||||
#else { $nodeiface="?" ; }
|
||||
#else { $nodeiface="?" ; }
|
||||
}
|
||||
|
||||
if ( $wangateway{$ip} or $wangateway{$ipmain} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; }
|
||||
|
@ -508,7 +500,7 @@ if(keys %links)
|
|||
if ( ! exists $neighservices{$host} )
|
||||
{
|
||||
foreach(sort keys %{$services{$host}}) { $rows{$host} .= "<nobr>" . $services{$host}{$_} . "</nobr><br>\n" }
|
||||
|
||||
|
||||
$rows{$host} .= "</td></tr>\n";
|
||||
|
||||
# add advertised dmz hosts
|
||||
|
@ -599,13 +591,13 @@ if($debug)
|
|||
printf "/%s", $hosts{$ip}{tactical} if $hosts{$ip}{tactical};
|
||||
foreach(@{$hosts{$ip}{hosts}}) { print ":$_" }
|
||||
printf(" %d", $hosts{$ip}{mid}) if $hosts{$ip}{mid};
|
||||
}
|
||||
}
|
||||
|
||||
print "\nlinks\n";
|
||||
foreach(sort keys %links)
|
||||
{
|
||||
print "$_\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "</pre>\n";
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ $node = nvram_get("node");
|
|||
$node = "NOCALL" if $node eq "";
|
||||
read_postdata();
|
||||
|
||||
if($config eq "" or -e "/tmp/reboot-required")
|
||||
if($config ne "mesh" or -e "/tmp/reboot-required")
|
||||
{
|
||||
http_header();
|
||||
html_header("$node setup", 1);
|
||||
|
@ -61,7 +61,7 @@ if($config eq "" or -e "/tmp/reboot-required")
|
|||
}
|
||||
else
|
||||
{
|
||||
print "The configuration has been changed.<br>This page will not be available until the node is rebooted.\n";
|
||||
print "The specified configuration is invalid, try flushing your browser cache or reboot the mesh node.\n";
|
||||
}
|
||||
print "</b></td></tr>\n";
|
||||
print "</table></center>";
|
||||
|
@ -80,21 +80,18 @@ else { $dmz_mode = 0 }
|
|||
|
||||
$lannet_d = ip2decimal($lannet);
|
||||
|
||||
|
||||
$tmpdir = "/tmp/web/ports";
|
||||
system "rm -rf $tmpdir" unless $parms{reload};
|
||||
system "mkdir -p $tmpdir";
|
||||
|
||||
$portfile = "/etc/config.$config/_setup.ports";
|
||||
$dhcpfile = "/etc/config.$config/_setup.dhcp";
|
||||
$servfile = "/etc/config.$config/_setup.services";
|
||||
if($config eq "mesh")
|
||||
{
|
||||
my $suffix = $dmz_mode ? ".dmz" : ".nat";
|
||||
$portfile .= $suffix;
|
||||
$dhcpfile .= $suffix;
|
||||
$servfile .= $suffix;
|
||||
}
|
||||
$portfile = "/etc/config.mesh/_setup.ports";
|
||||
$dhcpfile = "/etc/config.mesh/_setup.dhcp";
|
||||
$servfile = "/etc/config.mesh/_setup.services";
|
||||
|
||||
my $suffix = $dmz_mode ? ".dmz" : ".nat";
|
||||
$portfile .= $suffix;
|
||||
$dhcpfile .= $suffix;
|
||||
$servfile .= $suffix;
|
||||
|
||||
# if a reset or a first time page load
|
||||
# read the data from the config files
|
||||
|
@ -177,7 +174,6 @@ if($parms{button_reset} or not $parms{reload})
|
|||
($rc, $dhcp_limit) = &uci_get_indexed_option("dhcp","dhcp","0","limit");
|
||||
$dhcp_end = $dhcp_start + $dhcp_limit - 1;
|
||||
|
||||
|
||||
#
|
||||
# load and validate the ports
|
||||
#
|
||||
|
@ -342,7 +338,7 @@ foreach $val (@list)
|
|||
}
|
||||
|
||||
next if $val eq "_add" and @dhcp_err and $dhcp_err[-1] =~ /^$val /;
|
||||
|
||||
|
||||
# commit the data for this reservation
|
||||
++$dhcp_num;
|
||||
#print FILE "$mac $ip $host\n";
|
||||
|
@ -353,7 +349,7 @@ foreach $val (@list)
|
|||
$hosts{$host} = 1;
|
||||
$addrs{$ip} = 1;
|
||||
$macs{$mac} = 1;
|
||||
|
||||
|
||||
if($val eq "_add")
|
||||
{
|
||||
$parms{dhcp_add_host} = "";
|
||||
|
@ -443,7 +439,7 @@ foreach $val (@list)
|
|||
# remove services that have had their host or port deleted
|
||||
#next if $val ne "_add" and not ($dmz_mode ? $hosts{$host} : $usedports{$port});
|
||||
next if $val ne "_add" and not ($dmz_mode ? $hosts{$host} : 1 );
|
||||
|
||||
|
||||
$link = $parms{"serv${val}_link"};
|
||||
$link = 0 unless $link;
|
||||
|
||||
|
@ -487,7 +483,7 @@ foreach $val (@list)
|
|||
}
|
||||
|
||||
next if $val eq "_add" and @serv_err and $serv_err[-1] =~ /^_add /;
|
||||
|
||||
|
||||
# commit the data for this service
|
||||
++$serv_num;
|
||||
$servicenames{$name} = 1;
|
||||
|
@ -517,16 +513,13 @@ if($parms{button_save} and not (@port_err or @dhcp_err or @dmz_err or @serv_err)
|
|||
system "cp -f $tmpdir/ports $portfile";
|
||||
system "cp -f $tmpdir/dhcp $dhcpfile";
|
||||
system "cp -f $tmpdir/services $servfile";
|
||||
push(@errors, "problem with configuration") if system "/usr/local/bin/node-setup -a -p $config";
|
||||
push(@errors, "problem with configuration") if system "/usr/local/bin/node-setup -a -p mesh";
|
||||
|
||||
unless($debug == 3)
|
||||
{
|
||||
push(@errors, "problem with dnsmasq") if system "/etc/init.d/dnsmasq reload >/dev/null 2>&1";
|
||||
push(@errors, "problem with port setup") if system "/etc/init.d/firewall reload >/dev/null 2>&1";
|
||||
if($config eq "mesh")
|
||||
{
|
||||
push(@errors, "problem with olsr setup") if system "/etc/init.d/olsrd restart >/dev/null 2>&1";
|
||||
}
|
||||
push(@errors, "problem with olsr setup") if system "/etc/init.d/olsrd restart >/dev/null 2>&1";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,12 +588,9 @@ if($dmz_mode)
|
|||
&print_reservations();
|
||||
print "</td>\n";
|
||||
|
||||
if($config eq "mesh")
|
||||
{
|
||||
print "<td> </td><td align=center valign=top>\n";
|
||||
&print_services();
|
||||
print "</td>\n";
|
||||
}
|
||||
print "<td> </td><td align=center valign=top>\n";
|
||||
&print_services();
|
||||
print "</td>\n";
|
||||
|
||||
print "</tr></table></td></tr>\n";
|
||||
print "<tr><td> </td></tr>\n";
|
||||
|
@ -616,12 +606,9 @@ else
|
|||
&print_forwarding();
|
||||
print "</td>\n";
|
||||
|
||||
if($config eq "mesh")
|
||||
{
|
||||
print "<td> </td><td align=center valign=top>\n";
|
||||
&print_services();
|
||||
print "</td>\n";
|
||||
}
|
||||
print "<td> </td><td align=center valign=top>\n";
|
||||
&print_services();
|
||||
print "</td>\n";
|
||||
|
||||
print "</tr></table></td></tr>\n";
|
||||
print "<tr><td> </td></tr>\n";
|
||||
|
@ -685,16 +672,12 @@ sub print_forwarding
|
|||
|
||||
# port forwarding settings
|
||||
print "<td align=center valign=top><select name=port${val}_intf title='forward inbound packets from this interface'>\n";
|
||||
if($config eq "mesh" and not $dmz_mode)
|
||||
unless ($dmz_mode)
|
||||
{
|
||||
selopt("WiFi", "wifi", $intf);
|
||||
selopt("WAN", "wan", $intf);
|
||||
selopt("Both", "both", $intf);
|
||||
}
|
||||
elsif($config eq "client")
|
||||
{
|
||||
selopt("WiFi", "wifi", $intf);
|
||||
}
|
||||
else
|
||||
{
|
||||
selopt("WAN", "wan", $intf);
|
||||
|
@ -734,7 +717,7 @@ sub print_forwarding
|
|||
{
|
||||
$err = shift @port_err;
|
||||
$err =~ s/^\S+ //;
|
||||
print "<tr><th colspan=7>$err</th></tr>\n";
|
||||
print "<tr><th colspan=7>$err</th></tr>\n";
|
||||
}
|
||||
|
||||
print "<tr><td colspan=7 height=5></td></tr>\n";
|
||||
|
@ -771,7 +754,7 @@ sub print_reservations
|
|||
print "<tr><td colspan=4 height=5></td></tr>\n";
|
||||
print "<tr><td align=center>Hostname</td><td align=center>IP Address</td><td align=center>MAC Address</td><td></td></tr>\n";
|
||||
print "<tr><td colspan=4 height=5></td></tr>\n";
|
||||
|
||||
|
||||
for($i = 1, @list = (); $i <= $parms{dhcp_num}; ++$i) { push @list, $i }
|
||||
push @list, "_add";
|
||||
|
||||
|
@ -784,7 +767,7 @@ sub print_reservations
|
|||
|
||||
print "<tr><td colspan=4 height=10></td></tr>\n" if $val eq "_add" and scalar(@list) > 1;
|
||||
print "<tr><td><input type=text name=dhcp${val}_host value='$host' size=10></td>\n";
|
||||
|
||||
|
||||
print "<td align=center><select name=dhcp${val}_ip>\n";
|
||||
print "<option value=''>- IP Address -</option>\n" if $val eq "_add";
|
||||
for($i = $dhcp_start; $i <= $dhcp_end; $i++)
|
||||
|
@ -810,7 +793,7 @@ sub print_reservations
|
|||
{
|
||||
$err = shift @dhcp_err;
|
||||
$err =~ s/^\S+ //;
|
||||
print "<tr><th colspan=4>$err</th></tr>\n";
|
||||
print "<tr><th colspan=4>$err</th></tr>\n";
|
||||
}
|
||||
|
||||
print "<tr><td height=5></td></tr>\n";
|
||||
|
@ -927,7 +910,7 @@ sub print_services
|
|||
|
||||
print "<tr><td colspan=4 height=4></td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -54,14 +54,9 @@ $pingOk=is_online();
|
|||
|
||||
read_postdata();
|
||||
|
||||
($config = $parms{config}) or
|
||||
($config = nvram_get("config") and -d "/etc/config.$config") or
|
||||
($config = "mesh");
|
||||
|
||||
my $tz_db_strings = tz_names_hash();
|
||||
my $tz_db_names = tz_names_array();
|
||||
|
||||
|
||||
if($parms{button_uploaddata})
|
||||
{
|
||||
my $si=`curl 'http://localnode:8080/cgi-bin/sysinfo.json?hosts=1' 2>/dev/null`;
|
||||
|
@ -74,7 +69,7 @@ if($parms{button_uploaddata})
|
|||
chomp($topo);
|
||||
# add topo subdoc and close root doc
|
||||
my $newsi= sprintf "%s,\"olsr\": %s}",$si, $topo;
|
||||
|
||||
|
||||
# PUT it to the server
|
||||
my $upcurl=`curl -H 'Accept: application/json' -X PUT -d '$newsi' http://data.aredn.org/sysinfo`;
|
||||
if($? == 0) {
|
||||
|
@ -87,7 +82,7 @@ if($parms{button_uploaddata})
|
|||
# convert the %parms into scalars for convenience
|
||||
if($parms{button_default})
|
||||
{
|
||||
load_cfg("/etc/config.$config/_setup.default");
|
||||
load_cfg("/etc/config.mesh/_setup.default");
|
||||
foreach(keys %cfg)
|
||||
{
|
||||
eval (sprintf "\$$_ = \"%s\"", quotemeta $cfg{$_});
|
||||
|
@ -103,9 +98,9 @@ else
|
|||
eval (sprintf "\$$_ = \"%s\"", quotemeta $parms{$_});
|
||||
}
|
||||
|
||||
if($button_reset or $config ne $oldconfig)
|
||||
if($button_reset or not keys %parms)
|
||||
{
|
||||
load_cfg("/etc/config.$config/_setup");
|
||||
load_cfg("/etc/config.mesh/_setup");
|
||||
foreach(keys %cfg)
|
||||
{
|
||||
eval (sprintf "\$$_ = \"%s\"", quotemeta $cfg{$_});
|
||||
|
@ -135,7 +130,6 @@ $lan_proto = "static";
|
|||
|
||||
# enforce direct mode settings
|
||||
# (formerly known as dmz mode)
|
||||
$dmz_mode = 0 unless $config eq "mesh";
|
||||
$dmz_mode = 2 if $dmz_mode != 0 and $dmz_mode < 2;
|
||||
$dmz_mode = 4 if $dmz_mode > 4;
|
||||
|
||||
|
@ -221,7 +215,7 @@ if($parms{button_updatelocation})
|
|||
push @errors, "ERROR: Gridsquare format is: 2-uppercase letters, 2-digits, 2-lowercase letters. (AB12cd)\n";
|
||||
}
|
||||
} else {
|
||||
unlink("/etc/gridsquare") if(-f "/etc/gridsquare");
|
||||
unlink("/etc/gridsquare") if(-f "/etc/gridsquare");
|
||||
push @output, "Gridsquare purged.\n";
|
||||
}
|
||||
|
||||
|
@ -231,7 +225,7 @@ if($parms{button_updatelocation})
|
|||
# validate values
|
||||
if($parms{latitude} =~ /^([-+]?\d{1,2}([.]\d+)?)$/ and $parms{longitude} =~ /^([-+]?\d{1,3}([.]\d+)?)$/) {
|
||||
# delete/define file
|
||||
unlink("/etc/latlon") if(-f "/etc/latlon");
|
||||
unlink("/etc/latlon") if(-f "/etc/latlon");
|
||||
$rcgood=open(my $ll, ">", "/etc/latlon");
|
||||
push @errors, "Cannot open lat/lon file" unless $rcgood;
|
||||
print $ll "$parms{latitude}\n";
|
||||
|
@ -242,7 +236,7 @@ if($parms{button_updatelocation})
|
|||
push @errors, "ERROR: Lat/lon format is decimal: (ex. 30.121456 or -95.911154)\n";
|
||||
}
|
||||
} else {
|
||||
unlink("/etc/latlon") if(-f "/etc/latlon");
|
||||
unlink("/etc/latlon") if(-f "/etc/latlon");
|
||||
push @output, "Lat/lon purged.\n";
|
||||
}
|
||||
}
|
||||
|
@ -284,33 +278,25 @@ if($parms{button_save})
|
|||
$time_zone = $$tz_db_strings{$time_zone_name};
|
||||
$parms{time_zone} = $time_zone;
|
||||
|
||||
if($wifi_proto eq "static")
|
||||
if(not validate_netmask($wifi_mask))
|
||||
{
|
||||
if(not validate_netmask($wifi_mask))
|
||||
{
|
||||
push @errors, "invalid WiFi netmask";
|
||||
}
|
||||
elsif(not validate_ip_netmask($wifi_ip, $wifi_mask))
|
||||
{
|
||||
push @errors, "invalid WiFi IP address";
|
||||
}
|
||||
push @errors, "invalid Mesh netmask";
|
||||
}
|
||||
elsif(not validate_ip_netmask($wifi_ip, $wifi_mask))
|
||||
{
|
||||
push @errors, "invalid Mesh IP address";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
push (@errors, "invalid Mesh RF SSID") unless length $wifi_ssid <= 27;
|
||||
|
||||
if ( is_channel_valid($wifi_channel) != 1 )
|
||||
{
|
||||
push (@errors, "invalid WiFi channel")
|
||||
push (@errors, "invalid Mesh RF channel")
|
||||
}
|
||||
|
||||
if ( !is_wifi_chanbw_valid($wifi_chanbw,$wifi_ssid) )
|
||||
{
|
||||
push (@errors, "Invalid WiFi channel width");
|
||||
push (@errors, "Invalid Mesh RF channel width");
|
||||
$wifi_chanbw = 20;
|
||||
}
|
||||
|
||||
|
@ -325,7 +311,7 @@ if($parms{button_save})
|
|||
$wifi_country="00";
|
||||
push (@errors, "Invalid country");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($lan_proto eq "static")
|
||||
{
|
||||
|
@ -367,7 +353,7 @@ if($parms{button_save})
|
|||
}
|
||||
|
||||
if($lan_gw and not
|
||||
(validate_ip_netmask($lan_gw, $lan_mask) and
|
||||
(validate_ip_netmask($lan_gw, $lan_mask) and
|
||||
validate_same_subnet($lan_ip, $lan_gw, $lan_mask)))
|
||||
{
|
||||
push @errors, "invalid LAN gateway";
|
||||
|
@ -387,14 +373,14 @@ if($parms{button_save})
|
|||
}
|
||||
else
|
||||
{
|
||||
unless (validate_ip_netmask($wan_gw, $wan_mask) and
|
||||
unless (validate_ip_netmask($wan_gw, $wan_mask) and
|
||||
validate_same_subnet($wan_ip, $wan_gw, $wan_mask))
|
||||
{
|
||||
push @errors, "invalid WAN gateway";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
push (@errors, "invalid WAN DNS 1") unless validate_ip($wan_dns1);
|
||||
push (@errors, "invalid WAN DNS 2") if $wan_dns2 ne "" and not validate_ip($wan_dns2);
|
||||
|
||||
|
@ -449,7 +435,7 @@ if($parms{button_save})
|
|||
$parms{node} = $node;
|
||||
$parms{tactical} = $tactical;
|
||||
system "touch /tmp/unconfigured" if -f "/etc/config/unconfigured";
|
||||
$rc = save_setup("/etc/config.$config/_setup");
|
||||
$rc = save_setup("/etc/config.mesh/_setup");
|
||||
if(-s "/tmp/web/save/node-setup.out")
|
||||
{
|
||||
push @errors, `cat /tmp/web/save/node-setup.out`;
|
||||
|
@ -515,14 +501,14 @@ function updDist(x) {
|
|||
var xcm=dvs['miles'];
|
||||
var xc=dvs['meters'];
|
||||
var xck=dvs['kilometers'];
|
||||
|
||||
|
||||
var distBox = document.getElementById('dist');
|
||||
var dist_meters=document.getElementsByName('wifi_distance')[0];
|
||||
document.getElementsByName('wifi_distance_disp_miles')[0].value = xcm;
|
||||
document.getElementsByName('wifi_distance_disp_km')[0].value = xck;
|
||||
document.getElementsByName('wifi_distance_disp_meters')[0].value = xc;
|
||||
dist_meters.value = xc;
|
||||
|
||||
dist_meters.value = xc;
|
||||
|
||||
// if default, then ALERT!
|
||||
if(dist_meters.value==0) {
|
||||
distBox.className = 'dist-alert';
|
||||
|
@ -630,7 +616,7 @@ print "<table cellpadding=5 border=0>
|
|||
<td align=right>Password</td>
|
||||
<td><input type=password name=passwd1 value='$passwd1' size=8 tabindex=2></td>";
|
||||
|
||||
if(0)#$config eq "mesh")
|
||||
if(0)# disable for now
|
||||
{
|
||||
print "<td> </td>";
|
||||
print "<td align=right>Latitude</td>";
|
||||
|
@ -640,192 +626,89 @@ if(0)#$config eq "mesh")
|
|||
print "
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Node Type</td>
|
||||
<td><select name=config onChange='form.submit()' tabindex=6>\n";
|
||||
selopt("Mesh Node", "mesh", $config);
|
||||
selopt("Mesh Access Point", "mesh_ap", $config);
|
||||
selopt("Standard Access Point", "ap", $config);
|
||||
selopt("Wireless Client", "client", $config);
|
||||
selopt("Wired Router", "router", $config);
|
||||
#selopt("User", "user", $config, "disabled");
|
||||
$oldconfig = $config;
|
||||
print "</select></td>
|
||||
<td> </td>
|
||||
<td> </td>";
|
||||
push @hidden, "<input type=hidden name=config value='mesh'>";
|
||||
print "
|
||||
<td>Verify Password</td>
|
||||
<td><input type=password name=passwd2 value='$passwd2' size=8 tabindex=3></td>";
|
||||
|
||||
print "
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr>";
|
||||
|
||||
if($config ne "mesh")
|
||||
{
|
||||
print "<tr><td align=center>";
|
||||
print "<b>This node type will be removed in a future release -- See release notes</b>";
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
print "<tr><td><br>";
|
||||
print "<table cellpadding=5 border=1 width=100%><tr><td valign=top width=33%>\n";
|
||||
|
||||
#
|
||||
# WiFi settings
|
||||
# MESH RF settings
|
||||
#
|
||||
|
||||
print "<table width=100% style='border-collapse: collapse;'>
|
||||
<tr><th colspan=2>WiFi</th></tr>
|
||||
<tr><td>Protocol</td>
|
||||
<td>";
|
||||
<tr><th colspan=2>Mesh RF</th></tr>";
|
||||
|
||||
#if($config ne "user" and $config ne "client")
|
||||
if($config ne "user")
|
||||
{
|
||||
push @hidden, "<input type=hidden name=wifi_proto value='$wifi_proto'>";
|
||||
print "<select name=wifi_proto disabled>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<select name=wifi_proto onChange='form.submit()'>\n";
|
||||
push @hidden, "<input type=hidden name=wifi_proto value='static'>";
|
||||
|
||||
print "<tr><td><nobr>IP Address</nobr></td>\n";
|
||||
print "<td><input type=text size=15 name=wifi_ip value='$wifi_ip'></td></tr>\n";
|
||||
print "<tr><td>Netmask</td>\n";
|
||||
print "<td><input type=text size=15 name=wifi_mask value='$wifi_mask'></td></tr>\n";
|
||||
|
||||
# Reset wifi channel/bandwidth to default
|
||||
if ( -f "/etc/config/unconfigured" || $parms{button_reset} ) {
|
||||
my $defaultwifi = rf_default_channel();
|
||||
$wifi_channel = $defaultwifi->{'channel'};
|
||||
$wifi_chanbw = $defaultwifi->{'chanbw'};
|
||||
}
|
||||
|
||||
$dis = "";
|
||||
$dis = "disabled" if $config eq "client";
|
||||
selopt("Static", "static", $wifi_proto);
|
||||
selopt("DHCP", "dhcp", $wifi_proto);
|
||||
selopt("Bridged", "bridged", $wifi_proto, $dis);
|
||||
selopt("disabled", "disabled", $wifi_proto, $dis);
|
||||
print "</select></td>\n</tr>\n";
|
||||
if($wifi_proto eq "static")
|
||||
print "<tr><td>SSID</td>\n";
|
||||
print "<td><input type=text size=15 name=wifi_ssid value='$wifi_ssid'>";
|
||||
print "-$wifi_chanbw-v3</td></tr>\n";
|
||||
|
||||
push @hidden, "<input type=hidden name=wifi_mode value='$wifi_mode'>";
|
||||
|
||||
print "<tr><td>Channel</td>\n";
|
||||
print "<td><select name=wifi_channel>\n";
|
||||
my $rfchannels=rf_channels_list();
|
||||
foreach $channelnumber (sort {$a <=> $b} keys %{$rfchannels} )
|
||||
{
|
||||
print "<tr><td><nobr>IP Address</nobr></td>\n";
|
||||
print "<td><input type=text size=15 name=wifi_ip value='$wifi_ip'></td></tr>\n";
|
||||
print "<tr><td>Netmask</td>\n";
|
||||
print "<td><input type=text size=15 name=wifi_mask value='$wifi_mask'></td></tr>\n";
|
||||
selopt($rfchannels->{$channelnumber}, $channelnumber, $wifi_channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
push @hidden, "<input type=hidden name=wifi_ip value='$wifi_ip'>";
|
||||
push @hidden, "<input type=hidden name=wifi_mask value='$wifi_mask'>";
|
||||
}
|
||||
if($wifi_proto ne "disabled")
|
||||
{
|
||||
print "</select></td></tr>\n";
|
||||
|
||||
# Reset wifi channel/bandwidth to default
|
||||
if ( -f "/etc/config/unconfigured" || $parms{button_reset} ) {
|
||||
my $defaultwifi = rf_default_channel();
|
||||
$wifi_channel = $defaultwifi->{'channel'};
|
||||
$wifi_chanbw = $defaultwifi->{'chanbw'};
|
||||
}
|
||||
print "<tr><td>Channel Width</td>\n";
|
||||
print "<td><select name=wifi_chanbw>\n";
|
||||
selopt("20 MHz","20",$wifi_chanbw);
|
||||
selopt("10 MHz","10",$wifi_chanbw);
|
||||
selopt("5 MHz","5",$wifi_chanbw);
|
||||
print "</select></td></tr>\n";
|
||||
|
||||
print "<tr><td>SSID</td>\n";
|
||||
print "<td><input type=text size=15 name=wifi_ssid value='$wifi_ssid'>";
|
||||
if ($config eq "mesh")
|
||||
{
|
||||
print "-$wifi_chanbw-v3</td></tr>\n";
|
||||
} else
|
||||
{
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
push (@hidden, "<input type=hidden name=wifi_country value='HX'>");
|
||||
|
||||
if($wifi_mode eq "ap")
|
||||
{
|
||||
print "<tr><td>Hidden</td>";
|
||||
print "<td><input type=checkbox name=wifi_hidden value=1";
|
||||
print " checked" if $wifi_hidden;
|
||||
print "></td></tr>\n";
|
||||
}
|
||||
print "<tr><td colspan=2 align=center><hr><small>Active Settings</small></td></tr>\n";
|
||||
|
||||
print "<tr><td>Mode</td>\n";
|
||||
print "<tr><td><nobr>Tx Power</nobr></td>\n";
|
||||
print "<td><select name=wifi_txpower>\n";
|
||||
my $txpoweroffset = wifi_txpoweroffset();
|
||||
for($i = wifi_maxpower($wifi_channel); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) }
|
||||
print "</select> <a href=\"/help.html\#power\" target=\"_blank\"><img src=\"/qmark.png\"></a></td></tr>\n";
|
||||
|
||||
if($config ne "user")
|
||||
{
|
||||
push @hidden, "<input type=hidden name=wifi_mode value='$wifi_mode'>";
|
||||
print "<td><select name=wifi_mode disabled>\n";
|
||||
} else {
|
||||
print "<td><select name=wifi_mode>\n";
|
||||
}
|
||||
print "<tr id='dist' class='dist-norm'><td>Distance to<br />FARTHEST Neighbor</td>\n";
|
||||
|
||||
selopt("Access Point", "ap", $wifi_mode);
|
||||
selopt("Client", "sta", $wifi_mode);
|
||||
selopt("Ad-Hoc", "adhoc", $wifi_mode);
|
||||
print "</select></td></tr>\n";
|
||||
$wifi_distance=int($wifi_distance); # in meters
|
||||
$wifi_distance_disp_km=int($wifi_distance/1000);
|
||||
$wifi_distance_disp_miles=sprintf("%.2f",$wifi_distance_disp_km*.621371192);
|
||||
|
||||
if($wifi_mode ne "sta")
|
||||
{
|
||||
print "<tr><td>Channel</td>\n";
|
||||
print "<td><select name=wifi_channel>\n";
|
||||
my $rfchannels=rf_channels_list();
|
||||
foreach $channelnumber (sort {$a <=> $b} keys %{$rfchannels} )
|
||||
{
|
||||
selopt($rfchannels->{$channelnumber}, $channelnumber, $wifi_channel);
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @hidden, "<input type=hidden name=wifi_channel value='$wifi_channel'>";
|
||||
}
|
||||
print "<td><input disabled size=6 type=text name='wifi_distance_disp_miles' value='$wifi_distance_disp_miles' title='Distance to the farthest neighbor'> miles<br />";
|
||||
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_km' value='$wifi_distance_disp_km' title='Distance to the farthest neighbor'> kilometers<br />";
|
||||
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_meters' value='$wifi_distance' title='Distance to the farthest neighbor'> meters<br />";
|
||||
|
||||
{
|
||||
print "<tr><td>Channel Width</td>\n";
|
||||
print "<td><select name=wifi_chanbw>\n";
|
||||
selopt("20 MHz","20",$wifi_chanbw);
|
||||
selopt("10 MHz","10",$wifi_chanbw);
|
||||
selopt("5 MHz","5",$wifi_chanbw);
|
||||
print "</select></td></tr>\n";
|
||||
}
|
||||
print "<input id='distance_slider' type='range' min='0' max='150' step='1' value='$wifi_distance_disp_km' oninput='updDist(this.value)' onchange='updDist(this.value)' /><br />";
|
||||
print "<input type='hidden' size='6' name='wifi_distance' value='$wifi_distance' />";
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($config ne "mesh")
|
||||
{
|
||||
print "<tr><td>Country</td>\n";
|
||||
print "<td><select name=wifi_country>\n";
|
||||
foreach my $country (split(',',"00,HX,AD,AE,AL,AM,AN,AR,AT,AU,AW,AZ,BA,BB,BD,BE,BG,BH,BL,BN,BO,BR,BY,BZ,CA,CH,CL,CN,CO,CR,CY,CZ,DE,DK,DO,DZ,EC,EE,EG,ES,FI,FR,GE,GB,GD,GR,GL,GT,GU,HN,HK,HR,HT,HU,ID,IE,IL,IN,IS,IR,IT,JM,JP,JO,KE,KH,KP,KR,KW,KZ,LB,LI,LK,LT,LU,LV,MC,MA,MO,MK,MT,MY,MX,NL,NO,NP,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PR,QA,RO,RS,RU,RW,SA,SE,SG,SI,SK,SV,SY,TW,TH,TT,TN,TR,UA,US,UY,UZ,VE,VN,YE,ZA,ZW")) {
|
||||
selopt($country,$country,$wifi_country)
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@hidden, "<input type=hidden name=wifi_country value='HX'>");
|
||||
}
|
||||
|
||||
print "<tr><td colspan=2 align=center><hr><small>Active Settings</small></td></tr>\n";
|
||||
|
||||
print "<tr><td colspan=2><br>Antenna selection is now automatic<br><br></td></tr>";
|
||||
|
||||
print "<tr><td><nobr>Tx Power</nobr></td>\n";
|
||||
print "<td><select name=wifi_txpower>\n";
|
||||
my $txpoweroffset = wifi_txpoweroffset();
|
||||
for($i = wifi_maxpower($wifi_channel); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) }
|
||||
print "</select> <a href=\"/help.html\#power\" target=\"_blank\"><img src=\"/qmark.png\"></a></td></tr>\n";
|
||||
|
||||
print "<tr id='dist' class='dist-norm'><td>Distance to<br />FARTHEST Neighbor</td>\n";
|
||||
|
||||
$wifi_distance=int($wifi_distance); # in meters
|
||||
$wifi_distance_disp_km=int($wifi_distance/1000);
|
||||
$wifi_distance_disp_miles=sprintf("%.2f",$wifi_distance_disp_km*.621371192);
|
||||
|
||||
print "<td><input disabled size=6 type=text name='wifi_distance_disp_miles' value='$wifi_distance_disp_miles' title='Distance to the farthest neighbor'> miles<br />";
|
||||
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_km' value='$wifi_distance_disp_km' title='Distance to the farthest neighbor'> kilometers<br />";
|
||||
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_meters' value='$wifi_distance' title='Distance to the farthest neighbor'> meters<br />";
|
||||
|
||||
print "<input id='distance_slider' type='range' min='0' max='150' step='1' value='$wifi_distance_disp_km' oninput='updDist(this.value)' onchange='updDist(this.value)' /><br />";
|
||||
print "<input type='hidden' size='6' name='wifi_distance' value='$wifi_distance' />";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
print "<tr><td></td><td><input type=submit name=button_apply value=Apply title='Immediately use these active settings'></td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @hidden, "<input type=hidden name=wifi_ssid value='$wifi_ssid'>";
|
||||
push @hidden, "<input type=hidden name=wifi_mode value='$wifi_mode'>";
|
||||
push @hidden, "<input type=hidden name=wifi_channel value='$wifi_channel'>";
|
||||
push @hidden, "<input type=hidden name=wifi_chanbw value='20'>";
|
||||
push @hidden, "<input type=hidden name=wifi_country value='US'>";
|
||||
}
|
||||
print "<tr><td></td><td><input type=submit name=button_apply value=Apply title='Immediately use these active settings'></td></tr>\n";
|
||||
|
||||
print "</table></td>\n";
|
||||
|
||||
|
@ -838,7 +721,6 @@ print "<td valign=top width=33%><table width=100%>
|
|||
<tr>
|
||||
<td>LAN Mode</td>
|
||||
<td><select name=dmz_mode onChange='form.submit()'";
|
||||
print " disabled" unless $config eq "mesh";
|
||||
print ">\n";
|
||||
selopt("NAT", 0, $dmz_mode);
|
||||
selopt("1 host Direct", 2, $dmz_mode);
|
||||
|
@ -853,12 +735,12 @@ if($dmz_mode)
|
|||
#print "<td><input type=text size=15 name=dmz_lan_ip value='$dmz_lan_ip' disabled></td></tr>\n";
|
||||
print "<td>$dmz_lan_ip</td></tr>\n";
|
||||
push @hidden, "<input type=hidden name=dmz_lan_ip value='$dmz_lan_ip'>";
|
||||
|
||||
|
||||
print "<tr><td>Netmask</td>";
|
||||
#print "<td><input type=text size=15 name=dmz_lan_mask value='$dmz_lan_mask' disabled></td></tr>\n";
|
||||
print "<td>$dmz_lan_mask</td></tr>\n";
|
||||
push @hidden, "<input type=hidden name=dmz_lan_mask value='$dmz_lan_mask'>";
|
||||
|
||||
|
||||
print "<tr><td><nobr>DHCP Server</nobr></td>";
|
||||
print "<td><input type=checkbox name=lan_dhcp value=1";
|
||||
print " checked" if $lan_dhcp;
|
||||
|
@ -894,42 +776,27 @@ else
|
|||
{
|
||||
print "<tr><td><nobr>IP Address</nobr></td>";
|
||||
print "<td><input type=text size=15 name=lan_ip value='$lan_ip'></td></tr>\n";
|
||||
|
||||
|
||||
print "<tr><td>Netmask</td>";
|
||||
print "<td><input type=text size=15 name=lan_mask value='$lan_mask'></td></tr>\n";
|
||||
|
||||
if($wan_proto eq "disabled" and $wifi_proto ne "dhcp")
|
||||
|
||||
if($wan_proto eq "disabled")
|
||||
{
|
||||
print "<tr><td>Gateway</td>";
|
||||
print "<td><input type=text size=15 name=lan_gw value='$lan_gw' title='leave blank if not needed'></td></tr>\n";
|
||||
print "<td><input type=text size=15 name=lan_gw value='$lan_gw' title='leave blank if not needed'></td></tr>\n";
|
||||
}
|
||||
|
||||
print "<tr><td><nobr>DHCP Server</nobr></td>";
|
||||
print "<td><input type=checkbox name=lan_dhcp value=1";
|
||||
if($config eq "mesh_ap")
|
||||
{
|
||||
print " disabled";
|
||||
push @hidden, "<input type=hidden name=lan_dhcp value='$lan_dhcp'>";
|
||||
}
|
||||
print " checked" if $lan_dhcp;
|
||||
print "></td></tr>\n";
|
||||
|
||||
print "<tr><td><nobr>DHCP Start</nobr></td>";
|
||||
print "<td><input type=text size=4 name=dhcp_start value='$dhcp_start'";
|
||||
if($config eq "mesh_ap")
|
||||
{
|
||||
print " disabled";
|
||||
push @hidden, "<input type=hidden name=dhcp_start value='$dhcp_start'>";
|
||||
}
|
||||
print "></td></tr>\n";
|
||||
|
||||
print "<tr><td><nobr>DHCP End</nobr></td>";
|
||||
print "<td><input type=text size=4 name=dhcp_end value='$dhcp_end'";
|
||||
if($config eq "mesh_ap")
|
||||
{
|
||||
print " disabled";
|
||||
push @hidden, "<input type=hidden name=dhcp_end value='$dhcp_end'>";
|
||||
}
|
||||
print "></td></tr>\n";
|
||||
|
||||
print "<tr><td colspan=2><hr></hr></td></tr>";
|
||||
|
@ -948,7 +815,7 @@ else
|
|||
push @hidden, "<input type=hidden name=dmz_dhcp_end value='$dmz_dhcp_end'>";
|
||||
}
|
||||
|
||||
if($config eq "mesh" and 0) # disable for now
|
||||
if(0) # disable for now
|
||||
{
|
||||
print "<tr><td colspan=2><hr></td></tr>\n";
|
||||
print "<tr><td><nobr><i>Mesh Bridge</i></nobr></td>\n";
|
||||
|
@ -959,7 +826,6 @@ if($config eq "mesh" and 0) # disable for now
|
|||
|
||||
print "</table></td>\n";
|
||||
|
||||
|
||||
#
|
||||
# WAN settings
|
||||
#
|
||||
|
@ -969,15 +835,8 @@ print "<td valign=top width=33%><table width=100%>
|
|||
<tr>
|
||||
<td width=50%>Protocol</td>\n";
|
||||
|
||||
if($config ne "client" and $config ne "mesh_ap")
|
||||
{
|
||||
print "<td><select name=wan_proto onChange='form.submit()'>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @hidden, "<input type=hidden name=wan_proto value='$wan_proto'>";
|
||||
print "<td><select name=wan_proto disabled>\n";
|
||||
}
|
||||
print "<td><select name=wan_proto onChange='form.submit()'>\n";
|
||||
push @hidden, "<input type=hidden name=wan_proto value='$wan_proto'>";
|
||||
|
||||
selopt("Static", "static", $wan_proto);
|
||||
selopt("DHCP", "dhcp", $wan_proto);
|
||||
|
@ -1005,15 +864,12 @@ print "<td><input type=text size=15 name=wan_dns1 value='$wan_dns1'></td></tr>\n
|
|||
print "<tr><td><nobr>DNS 2</nobr></td>\n";
|
||||
print "<td><input type=text size=15 name=wan_dns2 value='$wan_dns2'></td></tr>\n";
|
||||
|
||||
if($config eq "mesh")
|
||||
{
|
||||
print "<tr><td colspan=2><hr></td></tr>\n";
|
||||
print "<tr><th colspan=2>Advanced</th></tr>";
|
||||
print "<tr><td><nobr>Mesh Gateway</nobr></td>\n";
|
||||
print "<td><input type=checkbox name=olsrd_gw value=1 title='Allow this node to provide internet access to all other nodes'";
|
||||
print " checked" if $olsrd_gw;
|
||||
print "></td></tr>\n";
|
||||
}
|
||||
print "<tr><td colspan=2><hr></td></tr>\n";
|
||||
print "<tr><th colspan=2>Advanced</th></tr>";
|
||||
print "<tr><td><nobr>Mesh Gateway</nobr></td>\n";
|
||||
print "<td><input type=checkbox name=olsrd_gw value=1 title='Allow this node to provide internet access to all other nodes'";
|
||||
print " checked" if $olsrd_gw;
|
||||
print "></td></tr>\n";
|
||||
|
||||
print "</table>
|
||||
|
||||
|
@ -1065,7 +921,6 @@ print "</table></td></tr>";
|
|||
|
||||
print "</table>\n";
|
||||
|
||||
push @hidden, "<input type=hidden name=oldconfig value='$oldconfig'>";
|
||||
push @hidden, "<input type=hidden name=reload value=1>";
|
||||
push @hidden, "<input type=hidden name=dtdlink_ip value='$dtdlink_ip'>";
|
||||
foreach(@hidden) { print "$_\n" }
|
||||
|
@ -1132,10 +987,10 @@ EOF
|
|||
var m = e.target;
|
||||
var p = m.getLatLng();
|
||||
document.getElementsByName('latitude')[0].value=p.lat.toFixed(6).toString();
|
||||
document.getElementsByName('longitude')[0].value=p.lng.toFixed(6).toString();
|
||||
document.getElementsByName('longitude')[0].value=p.lng.toFixed(6).toString();
|
||||
}
|
||||
</script>
|
||||
EOF
|
||||
#}
|
||||
print "</body>\n";
|
||||
print "</html>\n";
|
||||
print "</html>\n";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/perl
|
||||
#!/usr/bin/perl
|
||||
=for commnet
|
||||
|
||||
Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks
|
||||
|
@ -44,7 +44,7 @@ $node = nvram_get("node");
|
|||
$node = "NOCALL" if $node eq "";
|
||||
$tactical = nvram_get("tactical");
|
||||
$config = nvram_get("config");
|
||||
$config = "not set" if $config eq "" or not -d "/etc/config.$config";
|
||||
$config = "not set" if $config eq "" or not -d "/etc/config.mesh";
|
||||
|
||||
read_postdata();
|
||||
|
||||
|
@ -84,10 +84,6 @@ if($config eq "mesh")
|
|||
print "<button type=button onClick='window.location=\"http://${node}.local.mesh:1978/\"' title='See the OLSR routing details'";
|
||||
#print " disabled" unless -f "/var/run/hosts_olsr";
|
||||
print ">OLSR Status</button>\n";
|
||||
}
|
||||
|
||||
if($config eq "mesh" or $config eq "client")
|
||||
{
|
||||
print " ";
|
||||
print "<button type=button onClick='window.location=\"scan\"' title='See what wireless networks are nearby'>WiFi Scan</button>\n";
|
||||
}
|
||||
|
@ -114,7 +110,7 @@ if($config eq "not set")
|
|||
print "<br><br>\n";
|
||||
print "<div style=\"max-width: 540px\; text-align: left\">\n";
|
||||
print "<p>This device can be configured to either permit or prohibit known encrypted traffic on its RF link. It is up to the user to decide which is appropriate based on how it will be used and the license under which it will be operated. These rules vary by country, frequency, and intended use. You are encouraged to read and understand these rules before going further.</p>";
|
||||
print "<p>This device is pre-configured with no restrictions as to the type of data being passed.</p>\n";
|
||||
print "<p>This device is pre-configured with no restrictions as to the type of data being passed.</p>\n";
|
||||
print "<p>Follow these steps if <span style=\"text-decoration: underline\">you wish to prohibit</span> known encrypted traffic on the RF link. These instructions will disappear, so copy them for your reference:</p>";
|
||||
print "<p><ol>\n";
|
||||
print "<li>Setup your node name and password as instructed at the top of this page</li>";
|
||||
|
@ -124,7 +120,7 @@ if($config eq "not set")
|
|||
print "<li>Install the blockknownencryption package by uploading it or choosing it from the package drop-down list</li>";
|
||||
print "<li>Wait until the package installs and then reboot your node</li>";
|
||||
print "</ol></p>\n";
|
||||
print "</div>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
# status display
|
||||
|
@ -210,7 +206,7 @@ if(-f "/tmp/olsrd.log")
|
|||
|
||||
# right column - system info
|
||||
|
||||
if($config eq "mesh" or $config eq "client")
|
||||
if($config eq "mesh")
|
||||
{
|
||||
$str = "<th align=right valign=middle><nobr>Signal/Noise/Ratio</nobr></th><td valign=middle><nobr>";
|
||||
($s, $n) = get_wifi_signal(get_interface("wifi"));
|
||||
|
|
|
@ -74,11 +74,11 @@ provided through those nodes.
|
|||
|
||||
<li><strong>WiFi Scan</strong> displays a list of other 802.11 signals that the
|
||||
node can see and only of the same bandwidth. The 802.11 signals include
|
||||
Access Points (AP), neighbor nodes (connected ad-hoc stations), and other mesh networks
|
||||
(foriegn ad-hoc networks). The AREDN mesh is created on top of an 802.11 'ad-hoc' network.
|
||||
Consequently when multiple ad-hoc networks are visiable to each other (different SSID or
|
||||
channel), the 'network' is displayed and not individual nodes (stations). There is also an
|
||||
automatic scan mode. It is not recommend to run a wifi scan continously because this will degrade mesh
|
||||
Access Points (AP), neighbor nodes (connected ad-hoc stations), and other mesh networks
|
||||
(foriegn ad-hoc networks). The AREDN mesh is created on top of an 802.11 'ad-hoc' network.
|
||||
Consequently when multiple ad-hoc networks are visiable to each other (different SSID or
|
||||
channel), the 'network' is displayed and not individual nodes (stations). There is also an
|
||||
automatic scan mode. It is not recommend to run a wifi scan continously because this will degrade mesh
|
||||
performance. A wifi scan transmits queries on all channels to discover other devices.<br><br></li>
|
||||
|
||||
<li><strong>Setup</strong> takes you to the setup pages of the web
|
||||
|
@ -99,7 +99,7 @@ name (if known) of the device accessing this page.
|
|||
</p>
|
||||
<p>
|
||||
The right column contains the signal strength reading and other attributes of
|
||||
your node. The <b>Signal/Noise/Ratio</b> is a reading of the WiFi signal
|
||||
your node. The <b>Signal/Noise/Ratio</b> is a reading of the strongest neighbor Mesh RF signal
|
||||
strength in dBm, and it is available only when the node is in a Mesh or Client
|
||||
configuration. The <strong>Auto</strong> button will take you to an
|
||||
automatically refreshing display of the current signal strength and an average
|
||||
|
@ -145,7 +145,7 @@ The Mesh Status page lists AREDN Mesh Nodes, link quality information, and the s
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>Local Host</strong> is the AREDN Mesh Node showing status and the advertised Services assocated with this Node.<br><br></li>
|
||||
<li><strong>Local Host</strong> is the AREDN Mesh Node showing status and the advertised Services associated with this Node.<br><br></li>
|
||||
|
||||
<li><strong>Current Neighbors</strong> is a list of direct Neighbor Mesh Nodes (1 hop). This may be via RF, DTDLink (a cat5 cable), or a Tunnel (over Internet connection). Quality of the link is shown (described below) and advertised Services hosted on the Node or attached to the LAN of the Node are listed.<br><br></li>
|
||||
|
||||
|
@ -179,7 +179,7 @@ Neighbor Link Quality (NLQ) is the % of packets the Neighbor received from the p
|
|||
Expected Transmissions (ETX) is a Bernoulli statistic of how many packets must be transmitted to successfully receive the round trip acknowledgement between Neighbor nodes and is calculated with this formula: ETX = 1/(LQ*NLQ). Between multiple hop nodes, this is calculated by adding up the ETX for each single hop. "1" is a perfect RF link between Neighbors. A DtDLink is fixed at ETX="0.1" for packets over a cat5 cable. OLSR on a Mesh Node selects the Neighbor to send traffic to based on the lowest cost ETX path towards the final destination Node.
|
||||
</p>
|
||||
<p>
|
||||
ETX should be interpreted with care. From a quality perspective, the ETX for Remote Nodes is not an end-to-end metric in the same way as adjacent neighbors. For example, 2 nodes that are 5 hops apart with zero packet loss between them is characterized with an ETX=5. A single hop with ETX=5 (LQ and NLQ is ~45%) will stream poor quality video, if usable at all, given the packet loss. A 5 hop route between nodes with ETX=5 will deliver smooth streaming quality video.
|
||||
ETX should be interpreted with care. From a quality perspective, the ETX for Remote Nodes is not an end-to-end metric in the same way as adjacent neighbors. For example, 2 nodes that are 5 hops apart with zero packet loss between them is characterized with an ETX=5. A single hop with ETX=5 (LQ and NLQ is ~45%) will stream poor quality video, if usable at all, given the packet loss. A 5 hop route between nodes with ETX=5 will deliver smooth streaming quality video.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -188,7 +188,7 @@ ETX should be interpreted with care. From a quality perspective, the ETX for Re
|
|||
</p>
|
||||
|
||||
<p>
|
||||
Transmitted Mbps (TxMbps) is calculated with the formula (TxMbps = rate * EWMA) where rate is the 802.11 data rate in use by the transmitter and EWMA is the Exponetially Weighted Moving Average or the current time weighted chance that a packet at this rate will reach the remote station. If no traffic is being routed to the Neigbor, this value may be '0' until data is available to measure and determine the optimal settings. For further details: <a href='http://wireless.wiki.kernel.org/en/developers/documentation/mac80211/ratecontrol/minstrel'>Rate Control Algorithm</a>
|
||||
Transmitted Mbps (TxMbps) is calculated with the formula (TxMbps = rate * EWMA) where rate is the 802.11 data rate in use by the transmitter and EWMA is the Exponetially Weighted Moving Average or the current time weighted chance that a packet at this rate will reach the remote station. If no traffic is being routed to the Neigbor, this value may be '0' until data is available to measure and determine the optimal settings. For further details: <a href='http://wireless.wiki.kernel.org/en/developers/documentation/mac80211/ratecontrol/minstrel'>Rate Control Algorithm</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -206,7 +206,7 @@ Transmitted Mbps (TxMbps) is calculated with the formula (TxMbps = rate * EWMA)
|
|||
</p>
|
||||
|
||||
<p>
|
||||
"(dtd)" next to a Mesh Node indicates the path to a Neighbor is a cat5 cable. The Neighbor may be listed twice if both an RF and DtDLink path exists. The DtDLink path is always assigned an ETX of "0.1".
|
||||
"(dtd)" next to a Mesh Node indicates the path to a Neighbor is a cat5 cable. The Neighbor may be listed twice if both an RF and DtDLink path exists. The DtDLink path is always assigned an ETX of "0.1".
|
||||
</p>
|
||||
|
||||
<br><br><hr>
|
||||
|
@ -245,7 +245,7 @@ until Save Changes is clicked.<br><br></li>
|
|||
<strong>Node Name</strong> sets the hostname for the node. Hostnames can
|
||||
contain up to 63 letters, numbers, and dashes, but cannot begin or end with a
|
||||
dash. Underscores, spaces, or any other characters are not allowed.
|
||||
Hostnames are not case sensitive, but the case will be preserved.
|
||||
Hostnames are not case sensitive, but the case will be preserved.
|
||||
</p>
|
||||
<p>
|
||||
As ham radio operators there are other requirements we must follow,
|
||||
|
@ -269,69 +269,6 @@ accessible through DNS like the main node names are.
|
|||
To set a tactical name, put a slash after the the node name then give
|
||||
the tactical name. For example, "ad5oo-1/shelter5".
|
||||
</p>
|
||||
<p><br>
|
||||
<strong>Node Type</strong> sets the operational mode of the device as follows:
|
||||
<ul>
|
||||
|
||||
<li><strong>Mesh Node</strong><br>
|
||||
|
||||
This is the main mode of the router, and the reason this firmware is running
|
||||
in the first place. The WiFi interfaces of multiple nodes form a mesh
|
||||
network, the LAN interfaces provide access to that mesh to other devices, and
|
||||
the WAN interface provides outbound network access, typically to the internet.
|
||||
<br><br></li>
|
||||
|
||||
<li><strong>Mesh Access Point</strong><br>
|
||||
|
||||
In this mode the device is pre-configured to act as an access point providing
|
||||
standard wireless access to the LAN side of another mesh node. This is to be
|
||||
used on a second router whose LAN port is connected with the LAN port of a
|
||||
mesh node. It is a simple mode but there are special considerations,
|
||||
especially when you want to get out of this mode. See the section at the end
|
||||
called <a href='#meshap'>Mesh Access Point considerations</a> for details.
|
||||
<br><br></li>
|
||||
|
||||
<li><strong>Standard Access Point</strong><br>
|
||||
|
||||
In this mode the device acts like any other standard access point, although
|
||||
with fewer configuration options. It is provided mainly as a convenience if
|
||||
you need a basic access point. If you need a full featured access point,
|
||||
consider using either a stock router or one running conventional access point
|
||||
firmware.
|
||||
<br><br></li>
|
||||
|
||||
<li><strong>Wireless Client</strong><br>
|
||||
|
||||
This mode allows you to connect a wired network interface to a wireless
|
||||
network. The WiFi interface acts as a client to a separate access point, and
|
||||
the LAN provides access to the wired device. This mode does not provide a
|
||||
wireless bridge, instead it uses NAT and is routed.
|
||||
<br><br></li>
|
||||
|
||||
<li><strong>Wired Router</strong><br>
|
||||
|
||||
In this mode the WiFi is disabled and the LAN and WAN ports have their usual
|
||||
roles. This is "just a router" with no wireless functions.
|
||||
<br><br></li>
|
||||
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Node Type</strong> sets the operational mode of the node. For
|
||||
our purposes it will be set to Mesh Node, but if needed it can also be set to
|
||||
one of the other modes, to be described at a later time.
|
||||
</p>
|
||||
<p>
|
||||
The one mode I will mention is called Mesh Access Point. It is a
|
||||
configuration meant to be used to give standard wireless access to the LAN
|
||||
port of a mesh node. This is to be used on a second router whose LAN port is
|
||||
connected with the LAN port of a mesh node. When running a router in this mode
|
||||
it does not use OLSR and as a result its hostname is not available to the
|
||||
mesh. It can be accessed from the LAN by its IP address which by default is
|
||||
172.27.0.2. Like the name "localnode", an automatically generated name exists
|
||||
called "localap" which is set to the localnode address plus one, but only when
|
||||
the node is operating in the default NAT mode.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Password</strong> is where you set the administration password
|
||||
for the node. It needs to be entered again in the Retype Password box to help
|
||||
|
@ -342,18 +279,15 @@ encrypted in transit, so this is best done from a direct wired connection to
|
|||
the node.
|
||||
</p>
|
||||
<p>
|
||||
The <strong>WiFi</strong>, <strong>LAN</strong>,
|
||||
The <strong>Mesh RF</strong>, <strong>LAN</strong>,
|
||||
and <strong>WAN</strong> boxes are where the details of each of these network
|
||||
interfaces are set.
|
||||
</p>
|
||||
<p>
|
||||
In the <strong>WiFi</strong> box there are settings shown as being
|
||||
In the <strong>Mesh RF</strong> box there are settings shown as being
|
||||
Active Settings. These settings can be changed without rebooting the node by
|
||||
clicking the <strong>Apply</strong> button, but unless they are saved they
|
||||
will revert to the previously saved values after a reboot.<br> <br>
|
||||
The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings have
|
||||
been removed from current builds. The hardware handles antenna selection
|
||||
automatically in the backend without need for configuration.
|
||||
will revert to the previously saved values after a reboot.<br>
|
||||
<br>
|
||||
As always a dummy load on unused RF ports is recommended to keep out physical
|
||||
contaminants and to avoid EMI/RFI interference.
|
||||
|
@ -382,30 +316,16 @@ of the node and the address range of the DHCP server, and these should be
|
|||
self explanatory. The <b>LAN Mode</b> is described in the next section.
|
||||
|
||||
<br><br>
|
||||
The <strong>Disable Default Route</strong> checkbox will cause the node to not
|
||||
The <strong>Disable Default Route</strong> checkbox will cause the node to not
|
||||
advertise that it should be chosen as the default route. This means that
|
||||
computers plugged into the node will not try and route to the internet or
|
||||
other networks via the mesh node and will only try and use the mesh node for
|
||||
the 10.0.0.0/8 and 172.16.0.0/12 "mesh" network ranges. You will not be able
|
||||
to access the internet, even if your node has internet available on its wan
|
||||
to access the internet, even if your node has internet available on its wan
|
||||
port with this setting checked. This also applies to internet available over
|
||||
the mesh. Use this only if you know what a default route is and you need to
|
||||
be connected to two networks at once such as wired to the mesh, and WiFi to
|
||||
a local served agency network.
|
||||
|
||||
<!--
|
||||
, but the <strong>Mesh Bridge</strong> function will be described
|
||||
here. Given that AREDN™ is not restricted to the standard channels of the
|
||||
2.4GHz ISM band, it is possible that two nodes can be in range but not be able
|
||||
to communicate because they are using different radio parameters or are on an
|
||||
entirely different band. The Mesh Bridge function allows them to communicate.
|
||||
|
||||
<br><br>
|
||||
<u>The use of this function requires central coordination. This is a
|
||||
specialized and rarely needed function. Improper use will cause network
|
||||
problems for everyone. Please contact us at aredn.org to receive a set of
|
||||
customized network parameters if you have a need to bridge your meshes.</u>
|
||||
-->
|
||||
</p>
|
||||
<p>
|
||||
The <strong>WAN</strong> box contains the settings used to
|
||||
|
@ -429,7 +349,7 @@ The other option in the WAN box is the <strong>Mesh Gateway</strong>.
|
|||
This is an advanced configuration option.<br>
|
||||
When a node has internet access from either the WAN or LAN, that access is
|
||||
available to the node itself and to any computer connected to the LAN port.
|
||||
When the Mesh Gateway is enabled this node will gate(route) traffic from the
|
||||
When the Mesh Gateway is enabled this node will gate(route) traffic from the
|
||||
mesh onto this network and the internet.
|
||||
|
||||
By default it is disabled, so consider carefully your
|
||||
|
@ -459,7 +379,7 @@ access with static IP addresses should already be comfortable with this mode.
|
|||
Like commercial ISP access, you cannot decide for yourself what the network
|
||||
parameters are. You have to use the parameters which are given to you. But
|
||||
unlike most commercial ISP access there is a DHCP server available on the mesh
|
||||
node to configure the hosts that are attached to the LAN.
|
||||
node to configure the hosts that are attached to the LAN.
|
||||
</p>
|
||||
<p>
|
||||
The only configurable option available in Direct mode is the size of the LAN subnet
|
||||
|
@ -472,13 +392,13 @@ available from a mesh node.
|
|||
It is important to not use a subnet larger than is necessary because the
|
||||
chances of an IP address conflict on the mesh increase with the size of the
|
||||
subnet. The LAN subnet parameters are automatically generated and depend on
|
||||
the IP address of the WiFi interface. If a conflict does occur it can be
|
||||
fixed by changing the WiFi IP address.
|
||||
the IP address of the Mesh RF interface. If a conflict does occur it can be
|
||||
fixed by changing the Mesh RF IP address.
|
||||
</p>
|
||||
<p>
|
||||
The other LAN Mode is NAT, which stands for Network Address Translation. In
|
||||
this mode the LAN is isolated from the mesh and all outgoing traffic has its
|
||||
source address modified to be the WiFi address of the mesh node. This is the
|
||||
source address modified to be the Mesh RF IP address of the mesh node. This is the
|
||||
same way that most routers use an internet connection, and all services
|
||||
provided by computers on the LAN can only be accessed through port forwarding
|
||||
rules. A single DMZ server can be set up to accept all incoming traffic that
|
||||
|
@ -501,42 +421,6 @@ To see a sample of the information that will be sent to the AREDN server, click
|
|||
You may set the timezone where the node is located as well as setting the NTP server that the node will connect to. A "Save Changes" button click IS required for timezone and NTS server settings, as well as a subsequent reboot.
|
||||
</p>
|
||||
|
||||
<hr width=500>
|
||||
<a name='meshap'><h4>Mesh Access Point considerations</h4>
|
||||
<p>
|
||||
|
||||
When a device is configured in Mesh Access Point mode it is essentially
|
||||
'transparent'. You are going <u>through</u> the device to reach a mesh node,
|
||||
and there is no need to get <u>to</u> the device unless you wish to change its
|
||||
configuration. When the time comes to reconfigure a device in this mode be
|
||||
aware that it is not running its own DHCP server because that is the job of
|
||||
the mesh node it is connected to. You will need some other way to configure
|
||||
your computer's network interface. There are two ways to do this:
|
||||
|
||||
<ol>
|
||||
<li>Manual configuration<br> Connect only your computer to the LAN port. Set
|
||||
your IP address to 172.27.0.100 and your netmask to 255.255.255.0. No other
|
||||
settings are needed.<br><br>
|
||||
</li>
|
||||
<li>
|
||||
Automatic configuration<br> You will need another mesh node that is using NAT
|
||||
mode on its LAN, and using the default LAN IP address of 172.27.0.1. Both of
|
||||
these are required, otherwise this method will not work. Connect
|
||||
both your computer and the LAN of the Mesh Access Point to the LAN of the mesh
|
||||
node.
|
||||
</ol>
|
||||
|
||||
In this mode the default IP address on the LAN port is 172.27.0.2. After one
|
||||
of the above steps you should be able to send your browser
|
||||
to <a href='http://172.27.0.2:8080/'>http://172.27.0.2:8080/</a>. If you used
|
||||
automatic configuration you should also be able to go
|
||||
to <a href='http://localap:8080/'>http://localap:8080/</a>. Like the name
|
||||
"localnode", an automatically generated name exists called "localap" which is
|
||||
set to the localnode address plus one, but only when the node LAN mode is set
|
||||
to NAT. If you changed the default IP address of a Mesh Access Point you will
|
||||
have to modify these instructions accordingly.
|
||||
</p>
|
||||
|
||||
<br><br><hr>
|
||||
<a name='ports'><h2>Port Forwarding, DHCP, and Services</h2></a>
|
||||
<p>
|
||||
|
@ -561,7 +445,7 @@ intended.</li>
|
|||
</ul>
|
||||
<p><br> The way this page works depends on whether the LAN is operating in NAT
|
||||
mode or Direct mode. First we will cover NAT mode, where hosts on the LAN are
|
||||
insulated by a firewall and NAT from both the WiFi and WAN interfaces. This
|
||||
insulated by a firewall and NAT from both the Mesh RF and WAN interfaces. This
|
||||
makes them inaccessible from either of these interfaces unless Port Forwarding
|
||||
is set up. Here are some common ports:
|
||||
</p>
|
||||
|
@ -581,7 +465,7 @@ is set up. Here are some common ports:
|
|||
</ul>
|
||||
<p>
|
||||
So then what is port forwarding? Port forwarding is taking an inbound
|
||||
connection to a port from the WiFi or WAN interface and forwarding it to an IP
|
||||
connection to a port from the Mesh RF or WAN interface and forwarding it to an IP
|
||||
address on the LAN. The port number need not be the same. If you have hosts on
|
||||
the LAN that provide services you want to make available to the mesh all it
|
||||
takes is a Port Forwarding rule to make that happen.
|
||||
|
@ -605,13 +489,12 @@ running its own firewall to prevent unauthorized access.
|
|||
<br><br> On the LAN of a mesh node called ad5oo-mobile is an IP camera that is
|
||||
running its own web server. The address of that camera is 172.27.0.240. I want
|
||||
to make that camera available to everyone on the mesh so I set up a port
|
||||
forwarding rule on the WiFi interface whose outside port is 8100, IP address
|
||||
forwarding rule on the Mesh RF interface whose outside port is 8100, IP address
|
||||
is 172.27.0.240, and inside port is 80. This takes all connections to port
|
||||
8100 on ad5oo-mobile and redirects them to port 80 on 172.27.0.240. In a web
|
||||
browser on a computer connected to a different node you would go to
|
||||
http://ad5oo-mobile:8100 and would be connected to the IP camera.
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
Note that port forwarding to an FTP server, which uses both ports 20 and 21,
|
||||
can be done with a single rule using port 21 if the ftp client is capable of
|
||||
|
@ -717,7 +600,7 @@ size will be translated into the new subnet address space.
|
|||
</p>
|
||||
<br><br><hr>
|
||||
<a name=admin><h2>Administration</h2></a>
|
||||
<p>
|
||||
<p>
|
||||
<strong>Firmware Update</strong> is how new firmware is installed on the node.
|
||||
If you have a firmware image on your computer, click
|
||||
the <strong>Browse</strong> button and select the firmware file to upload.
|
||||
|
@ -882,10 +765,10 @@ Now power cycle the router. If the above messages continue and the router
|
|||
continues to boot, it missed the window. This is not unusual. Power cycle the
|
||||
router again and repeat the process until you see messages like this:
|
||||
<pre>
|
||||
sent DATA
|
||||
received ACK
|
||||
sent DATA
|
||||
received ACK
|
||||
sent DATA
|
||||
received ACK
|
||||
sent DATA
|
||||
received ACK
|
||||
</pre>
|
||||
After that the flash write begins, then the router will reboot.
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue