X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fupnp.cgi;h=8d2666ec75be4292aac4611dbf5efe8becf2438e;hp=d2faaa160f0e42838bf123bd8ee6a534f965948d;hb=6b406afb9af68575463fdb165f6649594c2ac04e;hpb=fa7be6597cdea9f028ca09c875eec3ecd193953a
diff --git a/html/cgi-bin/upnp.cgi b/html/cgi-bin/upnp.cgi
index d2faaa160f..8d2666ec75 100644
--- a/html/cgi-bin/upnp.cgi
+++ b/html/cgi-bin/upnp.cgi
@@ -1,16 +1,28 @@
#!/usr/bin/perl
-#
-# IPFire CGIs
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The IPFire Team
-#
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see . #
+# #
+###############################################################################
use strict;
# enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
@@ -24,18 +36,23 @@ my %selected= () ;
my %servicenames =('UPnP Daemon' => 'upnpd',);
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
&Header::showhttpheaders();
############################################################################################################################
############################################### Setzen von Standartwerten ##################################################
$upnpsettings{'DEBUGMODE'} = '3';
$upnpsettings{'FORWARDRULES'} = 'yes';
-$upnpsettings{'DOWNSTREAM'} = '900000';
-$upnpsettings{'UPSTREAM'} = '16000000';
+$upnpsettings{'DOWNSTREAM'} = '1048576';
+$upnpsettings{'UPSTREAM'} = '131072';
$upnpsettings{'DESCRIPTION'} = 'gatedesc.xml';
$upnpsettings{'XML'} = '/etc/linuxigd';
$upnpsettings{'ENABLED'} = 'off';
-$upnpsettings{'friendlyName'} = 'IpFire Upnp Device';
+$upnpsettings{'friendlyName'} = 'IPFire Gateway';
### Values that have to be initialized
$upnpsettings{'ACTION'} = '';
@@ -51,8 +68,8 @@ $upnpsettings{'ACTION'} = '';
if ($upnpsettings{'ACTION'} eq $Lang::tr{'save'})
{
- $upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} * 8;
- $upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} * 8;
+ $upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} * 1024;
+ $upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} * 1024;
&General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
open (FILE, ">${General::swroot}/upnp/upnpd.conf") or die "Can't save the upnp config: $!";
@@ -74,7 +91,7 @@ xml_document_path = $upnpsettings{'XML'}
END
;
close FILE;
- system("/usr/local/bin/upnpctrl upnpxml $upnpsettings{'XML'} $upnpsettings{'DESCRIPTION'} $upnpsettings{'manufacturer'}");
+ system("/usr/local/bin/upnpctrl","upnpxml","$upnpsettings{'friendlyName'}","$upnpsettings{'XML'}","$upnpsettings{'DESCRIPTION'}");
}
elsif ($upnpsettings{'ACTION'} eq 'Start')
{
@@ -96,8 +113,8 @@ elsif ($upnpsettings{'ACTION'} eq $Lang::tr{'restart'})
}
&General::readhash("${General::swroot}/upnp/settings", \%upnpsettings);
-$upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} / 8;
-$upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} / 8;
+$upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} / 1024;
+$upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} / 1024;
if ($errormessage)
{
@@ -122,12 +139,7 @@ my $lines = 0;
my $key = '';
foreach $key (sort keys %servicenames)
{
- if ($lines % 2)
- {print "
\n";}
- else
- {print "
\n"; }
-
- print "$key\n";
+ print " |
$key\n";
my $shortname = $servicenames{$key};
my $status = &isrunning($shortname);
print "$status\n";
@@ -144,27 +156,42 @@ print <
-
-
END
;
&Header::closebox();
+&Header::openbox('100%', 'center', 'Aktuell geoeffnete Ports');
+my @output = qx(iptables -t nat -n -L PORTFW);
+my ($outputline, $extip, $extport, $int);
+my @output2;
+print "";
+foreach $outputline (@output) {
+ if ( $outputline =~ /^DNAT/ ) {
+ @output2 = split(/ /, $outputline);
+ $extip = $output2[23];
+ $extport = $output2[29];
+ $extport =~ s/dpt://;
+ $int = "$output2[31]";
+ $int =~ s/to://;
+ print "$extip:$extport | | $int";
+
+ }
+}
+
+print " | ";
+
+&Header::closebox();
+
&Header::closebigbox();
&Header::closepage();
@@ -197,4 +224,4 @@ sub isrunning
}
return $status;
- }
\ No newline at end of file
+ }
|