retrieve connections via uci

This commit is contained in:
Darryl Quinn 2015-04-08 19:44:41 -05:00
parent cb3867d0f7
commit 6ff8986810
1 changed files with 10 additions and 13 deletions

View File

@ -385,27 +385,24 @@ sub build_uci()
}
#################################
# load info from UCI
# load server connection info from UCI
#################################
sub get_connection_info()
{
my $x;
# how many connections
my $connection_count=&uci_get_type_count("vtun","server");
for (my $i=1; $i<=$connection_count; $i++) {
{
my @connections=&uci_get_all_by_sectiontype("vtun","server");
foreach $c (0..@connections-1)
{
foreach $var (qw(enabled host passwd netip))
{
$x=&uci_get_indexed_item("vtun","server",$i-1,$var);
$parms{"conn${i}_${var}"}=$x;
#eval sprintf("\$%s = \$parms{conn%s_%s}", $var, $val, $var);
$parms{"conn${c}_$var"} = @connections[$c]->{$var};
$parms{"conn${c}_$var"} = "0" if($parms{"conn${c}_$var"} eq "");
}
}
$parms{conn_num} = $connection_count;
$parms{conn_num} = scalar(@connections);
}
sub DEBUGEXIT()
{
my ($text) = @_;