From patchwork Wed Feb 28 03:20:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller_via_Development?= X-Patchwork-Id: 1677 Return-Path: Received: from mail01.ipfire.org (mail01.ipfire.org [IPv6:2001:470:7183:25::1]) by web02.i.ipfire.org (Postfix) with ESMTP id 126B360C0B for ; Tue, 27 Feb 2018 17:20:21 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id E4263100EA26; Tue, 27 Feb 2018 16:20:39 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.ipfire.org; s=201801; t=1519748440; x=1522340440; bh=TSKFou8HrJNBq1axMJNQpVojcrEiUWvViwA7khp9XR8=; h=To:Subject:Date:Message-Id:Cc:From:Reply-To:Sender:From:To:Cc: Date:Content-Type:Message-ID:In-Reply-To:Subject:Reply-To:Sender; b=EAt6cka0++wEKZinYCkYJaGxwMhI3PJutyejoikAsX2Rb+SvvF3mMOnI7u8c/LtlI CP8o0QW0HzLGs5Wi21qfk2g9B//qCQ73sficrQHldyi8lPKbIAQqnC6Vg4bM74k6zD phRyM9omWM8jU1DbBpy+zRAiYP3JEMu+3CjfcWCAv2efRioabcsRTm9CpYq7mjlUJE p6+9Mq3+jrDSJzMtTK2z8Y9AoxRyb5gsymhkISmypZZTfWUdOxCg7bexPHGXrHJ5wL Y+CXT10vpY0YAMEc0V4wzOsB0kVIn9SKxycIkwahrElZDo0oV3azBjgd8ywoJKrHvl DYAMNeeC8Y+CA== X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from ubuntu.stflan.home (p5B39C87E.dip0.t-ipconnect.de [91.57.200.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id CF02110BA557; Tue, 27 Feb 2018 16:20:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ipfire.org; s=201801; t=1519748434; x=1522340434; bh=TSKFou8HrJNBq1axMJNQpVojcrEiUWvViwA7khp9XR8=; h=From:To:Cc:Subject:Date:Message-Id:From:To:Cc:Date:Content-Type: Message-ID:In-Reply-To:Subject:Reply-To:Sender; b=FdjbrqYwlWROcT88sGGR3fmdPRN/dyu93Ldvqh2289OXP+XJ+u2pwPGrjiP+nMp2V cjXnFvxrd2KC7RL6+ugNCR7fiHAi8nBallktz41kabARx5sj83D45bePj5jGUfVPHi m6HvDPeQjnLiQWupc4dNKohcI9MbzAiXwFDsq5vfkJXRVeOJns3C+46jOgyv7+5Ku6 QekT7GYEkSa9U8Q1SpX1jjhq8K9bcRmx01zRs/OJN3v6mAz852uhktdq/cWKwcm84b h31JD4WGgZmbHEMt7js1Ptyt7cxq0uowxEs7P3QwtczEZ2iwcVJgR107X7r6E53SMB dUeqobx0Wt0dw== To: development@lists.ipfire.org Subject: [PATCH] WIO: Fix a problem with the Network-Table-Button Date: Tue, 27 Feb 2018 17:20:07 +0100 Message-Id: <1519748407-1622-1-git-send-email-sfeddersen@ipfire.org> X-Mailer: git-send-email 2.7.4 Cc: Stephan Feddersen X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stephan Feddersen via Development From: =?utf-8?q?Peter_M=C3=BCller_via_Development?= Reply-To: Stephan Feddersen Errors-To: development-bounces@lists.ipfire.org Sender: "Development" --- src/wio/wio.cgi | 69 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/src/wio/wio.cgi b/src/wio/wio.cgi index 8c43b04..c51910f 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; } + }