Hinzugefügt:

* Viele Schritte weiter im QoS-GUI...
  * Alten IPCop-Shaper aus den Startscripts entfernt.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@182 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2006-06-24 21:57:29 +00:00
parent b40388bb90
commit 2db5d93292
2 changed files with 276 additions and 67 deletions

View File

@@ -16,19 +16,24 @@ require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
my %qossettings=();
my %checked=();
my %netsettings=();
my %qossettings = ();
my %checked = ();
my %netsettings = ();
my $errormessage = "";
my $c = "";
my $direntry = "";
my @proto = ();
my %selected= () ;
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
&Header::showhttpheaders();
$qossettings{'ACTION'} = '';
$qossettings{'ACTION_BW'} = '';
$qossettings{'ENABLED'} = '';
$qossettings{'ENABLED'} = 'off';
$qossettings{'OUT_SPD'} = '';
$qossettings{'INC_SPD'} = '';
$qossettings{'DEFCLASS_INC'} = '';
$qossettings{'DEFCLASS_OUT'} = '';
$qossettings{'ACK'} = '';
$qossettings{'RED_DEV'} = `cat /var/ipfire/red/iface`;
$qossettings{'IMQ_DEV'} = 'imq0';
@@ -36,10 +41,8 @@ $qossettings{'IMQ_DEV'} = 'imq0';
&Header::getcgihash(\%qossettings);
&Header::openpage('QoS', 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
if ($qossettings{'ACTION'} eq 'Start')
{
system("/bin/touch /var/ipfire/qos/enable");
@@ -56,25 +59,30 @@ elsif ($qossettings{'ACTION'} eq $Lang::tr{'save'})
{
&General::writehash("${General::swroot}/qos/settings", \%qossettings);
}
elsif ($qossettings{'ACTION'} eq 'Parentklasse hinzufuegen')
{
&parentclass();
&Header::closebigbox();
&Header::closepage();
exit
}
elsif ($qossettings{'ACTION'} eq 'Level7-Regel hinzufuegen')
{
&level7rule();
&Header::closebigbox();
&Header::closepage();
exit
}
if ($qossettings{'ACTION_BW'} eq 'Andern')
{
&Header::openbox('100%', 'center', 'Bandbreiteneinstellungen');
if ($qossettings{'ENABLED'} eq 'on') {
print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>";
print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>";
} else {
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='66%'>
<tr><td width='100%' colspan='3'>Geben Sie bitte hier ihre Download- bzw. Upload-Geschwindigkeit ein <br> und klicken Sie danach auf <i>Speichern</i>.
<tr><td width='33%' align='right'>Download-Geschwindigkeit:<td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=$qossettings{'INC_SPD'}> &nbsp; kbps<td width='33%' align='center'>&nbsp;
<tr><td width='33%' align='right'>Upload-Geschwindigkeit:<td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8'value=$qossettings{'OUT_SPD'}> &nbsp; kbps<td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
</table>
</form>
END
;
}
&Header::closebox();
&changebandwidth();
&Header::closebigbox();
&Header::closepage();
exit
}
if ($qossettings{'ACTION_DEF'} eq 'Andern')
{
&changedefclasses();
&Header::closebigbox();
&Header::closepage();
exit
@@ -106,17 +114,31 @@ print <<END
<table width='33%'>
<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'> <input type='submit' name='ACTION' value='Start' />
<input type='submit' name='ACTION' value='Stop' />
<input type='submit' name='ACTION' value='$Lang::tr{'restart'}' />
<tr><td width='100%' align='center' colspan='2'>
<input type='submit' name='ACTION' value='Start' />
<input type='submit' name='ACTION' value='Stop' />
<input type='submit' name='ACTION' value='$Lang::tr{'restart'}' />
END
;
if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
print <<END
<tr><td colspan='3'>&nbsp;
<tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'INC_SPD'} <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTION_BW' value='Andern'>
<tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'OUT_SPD'}
<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'>
<tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'OUT_SPD'} kbps
END
;
}
if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
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'>
<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'> <<<
END
;
}
@@ -124,43 +146,234 @@ print "</table>";
&Header::closebox();
if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
&Header::openbox('100%', 'center', "Outgoing ($qossettings{'RED_DEV'})");
print <<END
<table width='66%'>
<tr><td width='100%' colspan='3'>Geben Sie bitte hier ihre Download- bzw. Upload-Geschwindigkeit ein <br> und klicken Sie danach auf <i>Speichern</i>.
<tr><td width='33%' align='right'>Download-Geschwindigkeit:<td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8'> &nbsp; kbps<td width='33%' align='center'>&nbsp;
<tr><td width='33%' align='right'>Upload-Geschwindigkeit:<td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8'> &nbsp; kbps<td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
</table>
</form>
END
;
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit
}
if ( $qossettings{'RED_DEV'} ne '' ) {
&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
<tr><td bgcolor='black' height='2px' colspan='4'>
<tr><td>ppp0<td>198<td>512<td>BLA
<tr><td bgcolor='lightgrey'>ppp0<td bgcolor='lightgrey'>199<td bgcolor='lightgrey'>512<td bgcolor='lightgrey'>BLA
</table>
END
;
&Header::closebox();
} else {
&Header::openbox('100%', 'center', 'Outgoing Interface');
print "Es ist kein rotes Interface vorhanden.";
&changebandwidth();
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit
}
if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') || ($qossettings{'ACK'} eq '') ) {
&changedefclasses();
&Header::closebigbox();
&Header::closepage();
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();
&Header::closebigbox();
&Header::closepage();
# ---------------------------------------------------------------------------------------------------------------------------------
sub changedefclasses {
&Header::openbox('100%', 'center', 'Standardklassen:');
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='66%'>
<tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
<tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
END
;
for ( $c = 100 ; $c <= 120 ; $c++ )
{
if ( $qossettings{'DEFCLASS_INC'} 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'>&nbsp;
<tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
END
;
for ( $c = 200 ; $c <= 220 ; $c++ )
{
if ( $qossettings{'DEFCLASS_OUT'} 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'>&nbsp;
</table>
<hr>
<table width='66%'>
<tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br> und klicken Sie danach auf <i>Speichern</i>.
<tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
END
;
for ( $c = 200 ; $c <= 220 ; $c++ )
{
if ( $qossettings{'ACK'} 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'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
</table>
</form>
END
;
&Header::closebox();
}
sub changebandwidth {
&Header::openbox('100%', 'center', 'Bandbreiteneinstellungen');
if ($qossettings{'ENABLED'} eq 'on') {
print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>";
print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>";
} else {
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='66%'>
<tr><td width='100%' colspan='3'>Geben Sie bitte hier ihre Download- bzw. Upload-Geschwindigkeit ein <br> und klicken Sie danach auf <i>Speichern</i>.
<tr><td width='33%' align='right'>Download-Geschwindigkeit:
<td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=$qossettings{'INC_SPD'}> &nbsp; kbps
<td width='33%' align='center'>&nbsp;
<tr><td width='33%' align='right'>Upload-Geschwindigkeit:
<td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=$qossettings{'OUT_SPD'}> &nbsp; kbps
<td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />&nbsp;<input type='reset' name='ACTION' value=$Lang::tr{'reset'} />
</table>
</form>
END
;
}
&Header::closebox();
}
sub parentclass {
&Header::openbox('100%', 'center', 'Parentklasse 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'>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='center'>&nbsp;
<tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'><select name='CLASS'>
END
;
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";
}
}
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 <<END
</select>
<td width='33%' align='center'>&nbsp;
<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'>&nbsp;
<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='center'>&nbsp;
<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='center'>&nbsp;
<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'>&nbsp;
<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'} />
</table></form>
END
;
&Header::closebox();
}
sub level7rule {
&Header::openbox('100%', 'center', 'Level7-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'>&nbsp;
<tr><td width='33%' align='right'>Protokoll:
<td width='33%' align='left'><select name='L7PROT'>
END
;
opendir( DIR, "/etc/l7-protocols/protocols" );
foreach $direntry ( sort readdir(DIR) )
{
next if $direntry eq ".";
next if $direntry eq "..";
next if -d "/etc/l7-protocols/protocols/$direntry";
@proto = split( /\./, $direntry );
if ( $proto[0] eq $qossettings{'L7PROT'} ) {
print "<option value='$proto[0]' selected>$proto[0]</option>\n";
} else {
print "<option value='$proto[0]'>$proto[0]</option>\n";
}
}
closedir DIR;
print <<END
</select><td width='33%' align='center'>&nbsp;
<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'>&nbsp;
<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'} />
</table></form>
END
;
&Header::closebox();
}

View File

@@ -134,11 +134,7 @@ if [ -e "CONFIG_ROOT/red/active" ]; then
/etc/rc.d/rc.firewall reload
/usr/local/bin/setfilters
/usr/local/bin/restartsnort red
unset ENABLE
eval $(/usr/local/bin/readhash CONFIG_ROOT/shaping/settings)
if [ "$ENABLE" == "on" ]; then
/usr/local/bin/restartshaping
fi
# Add QoS-Call here!
/usr/local/bin/setportfw
/usr/local/bin/setxtaccess
/usr/local/bin/setddns.pl -f