From: Stephan Feddersen via Development Date: Tue, 27 Feb 2018 16:20:07 +0000 (+0100) Subject: WIO: Fix a problem with the Network-Table-Button X-Git-Tag: v2.19-core120~47 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=c1fc92a9b8e2a049875c02a736087beacb8c6348 WIO: Fix a problem with the Network-Table-Button Signed-off-by: Michael Tremer --- diff --git a/src/wio/wio.cgi b/src/wio/wio.cgi index 8c43b0432a..c51910f4db 100644 --- a/src/wio/wio.cgi +++ b/src/wio/wio.cgi @@ -21,7 +21,7 @@ # # ############################################################################### # -# Version: 2018/01/05 14:34:23 +# Version: 2018/02/27 16:54:23 # # This wio.cgi is based on the Code from the IPCop WIO Addon # and is extremly adapted to work with IPFire. @@ -106,10 +106,10 @@ my $count = 0; my $showcount = 0; my $arpbuttontext = "$Lang::tr{'wio_show_table_on'}"; -my $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}"; -my $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}"; +my $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}"; +my $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}"; -my ( $infomessage, $errormessage, $importmessage, $message ) = ''; +my ( $message, $infomessage, $errormessage, $importmessage ) = ''; my ( $buttontext, $host, $timestamp, $ipadr, $on, $remark, $dyndns, $dyndnsip, $sendemailon, $net, $dev, $iprange, $output, $write, $webinterface, $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $ddns, $edc, @@ -280,7 +280,7 @@ if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_client_add'} ) { ## show / hide arptable -if ($wiosettings{'WIOGUISHOWARPTABLE'} eq 'arptable') { +if ( $wiosettings{'WIOGUISHOWARPTABLE'} eq 'arptable' ) { if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) { $wiosettings{'WIOGUISHOWARPTABLE'} = 'off'; $arpbuttontext = "$Lang::tr{'wio_show_table_on'}"; @@ -309,11 +309,11 @@ if ( $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} eq 'clientimport' ) { if ( $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} eq 'networksearch' ) { if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) { $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'off'; - $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}"; + $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}"; } else { $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'on'; - $clientimportbuttontext = "$Lang::tr{'wio_show_table_off'}"; + $networksearchbuttontext = "$Lang::tr{'wio_show_table_off'}"; } } @@ -348,7 +348,7 @@ if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_add'} ) { } } -## enable / disabel client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn +## enable / disable client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable client'} ) { $edc = 'on'; } if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable dyndns'} ) { $edd = 'on'; } @@ -983,7 +983,7 @@ for ($i=1; $i<=15; $i++) { print "\n"; } -print" +print"  $Lang::tr{'wio sec'}   @@ -1123,7 +1123,7 @@ print" $Lang::tr{'wio_wanname'} $Lang::tr{'wio_dyndns_hosts'} $Lang::tr{'wio image'} - $Lang::tr{'wio_wancheck'} + $Lang::tr{'wio_connected'} 01 @@ -1196,7 +1196,7 @@ print" $Lang::tr{'type'} $Lang::tr{'wio_common_name'} $Lang::tr{'wio image'} - $Lang::tr{'wio_ovpn_connected'} + $Lang::tr{'wio_connected'} "; @@ -1244,7 +1244,7 @@ $statustxt = "$Lang::tr{'capsclosed'}";   "; - + if ($vpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') { print" $vpnconfighash{$key}[25]"; } @@ -1278,7 +1278,7 @@ print" $Lang::tr{'type'} $Lang::tr{'common name'} $Lang::tr{'wio image'} - $Lang::tr{'wio_ovpn_connected'} + $Lang::tr{'wio_connected'} "; @@ -1310,7 +1310,6 @@ print" $statustxt = "$Lang::tr{'capsclosed'}"; } else { - if ($ovpnconfighash{$key}[3] eq 'net') { if (-e "/var/run/$ovpnconfighash{$key}[1]n2n.pid") { my @output = ""; @@ -1378,7 +1377,7 @@ print" if ($ovpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') { print" $ovpnconfighash{$key}[25]"; } - + print""; $idovpn++ } @@ -1519,7 +1518,7 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); if ( -e "$vpnpid" ) { foreach $key (keys(%vpnconfighash)) { next unless ($vpnconfighash{$key}[3] eq 'net'); - + my $convertip = &General::ipcidr2msk($vpnconfighash{$key}[11]); my @net = split ("/", $convertip); @@ -1538,16 +1537,15 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); @match = split ("/", $ovpnsettings{'DOVPN_SUBNET'}); if ( &General::IpInSubnet($ipaddresses[$a], $match[0], $match[1]) ) { - print"OpenVPN"; - last SWITCH; + print"OpenVPN"; + last SWITCH; } } if ( %ovpnccdconfhash ne '' ) { foreach $key (keys(%ovpnccdconfhash)) { - + my $convertip = &General::ipcidr2msk($ovpnccdconfhash{$key}[1]); - my @net = split ("/", $convertip); $vpnn2nip = $net[0]; @@ -1557,7 +1555,6 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); print"OpenVPN"; last SWITCH; } - } } @@ -1567,7 +1564,7 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); chomp ($rednet[1]); my $red_netmask = General::iporsubtodec($rednet[1]); my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask"); - + if ( &General::IpInSubnet($ipaddresses[$a], $red_netaddress, $red_netmask) ) { print"$Lang::tr{"; last SWITCH; @@ -2165,23 +2162,24 @@ close(FILE); ############################################################################################################################ -sub SortByTunnelName -{ - if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) { - return -1; - } - elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) { - return 1; - } - else { - return 0; - } +sub SortByTunnelName { + + if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) { + return -1; + } + elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) { + return 1; + } + else { + return 0; + } + } ############################################################################################################################ -sub validSave -{ +sub validSave { + if ( $wiosettings{'IPADR'} eq '' && $wiosettings{'PINGMETHODE'} eq 'ip' && $wiosettings{'DYNDNS'} eq '' ) { $errormessage = $Lang::tr{'wio_ip_empty'}; } @@ -2207,4 +2205,5 @@ sub validSave if ( $wiosettings{'ID'} eq '' && ! defined($errormessage) ) { $errormessage = &WIO::checkinto($wiosettings{'IPADR'}, $wiosettings{'HOST'}, @current); } if ( $wiosettings{'REMARK'} ne '' ) { $wiosettings{'REMARK'} =~ s/,/,/g; } + }