bugfix: UI allows enabling mesh_gw when wan disabled or nat mode

Mesh nodes would need a significant amount of configuration
including some operational checks everytime an interface comes up
to be able to handle this.

The more sane method is to only allow a node to be a mesh_gw when
the WAN port is utilized and the node is in DIRECT mode.

This changes the UI to prevent this setup from being allowed.

fixes AREDN->ticket:184

Change-Id: I1a1289bc914a349149f5842812dbebc0a70442f7
This commit is contained in:
Conrad Lara - KG6JEI 2016-09-20 22:43:13 -07:00
parent bb83809472
commit 1b65f8a3ad
2 changed files with 14 additions and 5 deletions

View File

@ -47,6 +47,12 @@ foreach $line (`cat /etc/config.mesh/_setup.default`)
$defaultcfg{$1} = $2;
}
# Set variables in special conditions
if ( ($cfg{dmz_mode} eq '0') || ( $cfg{wan_proto} eq "disabled") ) {
$cfg{olsrd_gw} = 0;
}
#End special condition overides
foreach $variable( sort keys %defaultcfg )
{
if ( defined $cfg{$variable} )

View File

@ -866,11 +866,14 @@ print "<td><input type=text size=15 name=wan_dns2 value='$wan_dns2'></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";
if ( ($dmz_mode ne '0') && ($wan_proto ne "disabled") ) {
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";
} else {
push @hidden, "<input type=hidden name=olsrd_gw value='0'>";
}
print "</table>
</td></tr>