my %qossettings = ();
my %checked = ();
my %netsettings = ();
+my $message = "";
my $errormessage = "";
my $c = "";
my $direntry = "";
+my $classentry = "";
+my $subclassentry = "";
+my $l7ruleentry = "";
+my @tmp = ();
+my @classes = ();
+my @subclasses = ();
+my @l7rules = ();
+my @tmpline = ();
+my @classline = ();
+my @subclassline = ();
+my @l7ruleline = ();
my @proto = ();
my %selected= () ;
+my $classfile = "/var/ipfire/qos/classes";
+my $subclassfile = "/var/ipfire/qos/subclasses";
+my $level7file = "/var/ipfire/qos/level7config";
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
&Header::showhttpheaders();
$qossettings{'ENABLED'} = 'off';
+$qossettings{'EDIT'} = 'no';
$qossettings{'OUT_SPD'} = '';
$qossettings{'INC_SPD'} = '';
$qossettings{'DEFCLASS_INC'} = '';
$qossettings{'ACK'} = '';
$qossettings{'RED_DEV'} = `cat /var/ipfire/red/iface`;
$qossettings{'IMQ_DEV'} = 'imq0';
+$qossettings{'VALID'} = 'yes';
&General::readhash("${General::swroot}/qos/settings", \%qossettings);
&Header::getcgihash(\%qossettings);
&Header::openpage('QoS', 1, '');
+print <<END
+<script type="text/javascript">
+<!--
+function BorderOn (id) { id.className='btnOn' }
+function BorderOff(id) { id.className='btnOff' }
+//-->
+</script>
+<style type=text/css>
+.btnOn {
+ border-right: #D5F0FF 2px Inset;
+ border-top: #D5F0FF 2px Inset;
+ border-left: #D5F0FF 2px Inset;
+ border-bottom: #D5F0FF 2px Inset;
+ text-align: Center;
+ text-decoration: None;
+ background-color: #FFFFFF;
+}
+.btnOff {
+ border-right: #D5F0FF 2px Outset;
+ border-top: #D5F0FF 2px Outset;
+ border-left: #D5F0FF 2px Outset;
+ border-bottom: #D5F0FF 2px Outset;
+ text-align: Center;
+ text-decoration: None;
+ background-color: #FFFFFF;
+}
+</style>
+END
+;
+
&Header::openbigbox('100%', 'left', '', $errormessage);
+if ($qossettings{'DO_CLASS'} eq $Lang::tr{'save'})
+{
+ &validclass();
+ &validminbwdth();
+ &validmaxbwdth();
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ open( FILE, ">> $classfile" ) or die "Unable to write $classfile";
+ print FILE <<END
+$qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};
+END
+;
+ close FILE;
+ } else {
+ $qossettings{'ACTION'} = 'Parentklasse hinzufuegen';
+ }
+}
+elsif ($qossettings{'DO_CLASS'} eq 'Bearbeiten')
+{
+ open( FILE, "< $classfile" ) or die "Unable to read $classfile";
+ @classes = <FILE>;
+ close FILE;
+ open( FILE, "> $classfile" ) or die "Unable to write $classfile";
+ foreach $classentry (sort @classes)
+ {
+ @classline = split( /\;/, $classentry );
+ if ( $classline[1] ne $qossettings{'CLASS'} ) {
+ print FILE $classentry;
+ } else {
+ $qossettings{'DEVICE'} = $classline[0];
+ $qossettings{'PRIO'} = $classline[2];
+ $qossettings{'MINBWDTH'} = $classline[3];
+ $qossettings{'MAXBWDTH'} = $classline[4];
+ $qossettings{'BURST'} = $classline[5];
+ $qossettings{'CBURST'} = $classline[6];
+ $qossettings{'EDIT'} = 'yes';
+ }
+ }
+ close FILE;
+ &parentclass();
+ &Header::closebigbox();
+ &Header::closepage();
+ exit
+}
+elsif ($qossettings{'DO_CLASS'} eq 'Loeschen')
+{
+ open( FILE, "< $classfile" ) or die "Unable to read $classfile";
+ @tmp = <FILE>;
+ close FILE;
+ open( FILE, "> $classfile" ) or die "Unable to write $classfile";
+ foreach $classentry (sort @tmp)
+ {
+ @tmpline = split( /\;/, $classentry );
+ if ( $tmpline[1] ne $qossettings{'CLASS'} )
+ {
+ print FILE $classentry;
+ }
+ }
+ close FILE;
+ $message = "Klasse $qossettings{'CLASS'} wurde geloescht.";
+}
+if ($qossettings{'DO_SCLASS'} eq $Lang::tr{'save'})
+{
+ if ($qossettings{'SCLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
+ $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
+ } elsif ($qossettings{'SCLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
+ $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
+ }
+ &validsubclass();
+ &validminbwdth();
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ open( FILE, ">> $subclassfile" ) or die "Unable to write $subclassfile";
+ print FILE <<END
+$qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'SCLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};
+END
+;
+ close FILE;
+ } else {
+ $qossettings{'ACTION'} = 'Unterklasse hinzufuegen';
+ }
+} elsif ($qossettings{'DO_SCLASS'} eq 'Loeschen')
+{
+ open( FILE, "< $subclassfile" ) or die "Unable to read $classfile";
+ @tmp = <FILE>;
+ close FILE;
+ open( FILE, "> $subclassfile" ) or die "Unable to write $classfile";
+ foreach $subclassentry (sort @tmp)
+ {
+ @tmpline = split( /\;/, $subclassentry );
+ if ( $tmpline[2] ne $qossettings{'CLASS'} )
+ {
+ print FILE $subclassentry;
+ }
+ }
+ close FILE;
+ $message = "Unterklasse $qossettings{'CLASS'} wurde geloescht.";
+}
+if ($qossettings{'DO_LEVEL7'} eq $Lang::tr{'save'})
+{
+ if ( $qossettings{'QIP'} ne '' ) {
+ unless ( &General::validip($qossettings{'QIP'}) ) {
+ $qossettings{'VALID'} = 'no';
+ $message = "Die Quell-IP-Adresse ist ungueltig.";
+ }
+ }
+ if ( $qossettings{'DIP'} ne '' ) {
+ unless ( &General::validip($qossettings{'DIP'}) ) {
+ $qossettings{'VALID'} = 'no';
+ $message = "Die Ziel-IP-Adresse ist ungueltig.";
+ }
+ }
+ if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
+ $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
+ } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
+ $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
+ } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
+ $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
+ } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
+ $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
+ }
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ open( FILE, ">> $level7file" ) or die "Unable to write $level7file";
+ print FILE <<END
+$qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'L7PROT'};$qossettings{'QIP'};$qossettings{'DIP'};
+END
+;
+ close FILE;
+ } else {
+ $qossettings{'ACTION'} = 'Level7-Regel hinzufuegen';
+ }
+}
+elsif ($qossettings{'DO_LEVEL7'} eq 'Loeschen')
+{
+ open( FILE, "< $level7file" ) or die "Unable to read $level7file";
+ @l7rules = <FILE>;
+ close FILE;
+ open( FILE, "> $level7file" ) or die "Unable to read $level7file";
+ foreach $l7ruleentry (sort @l7rules)
+ {
+ @l7ruleline = split( /\;/, $l7ruleentry );
+ if ( ($l7ruleline[0] ne $qossettings{'CLASS'}) && ($l7ruleline[2] ne $qossettings{'L7PROT'}))
+ {
+ print FILE $l7ruleentry;
+ }
+ }
+ close FILE;
+ $message = "Level7-Regel ($qossettings{'CLASS'} - $qossettings{'L7PROT'}) wurde geloescht.";
+}
if ($qossettings{'ACTION'} eq 'Start')
{
system("/bin/touch /var/ipfire/qos/enable");
&Header::closepage();
exit
}
+elsif ($qossettings{'ACTION'} eq 'Unterklasse hinzufuegen')
+{
+ &subclass();
+ &Header::closebigbox();
+ &Header::closepage();
+ exit
+}
elsif ($qossettings{'ACTION'} eq 'Level7-Regel hinzufuegen')
{
&level7rule();
&Header::closepage();
exit
}
+elsif ($qossettings{'ACTION'} eq 'Port-Regel hinzufuegen')
+{
+ &portrule();
+ &Header::closebigbox();
+ &Header::closepage();
+ exit
+}
if ($qossettings{'ACTION_BW'} eq 'Andern')
{
&changebandwidth();
&Header::closebox();
}
+############################################################################################################################
+############################################################################################################################
+
&Header::openbox('100%', 'center', 'Quality of Service');
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='33%'>
+END
+;
+ if ( $message ne "" ) {
+ print "<tr><td colspan='2' align='center'><font color='red'>$message</font>";
+ }
+ print <<END
<tr><td width='50%' align='left'><b>Quality of Service:</b>
<td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font>
<tr><td width='100%' align='center' colspan='2'>
print <<END
<tr><td colspan='3'>
<tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'INC_SPD'} kbps
- <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTION_BW' value='Andern'>
+ <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTION_BW' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)' value='Andern'>
<tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'OUT_SPD'} kbps
END
;
print <<END
<tr><td colspan='3'><hr>
<tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'>$qossettings{'DEFCLASS_INC'}
- <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTION_DEF' value='Andern'>
+ <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTION_DEF' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)' value='Andern'>
<tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'>$qossettings{'DEFCLASS_OUT'}
<tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'>$qossettings{'ACK'}
- <tr><td colspan='3' width='100%'><hr>
- <tr><td colspan='3' width='100%' align='center'><input type='submit' name='ACTION' value='Parentklasse hinzufuegen'>
- <tr><td colspan='3' width='100%' align='center'>Nur temporaer >>> <input type='submit' name='ACTION' value='Level7-Regel hinzufuegen'> <<<
+ <tr><td colspan='3' width='100%'><hr>
+ <tr><td colspan='3' width='100%' align='center'><input type='submit' name='ACTION' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)' value='Parentklasse hinzufuegen'>
+ </form>
END
;
}
exit
}
-
-# &Header::openbox('100%', 'center', 'Outgoing Interface');
-# print <<END
-# <table border='0' width='100%' cellspacing='0'>
-# <tr><td bgcolor='lightgrey' width='20%'>Interface<td bgcolor='lightgrey' width='20%'>Klasse<td bgcolor='lightgrey' width='20%'>Maximale Geschwindigkeit<td bgcolor='lightgrey' width='40%'>Aktionen
-# </table>
-#END
-#;
-# &Header::closebox();
+&showclasses();
+&showl7rules();
&Header::closebigbox();
&Header::closepage();
-# ---------------------------------------------------------------------------------------------------------------------------------
+############################################################################################################################
+############################################################################################################################
sub changedefclasses {
&Header::openbox('100%', 'center', 'Standardklassen:');
<tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
END
;
- for ( $c = 100 ; $c <= 120 ; $c++ )
+ for ( $c = 200 ; $c <= 220 ; $c++ )
{
if ( $qossettings{'DEFCLASS_INC'} ne $c )
- {
- print "<option value='$c'>$c</option>\n";
- }
- else
- {
- print "<option selected value='$c'>$c</option>\n";
- }
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
}
print <<END
</select><td width='33%' align='center'>
<tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
END
;
- for ( $c = 200 ; $c <= 220 ; $c++ )
+ for ( $c = 100 ; $c <= 120 ; $c++ )
{
if ( $qossettings{'DEFCLASS_OUT'} ne $c )
- {
- print "<option value='$c'>$c</option>\n";
- }
- else
- {
- print "<option selected value='$c'>$c</option>\n";
- }
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
}
print <<END
</select><td width='33%' align='center'>
<tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
END
;
- for ( $c = 200 ; $c <= 220 ; $c++ )
+ for ( $c = 100 ; $c <= 120 ; $c++ )
{
if ( $qossettings{'ACK'} ne $c )
- {
- print "<option value='$c'>$c</option>\n";
- }
- else
- {
- print "<option selected value='$c'>$c</option>\n";
- }
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
}
print <<END
</select><td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
}
sub parentclass {
- &Header::openbox('100%', 'center', 'Parentklasse hinzufuegen');
+ &Header::openbox('100%', 'center', 'Parentklasse');
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='66%'>
+END
+;
+ if ( $message ne "" ) {
+ print "<tr><td colspan='3' align='center'>$message";
+ }
+ if ( $qossettings{'EDIT'} eq 'yes' ) {
+ print "<input type='hidden' name='CLASS' value=$qossettings{'CLASS'}>";
+ print "<input type='hidden' name='DEVICE' value=$qossettings{'DEVICE'}>";
+ }
+ print <<END
<tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
<tr><td width='33%' align='right'>Interface:
- <td width='33%' align='left'><select name='CLASS'>
- <option value=$qossettings{'RED_DEV'}>$qossettings{'RED_DEV'}</option>
- <option value=$qossettings{'IMQ_DEV'}>$qossettings{'IMQ_DEV'}</option></select>
+ <td width='33%' align='left'>
+END
+;
+ if ( $qossettings{'EDIT'} eq 'yes' ) {
+ print "<select name='DEVICE' disabled>";
+ } else {
+ print "<select name='DEVICE'>";
+ }
+ if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
+ $qossettings{'RED_DEV_SEL'} = 'selected';
+ } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
+ $qossettings{'IMQ_DEV_SEL'} = 'selected';
+ }
+ print <<END
+ <option value=$qossettings{'RED_DEV'} $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
+ <option value=$qossettings{'IMQ_DEV'} $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
<td width='33%' align='center'>
- <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'><select name='CLASS'>
+ <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
END
;
+ if ( $qossettings{'EDIT'} eq 'yes' ) {
+ print "<select name='CLASS' disabled>";
+ } else {
+ print "<select name='CLASS'>";
+ }
for ( $c = 100 ; $c <= 120 ; $c++ )
{
if ( $qossettings{'CLASS'} ne $c )
- {
- print "<option value='$c'>$c</option>\n";
- }
- else
- {
- print "<option selected value='$c'>$c</option>\n";
- }
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
}
for ( $c = 200 ; $c <= 220 ; $c++ )
{
if ( $qossettings{'CLASS'} ne $c )
- {
- print "<option value='$c'>$c</option>\n";
- }
- else
- {
- print "<option selected value='$c'>$c</option>\n";
- }
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
}
print <<END
</select>
for ( $c = 1 ; $c <= 7 ; $c++ )
{
if ( $qossettings{'PRIO'} ne $c )
- {
- print "<option value='$c'>$c</option>\n";
- }
- else
- {
- print "<option selected value='$c'>$c</option>\n";
- }
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
}
print <<END
<td width='33%' align='center'>
<tr><td width='33%' align='right'>Garantierte Bandbreite:
- <td width='33%' align='left'><input type='text' name='MINBDWTH' maxlength='8' value=$qossettings{'MINBWDTH'}>
+ <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=$qossettings{'MINBWDTH'} >
<td width='33%' align='center'>
<tr><td width='33%' align='right'>Maximale Bandbreite:
- <td width='33%' align='left'><input type='text' name='MAXBDWTH' maxlength='8' value=$qossettings{'MAXBWDTH'}>
+ <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=$qossettings{'MAXBWDTH'}>
<td width='33%' align='center'>
<tr><td width='33%' align='right'>Burst:
<td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=$qossettings{'BURST'}>
<td width='33%' align='center'>
<tr><td width='33%' align='right'>Ceilburst:
<td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=$qossettings{'CBURST'}>
- <td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
+ <td width='33%' align='center'><input type='submit' name='DO_CLASS' value=$Lang::tr{'save'} /> <input type='reset' value=$Lang::tr{'reset'} />
</table></form>
END
;
&Header::closebox();
}
-sub level7rule {
- &Header::openbox('100%', 'center', 'Level7-Regel hinzufuegen');
+sub subclass {
+ &Header::openbox('100%', 'center', 'Unterklasse');
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='66%'>
+END
+;
+ if ( $message ne "" ) {
+ print "<tr><td colspan='3' align='center'>$message";
+ }
+ print <<END
+ <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings{'CLASS'}
<tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
- <tr><td width='33%' align='right'>Name:
- <td width='33%' align='left'><input type='text' name='NAME' maxlength='20' value=$qossettings{'NAME'}>
+ <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
+END
+;
+ if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
+ $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
+ for ( $c = 1000 ; $c <= 1020 ; $c++ )
+ {
+ if ( $qossettings{'SCLASS'} ne $c )
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
+ }
+ } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
+ $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
+ for ( $c = 2000 ; $c <= 2020 ; $c++ )
+ {
+ if ( $qossettings{'SCLASS'} ne $c )
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
+ }
+ }
+ print <<END
+ </select>
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
+END
+;
+ for ( $c = 1 ; $c <= 7 ; $c++ )
+ {
+ if ( $qossettings{'PRIO'} ne $c )
+ { print "<option value='$c'>$c</option>\n"; }
+ else { print "<option selected value='$c'>$c</option>\n"; }
+ }
+ print <<END
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Garantierte Bandbreite:
+ <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=$qossettings{'MINBWDTH'} >
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Maximale Bandbreite:
+ <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=$qossettings{'MAXBWDTH'}>
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Burst:
+ <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=$qossettings{'BURST'}>
<td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Ceilburst:
+ <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=$qossettings{'CBURST'}>
+ <td width='33%' align='center'><input type='hidden' name='CLASS' value=$qossettings{'CLASS'}><input type='submit' name='DO_SCLASS' value=$Lang::tr{'save'} /> <input type='reset' value=$Lang::tr{'reset'} />
+ </table></form>
+END
+;
+ &Header::closebox();
+}
+
+
+sub level7rule {
+ &Header::openbox('100%', 'center', 'Level7-Regel');
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <table width='66%'>
+END
+;
+ if ( $message ne "" ) {
+ print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
+ }
+ print <<END
+ <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings{'CLASS'}
+ <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
<tr><td width='33%' align='right'>Protokoll:
<td width='33%' align='left'><select name='L7PROT'>
END
<td width='33%' align='center'>
<tr><td width='33%' align='right'>Ziel-IP-Adresse:
<td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value=$qossettings{'DIP'}>
- <td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
+ <td width='33%' align='center'><input type='hidden' name='CLASS' value=$qossettings{'CLASS'}><input type='submit' name='DO_LEVEL7' value=$Lang::tr{'save'} />
</table></form>
END
;
&Header::closebox();
+}
+
+sub portrule {
+ &Header::openbox('100%', 'center', 'Port-Regel hinzufuegen');
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <table width='66%'>
+ <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
+ <tr><td width='33%' align='right'>Name:
+ <td width='33%' align='left'><input type='text' name='NAME' maxlength='20' value=$qossettings{'NAME'}>
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Protokoll:
+ <td width='33%' align='left'><select name='PPROT'>
+END
+;
+ open( FILE, "< /etc/protocols" );
+ @proto = <FILE>;
+ close FILE;
+ foreach $direntry (sort @proto)
+ {
+ @tmpline = split( /\ /, $direntry );
+ next if $tmpline[0] =~ "#";
+ if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
+ print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
+ } else {
+ print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
+ }
+ }
+ print <<END
+ </select><td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Quell-Port:
+ <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value=$qossettings{'QPORT'}>
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Ziel-Port:
+ <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value=$qossettings{'DPORT'}>
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Quell-IP-Adresse:
+ <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value=$qossettings{'QIP'}>
+ <td width='33%' align='center'>
+ <tr><td width='33%' align='right'>Ziel-IP-Adresse:
+ <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value=$qossettings{'DIP'}>
+ <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
+ </table></form>
+END
+;
+ &Header::closebox();
+}
+
+sub showclasses {
+ open( FILE, "< $classfile" ) or die "Unable to read $classfile";
+ @classes = <FILE>;
+ close FILE;
+ if (@classes) {
+ open( FILE, "< $subclassfile" ) or die "Unable to read $subclassfile";
+ @subclasses = <FILE>;
+ close FILE;
+ &Header::openbox('100%', 'center', 'Klassen');
+ print <<END
+ <table border='0' width='100%' cellspacing='0'>
+ <tr><td bgcolor='lightgrey' width='10%'>Interface
+ <td bgcolor='lightgrey' width='10%'>Klasse
+ <td bgcolor='lightgrey' width='10%'>Prioritaet
+ <td bgcolor='lightgrey' width='10%'>Garantierte Bandbreite
+ <td bgcolor='lightgrey' width='10%'>Maximale Bandbreite
+ <td bgcolor='lightgrey' width='10%'>Burst
+ <td bgcolor='lightgrey' width='10%'>Ceil Burst
+ <td bgcolor='lightgrey' width='30%'>Aktionen
+END
+;
+ foreach $classentry (sort @classes)
+ {
+ @classline = split( /\;/, $classentry );
+ if ( $classline[0] eq $qossettings{'RED_DEV'} )
+ {
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <tr><td align='center' bgcolor='#EAEAEA'>$classline[0]
+ <td align='center' bgcolor='#EAEAEA'>$classline[1]
+ <td align='center' bgcolor='#EAEAEA'>$classline[2]
+ <td align='center' bgcolor='#EAEAEA'>$classline[3]
+ <td align='center' bgcolor='#EAEAEA'>$classline[4]
+ <td align='center' bgcolor='#EAEAEA'>$classline[5]
+ <td align='center' bgcolor='#EAEAEA'>$classline[6]
+ <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value='$classline[1]'>
+ <button type='submit' name='DO_CLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
+ <button type='submit' name='ACTION' value='Unterklasse hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addblue.gif' width="20" height="20" alt="Unterklasse hinzufuegen"></button>
+ <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
+ <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
+ <button type='submit' name='DO_CLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
+ </form>
+END
+;
+ foreach $subclassentry (sort @subclasses)
+ {
+ @subclassline = split( /\;/, $subclassentry );
+ if ( $subclassline[1] eq $classline[1] ) {
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <tr><td align='center' bgcolor='#FFFFFF'>Subklasse:
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[2]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[3]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[4]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[5]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[6]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[7]
+ <td align='right' bgcolor='#FAFAFA'><input type='hidden' name='CLASS' value='$subclassline[2]'>
+ <button type='submit' name='DO_SCLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
+ <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
+ <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
+ <button type='submit' name='DO_SCLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
+ </form>
+END
+;
+ }
+ }
+ }
+ }
+ print "\t<tr><td colspan='8' bgcolor='lightgrey' height='2'>";
+ foreach $classentry (sort @classes)
+ {
+ @classline = split( /\;/, $classentry );
+ if ( $classline[0] eq $qossettings{'IMQ_DEV'} )
+ {
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <tr><td align='center' bgcolor='#EAEAEA'>$classline[0]
+ <td align='center' bgcolor='#EAEAEA'>$classline[1]
+ <td align='center' bgcolor='#EAEAEA'>$classline[2]
+ <td align='center' bgcolor='#EAEAEA'>$classline[3]
+ <td align='center' bgcolor='#EAEAEA'>$classline[4]
+ <td align='center' bgcolor='#EAEAEA'>$classline[5]
+ <td align='center' bgcolor='#EAEAEA'>$classline[6]
+ <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value='$classline[1]'>
+ <button type='submit' name='DO_CLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
+ <button type='submit' name='ACTION' value='Unterklasse hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addblue.gif' width="20" height="20" alt="Unterklasse hinzufuegen"></button>
+ <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
+ <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
+ <button type='submit' name='DO_CLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
+ </form>
+END
+;
+ foreach $subclassentry (sort @subclasses)
+ {
+ @subclassline = split( /\;/, $subclassentry );
+ if ( $subclassline[1] eq $classline[1] ) {
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <tr><td align='center' bgcolor='#FFFFFF'>Subklasse:
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[2]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[3]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[4]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[5]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[6]
+ <td align='center' bgcolor='#FAFAFA'>$subclassline[7]
+ <td align='right' bgcolor='#FAFAFA'><input type='hidden' name='CLASS' value='$subclassline[2]'>
+ <button type='submit' name='DO_SCLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
+ <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
+ <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
+ <button type='submit' name='DO_SCLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
+ </form>
+END
+;
+ }
+ }
+ }
+ }
+ print "\t</table>\n";
+ &Header::closebox();
+ }
+}
+
+sub showl7rules {
+ open( FILE, "< $level7file" ) or die "Unable to read $level7file";
+ @l7rules = <FILE>;
+ close FILE;
+ if (@l7rules) {
+ &Header::openbox('100%', 'center', 'Level7-Regeln');
+ print <<END
+ <table border='0' width='100%' cellspacing='0'>
+ <tr><td bgcolor='lightgrey' width='14%'>Interface
+ <td bgcolor='lightgrey' width='14%'>Klasse
+ <td bgcolor='lightgrey' width='14%'>Protokoll
+ <td bgcolor='lightgrey' width='14%'>Quell-IP-Adresse
+ <td bgcolor='lightgrey' width='14%'>Ziel-IP-Adresse
+ <td bgcolor='lightgrey' width='30%'>Aktionen
+END
+;
+ foreach $l7ruleentry (sort @l7rules)
+ {
+ @l7ruleline = split( /\;/, $l7ruleentry );
+ if ( $l7ruleline[1] eq $qossettings{'RED_DEV'} )
+ {
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <tr><td align='center' bgcolor='#EAEAEA'>$l7ruleline[1]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[0]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[2]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[3]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[4]
+ <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value='$l7ruleline[0]'><input type='hidden' name='L7PROT' value='$l7ruleline[2]'>
+ <button type='submit' name='DO_LEVEL7' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
+ <button type='submit' name='DO_LEVEL7' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
+ </form>
+END
+;
+ }
+ }
+ print "\t<tr><td colspan='8' bgcolor='lightgrey' height='2'>";
+ foreach $l7ruleentry (sort @l7rules)
+ {
+ @l7ruleline = split( /\;/, $l7ruleentry );
+ if ( $l7ruleline[1] eq $qossettings{'IMQ_DEV'} )
+ {
+ print <<END
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <tr><td align='center' bgcolor='#EAEAEA'>$l7ruleline[1]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[0]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[2]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[3]
+ <td align='center' bgcolor='#EAEAEA'>$l7ruleline[4]
+ <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value='$l7ruleline[0]'><input type='hidden' name='L7PROT' value='$l7ruleline[2]'>
+ <button type='submit' name='DO_LEVEL7' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
+ <button type='submit' name='DO_LEVEL7' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
+ </form>
+END
+;
+ }
+ }
+ print "\t</table>\n";
+ &Header::closebox();
+ }
+}
+
+
+sub validminbwdth {
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
+ $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
+ } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
+ $qossettings{'SPD'} = $qossettings{'INC_SPD'};
+ }
+ unless ( ( $qossettings{'MINBDWTH'} >= 0 ) && ( $qossettings{'MINBDWTH'} <= $qossettings{'SPD'} ) ) {
+ $qossettings{'VALID'} = 'no';
+ $message = "Mindestbandbreite ist ungueltig.";
+ }
+ $qossettings{'SPD'} = '';
+ }
+}
+sub validmaxbwdth {
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
+ $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
+ } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
+ $qossettings{'SPD'} = $qossettings{'INC_SPD'};
+ }
+ unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
+ $qossettings{'VALID'} = 'no';
+ $message = "Mamimalbandbreite ist ungueltig.";
+ }
+ $qossettings{'SPD'} = '';
+ }
+}
+
+sub validclass {
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
+ if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
+ $qossettings{'VALID'} = 'no';
+ $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
+ }
+ } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
+ if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
+ $qossettings{'VALID'} = 'no';
+ $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
+ }
+ }
+ open( FILE, "< $classfile" ) or die "Unable to read $classfile";
+ @tmp = <FILE>;
+ close FILE;
+ foreach $classentry (sort @tmp)
+ {
+ @tmpline = split( /\;/, $classentry );
+ if ( $tmpline[1] eq $qossettings{'CLASS'} )
+ {
+ $qossettings{'VALID'} = 'no';
+ $message = "Die aktuelle Klasse wird bereits verwendet.";
+ last
+ }
+ }
+ }
+}
+sub validsubclass {
+ if ( $qossettings{'VALID'} eq 'yes' ) {
+ open( FILE, "< $subclassfile" ) or die "Unable to read $subclassfile";
+ @tmp = <FILE>;
+ close FILE;
+ foreach $subclassentry (sort @tmp)
+ {
+ @tmpline = split( /\;/, $subclassentry );
+ if ( $tmpline[2] eq $qossettings{'SCLASS'} )
+ {
+ $qossettings{'VALID'} = 'no';
+ $message = "Die aktuelle Klasse wird bereits verwendet.";
+ last
+ }
+ }
+ }
}
\ No newline at end of file