correct issues in files so build test will pass without issue (#4)

* correct issues in files so build test will pass without issue

* correct issues in files so build test will pass without issue
This commit is contained in:
dman776 2018-05-02 19:42:04 -05:00 committed by GitHub
parent b344a73505
commit 7f78757bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 102 additions and 108 deletions

View File

@ -21,11 +21,6 @@ else
$SSIDName= lc "AREDN-20-v3";
}
$lastset=0;
$lastval=0;
#dbm values for each RSSI trigger level
$RSSI_4=-65;
$RSSI_3=-73;

View File

@ -45,7 +45,7 @@ exit if system "ps | grep -v grep | grep -q 'olsrd '";
foreach(`cat /var/run/hosts_olsr 2>/dev/null`)
{
next unless /^\d/;
($ip, $name, $junk, $originator, $mid) = split /\s+/, $_;
($ip, $name, undef, $originator, $mid) = split /\s+/, $_;
next unless $originator;
next if $originator eq "myself";
next unless ($ip eq $originator) or (defined $mid and $mid eq "(mid");
@ -57,7 +57,7 @@ foreach(`cat /var/run/hosts_olsr 2>/dev/null`)
foreach(`echo /lin | nc 127.0.0.1 2006 2>/dev/null`)
{
next unless /^\d/;
($my_ip, $ip) = split /\s+/, $_;
(undef, $ip) = split /\s+/, $_;
$history{$ip}{age} = $uptime;
$history{$ip}{name} = $hosts{$ip};
}

View File

@ -215,7 +215,7 @@ foreach(`cat /var/run/hosts_olsr 2>/dev/null`)
{
next unless /^\d/;
chomp;
($ip, $name, $junk, $originator, $mid, $midnum) = split /\s+/, $_;
($ip, $name, undef, $originator, undef, undef) = split /\s+/, $_;
next unless $originator;
next if $originator eq "myself";
@ -236,7 +236,6 @@ foreach(`cat /var/run/hosts_olsr 2>/dev/null`)
$hosts{$ip}{name} = $name;
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
else { $hosts{$ip}{etx} = "99.000"; }
$dtd{$originator} = 1 ;
}
elsif ( $name =~ /^mid\d+\..*$/ )
{

View File

@ -163,7 +163,6 @@ unless($parms{reload})
if ( $doesiwoffset ) {
$wifi_txpower -= $1;
}
$slottime = "";
}
# sanitize the active settings

View File

@ -46,6 +46,66 @@ $node = "NOCALL" if $node eq "";
read_postdata();
#################################
# save clients from form to UCI
#################################
sub save_clients()
{
my $enabled_count=0;
for ($i=0; $i < $parms{"client_num"}; $i++) {
my $net = $parms{"client${i}_netip"};
$rc=&uci_add_named_section("vtun","client_$i","client");
# generate the clientip and serverip
my ($clientip, $serverip) = &generate_ips($net);
$rc=&uci_set_named_option("vtun","client_$i","netip",$net);
push(@cli_err,"Problem saving UCI vtun client net IP (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","enabled",$parms{"client${i}_enabled"});
push(@cli_err,"Problem saving UCI vtun client (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","name",$parms{"client${i}_name"});
push(@cli_err,"Problem saving UCI vtun client (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","passwd",$parms{"client${i}_passwd"});
push(@cli_err,"Problem saving UCI vtun client (#$i): $rc") if $rc;
# generate the VTUN NODE name based on the node name and netip
$net=~ s/\./\-/g;
my $vtun_node_name=$parms{"client${i}_name"} . "-" . $net;
$rc=&uci_set_named_option("vtun","client_$i","clientip",$clientip);
push(@cli_err,"Problem saving UCI vtun client client IP (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","serverip",$serverip);
push(@cli_err,"Problem saving UCI vtun client server IP (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","node",$vtun_node_name);
push(@cli_err,"Problem saving UCI vtun client name (#$i): $rc") if $rc;
$enabled_count++ if $parms{"client${i}_enabled"};
}
}
#################################
# save network info to UCI
#################################
sub save_network()
{
push(@cli_err,"The third octet of the network MUST be from 0 to 255") unless (($parms{server_net1}>=0) && ($parms{server_net1}<=255) && ($parms{server_net1} ne ''));
push(@cli_err,"The last octet of the network MUST be from 0 to 255") unless (($parms{server_net2}>=0) && ($parms{server_net2}<=255) && ($parms{server_net2} ne ''));
push(@cli_err,"The last octet of the network MUST be a multiple of 4 (ie. 0,4,8,12,16,...)") if ($parms{server_net2} % 4);
push(@cli_err,"Not a valid DNS name") unless (validate_fqdn($parms{dns}));
if (not @cli_err)
{
my $net=sprintf("%d.%d.%d.%d",172,31,$parms{server_net1},$parms{server_net2});
push @cli_err, "Problem saving the server network values!" if (&uci_set_indexed_option("vtun","network",0,"start",$net));
push @cli_err, "Problem saving the server DNS name!" if (&uci_set_indexed_option("vtun","network",0,"dns",$dns));
}
}
#################
# page checks
#################
@ -140,7 +200,7 @@ foreach $val (@list)
} # no delete capabilities as net renumbering is not allowed
if($val eq "_add" and $parm{button_save})
if($val eq "_add" and $parms{button_save})
{
push @cli_err, "$val this client must be added or cleared out before saving changes";
next;
@ -431,66 +491,6 @@ sub get_client_info()
$parms{client_num} = scalar(@clients);
}
#################################
# save clients from form to UCI
#################################
sub save_clients()
{
my $enabled_count=0;
for ($i=0; $i < $parms{"client_num"}; $i++) {
my $net = $parms{"client${i}_netip"};
$rc=&uci_add_named_section("vtun","client_$i","client");
# generate the clientip and serverip
my ($clientip, $serverip) = &generate_ips($net);
$rc=&uci_set_named_option("vtun","client_$i","netip",$net);
push(@cli_err,"Problem saving UCI vtun client net IP (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","enabled",$parms{"client${i}_enabled"});
push(@cli_err,"Problem saving UCI vtun client (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","name",$parms{"client${i}_name"});
push(@cli_err,"Problem saving UCI vtun client (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","passwd",$parms{"client${i}_passwd"});
push(@cli_err,"Problem saving UCI vtun client (#$i): $rc") if $rc;
# generate the VTUN NODE name based on the node name and netip
$net=~ s/\./\-/g;
my $vtun_node_name=$parms{"client${i}_name"} . "-" . $net;
$rc=&uci_set_named_option("vtun","client_$i","clientip",$clientip);
push(@cli_err,"Problem saving UCI vtun client client IP (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","serverip",$serverip);
push(@cli_err,"Problem saving UCI vtun client server IP (#$i): $rc") if $rc;
$rc=&uci_set_named_option("vtun","client_$i","node",$vtun_node_name);
push(@cli_err,"Problem saving UCI vtun client name (#$i): $rc") if $rc;
$enabled_count++ if $parms{"client${i}_enabled"};
}
}
#################################
# save network info to UCI
#################################
sub save_network()
{
push(@cli_err,"The third octet of the network MUST be from 0 to 255") unless (($parms{server_net1}>=0) && ($parms{server_net1}<=255) && ($parms{server_net1} ne ''));
push(@cli_err,"The last octet of the network MUST be from 0 to 255") unless (($parms{server_net2}>=0) && ($parms{server_net2}<=255) && ($parms{server_net2} ne ''));
push(@cli_err,"The last octet of the network MUST be a multiple of 4 (ie. 0,4,8,12,16,...)") if ($parms{server_net2} % 4);
push(@cli_err,"Not a valid DNS name") unless (validate_fqdn($parms{dns}));
if (not @cli_err)
{
my $net=sprintf("%d.%d.%d.%d",172,31,$parms{server_net1},$parms{server_net2});
push @cli_err, "Problem saving the server network values!" if (&uci_set_indexed_option("vtun","network",0,"start",$net));
push @cli_err, "Problem saving the server DNS name!" if (&uci_set_indexed_option("vtun","network",0,"dns",$dns));
}
}
sub DEBUGEXIT()
{
my ($text) = @_;

View File

@ -46,6 +46,43 @@ $node = "NOCALL" if $node eq "";
read_postdata();
#################################
# save server connections from form to UCI
#################################
sub save_connections()
{
my $enabled_count=0;
for ($i=0; $i < $parms{"conn_num"}; $i++) {
my $net = $parms{"conn${i}_netip"};
$rc=&uci_add_named_section("vtun","server_$i","server");
# generate the clientip and serverip
my ($clientip, $serverip) = &generate_ips($net);
# generate the VTUN NODE name based on the node name and netip
$net=~ s/\./\-/g;
my $vtun_node_name=uc "$node-$net";
$rc=&uci_set_named_option("vtun","server_$i","clientip",$clientip);
push(@conn_err,"Problem saving UCI vtun connection client IP (#$i)") if $rc;
$rc=&uci_set_named_option("vtun","server_$i","serverip",$serverip);
push(@conn_err,"Problem saving UCI vtun connection server IP (#$i)") if $rc;
$rc=&uci_set_named_option("vtun","server_$i","node",$vtun_node_name);
push(@conn_err,"Problem saving UCI vtun connection name (#$i)") if $rc;
foreach $var (qw(enabled host passwd netip))
{
$rc=&uci_set_named_option("vtun","server_$i",$var,$parms{"conn${i}_$var"});
push(@conn_err,"Problem saving UCI vtun connection (#$i)") if $rc;
}
$enabled_count++ if $parms{"conn${i}_enabled"};
}
}
#################
# page checks
#################
@ -143,7 +180,7 @@ foreach $val (@list)
# Validate password is vtun compliant
# TODO
if($val eq "_add" and $parm{button_save})
if($val eq "_add" and $parms{button_save})
{
push @conn_err, "$val this connection must be added or cleared out before saving changes";
next;
@ -409,42 +446,6 @@ sub get_connection_info()
$parms{conn_num} = scalar(@connections);
}
#################################
# save server connections from form to UCI
#################################
sub save_connections()
{
my $enabled_count=0;
for ($i=0; $i < $parms{"conn_num"}; $i++) {
my $net = $parms{"conn${i}_netip"};
$rc=&uci_add_named_section("vtun","server_$i","server");
# generate the clientip and serverip
my ($clientip, $serverip) = &generate_ips($net);
# generate the VTUN NODE name based on the node name and netip
$net=~ s/\./\-/g;
my $vtun_node_name=uc "$node-$net";
$rc=&uci_set_named_option("vtun","server_$i","clientip",$clientip);
push(@conn_err,"Problem saving UCI vtun connection client IP (#$i)") if $rc;
$rc=&uci_set_named_option("vtun","server_$i","serverip",$serverip);
push(@conn_err,"Problem saving UCI vtun connection server IP (#$i)") if $rc;
$rc=&uci_set_named_option("vtun","server_$i","node",$vtun_node_name);
push(@conn_err,"Problem saving UCI vtun connection name (#$i)") if $rc;
foreach $var (qw(enabled host passwd netip))
{
$rc=&uci_set_named_option("vtun","server_$i",$var,$parms{"conn${i}_$var"});
push(@conn_err,"Problem saving UCI vtun connection (#$i)") if $rc;
}
$enabled_count++ if $parms{"conn${i}_enabled"};
}
}
sub DEBUGEXIT()
{