- open(FILE, "${General::swroot}/main/routing") ;
- @current = <FILE>;
- close (FILE);
- &General::readhasharray ("${General::swroot}/ovpn/ccdroute2", \%ccdroute2hash);
- my $set=0;
- my $selorange=0;
- my $selblue=0;
- my $helpblue=0;
- my $helporange=0;
- print"<option>$Lang::tr{'ccd none'}</option>";
- print"<option selected>$Lang::tr{'green'}</option>";
-
- foreach my $line (@current) {
- chomp($line); # remove newline
- my @temp=split(/\,/,$line);
- $temp[1] = '' unless defined $temp[1]; # not always populated
- my ($a,$b) = split(/\//,$temp[1]);
- $temp[1] = $a."/".&General::iporsubtocidr($b);
- foreach my $key (keys %ccdroute2hash) {
- if($ccdroute2hash{$key}[0] eq $cgiparams{'NAME'}){
- foreach my $i (1 .. $#{$ccdroute2hash{$key}}) {
-
- if($ccdroute2hash{$key}[$i] eq $a."/".&General::iporsubtodec($b)){
- $set=1;
- }
- if (&haveBlueNet()){
- if($netsettings{'BLUE_NETADDRESS'}."/".&General::iporsubtodec($netsettings{'BLUE_NETMASK'}) eq $ccdroute2hash{$key}[$i]) {
- $selblue=1;
-
- }
- }
- if (&haveOrangeNet()){
- if($netsettings{'ORANGE_NETADDRESS'}."/".&General::iporsubtodec($netsettings{'ORANGE_NETMASK'}) eq $ccdroute2hash{$key}[$i]) {
- $selorange=1;
- }
- }
- }
+ open(FILE, "${General::swroot}/main/routing") ;
+ @current = <FILE>;
+ close (FILE);
+ &General::readhasharray ("${General::swroot}/ovpn/ccdroute2", \%ccdroute2hash);
+ print"<option>$Lang::tr{'ccd none'}</option>";
+ #check if static routes are defined for client
+ foreach my $line (@current) {
+ chomp($line);
+ $line=~s/\s*$//g; # remove newline
+ @temp=split(/\,/,$line);
+ $temp[1] = '' unless defined $temp[1]; # not always populated
+ my ($a,$b) = split(/\//,$temp[1]);
+ $temp[1] = $a."/".&General::iporsubtocidr($b);
+ foreach my $key (keys %ccdroute2hash) {
+ if($ccdroute2hash{$key}[0] eq $cgiparams{'NAME'}){
+ foreach my $i (1 .. $#{$ccdroute2hash{$key}}) {
+ if($ccdroute2hash{$key}[$i] eq $a."/".&General::iporsubtodec($b)){
+ $set=1;