#!/usr/bin/perl # # IPFire CGIs # # This code is distributed under the terms of the GPL # # (c) The IPFire Team # use strict; # enable only the following on debugging purpose use warnings; use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; my %upnpsettings = (); my %netsettings = (); my $message = ""; my $errormessage = ""; my %selected= () ; my %servicenames =('UPnP Daemon' => 'upnpd',); &Header::showhttpheaders(); ############################################################################################################################ ############################################### Setzen von Standartwerten ################################################## $upnpsettings{'DEBUGMODE'} = '3'; $upnpsettings{'FORWARDRULES'} = 'yes'; $upnpsettings{'DOWNSTREAM'} = '900000'; $upnpsettings{'UPSTREAM'} = '16000000'; $upnpsettings{'DESCRIPTION'} = 'gatedesc.xml'; $upnpsettings{'XML'} = '/etc/linuxigd'; $upnpsettings{'ENABLED'} = 'off'; $upnpsettings{'friendlyName'} = 'IpFire Upnp Device'; ### Values that have to be initialized $upnpsettings{'ACTION'} = ''; &General::readhash("${General::swroot}/upnp/settings", \%upnpsettings); &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &Header::getcgihash(\%upnpsettings); &Header::openpage('UPnP', 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); ############################################################################################################################ ################################################### Speichern der Config ################################################### if ($upnpsettings{'ACTION'} eq $Lang::tr{'save'}) { $upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} * 8; $upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} * 8; &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings); open (FILE, ">${General::swroot}/upnp/upnpd.conf") or die "Can't save the upnp config: $!"; flock (FILE, 2); print FILE <$errormessage\n"; print " \n"; &Header::closebox(); } ############################################################################################################################ ############################################################################################################################ &Header::openbox('100%', 'center', 'UPnP'); print < END ; if ( $message ne "" ) {print "\n";} else {print "\n"; } print "
$message";} my $lines = 0; my $key = ''; foreach $key (sort keys %servicenames) { if ($lines % 2) {print "
$key\n"; my $shortname = $servicenames{$key}; my $status = &isrunning($shortname); print "$status\n"; $lines++; } print <Alle Dienste:

$Lang::tr{'options'}


Debug Mode:
Forward Rules:

Down Stream in KB:
Up Strean in KB:

XML Document:
Description Document:
Upnp Device Name:




END ; &Header::closebox(); &Header::closebigbox(); &Header::closepage(); ############################################################################################################################ ############################################################################################################################ sub isrunning { my $cmd = $_[0]; my $status = "$Lang::tr{'stopped'}"; my $pid = ''; my $testcmd = ''; my $exename; $cmd =~ /(^[a-z]+)/; $exename = $1; if (open(FILE, "/var/run/${cmd}.pid")) { $pid = ; chomp $pid; close FILE; if (open(FILE, "/proc/${pid}/status")) { while () {if (/^Name:\W+(.*)/) {$testcmd = $1; }} close FILE; if ($testcmd =~ /$exename/) {$status = "$Lang::tr{'running'}";} } } return $status; }