###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
+# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
# #
# 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 #
$qossettings{'DEF_INC_SPD'} = '';
$qossettings{'DEFCLASS_INC'} = '';
$qossettings{'DEFCLASS_OUT'} = '';
-$qossettings{'ACK'} = '';
$qossettings{'RED_DEV'} = 'ppp0';
$qossettings{'IMQ_DEV'} = 'imq0';
$qossettings{'VALID'} = 'yes';
$qossettings{'CLASSPRFX'} = '';
$qossettings{'DEV'} = '';
$qossettings{'TOS'} = '';
+$qossettings{'CAKE_PROFILE'} = 'conservative';
+my %CAKE_PROFILES = (
+ "ethernet" => $Lang::tr{'cake profile ethernet 38'},
+ "ethernet ether-vlan" => $Lang::tr{'cake profile ethernet vlan 42'},
+ "raw" => $Lang::tr{'cake profile raw 0'},
+ "conservative" => $Lang::tr{'cake profile conservative 48'},
+ "docsis" => $Lang::tr{'cake profile docsis 18'},
+ "bridged-ptm" => $Lang::tr{'cake profile bridged-ptm 19'},
+ "pppoe-ptm" => $Lang::tr{'cake profile pppoe-ptm 27'},
+ "pppoe-llcsnap" => $Lang::tr{'cake profile pppoe-llcsnap 40'},
+ "pppoe-vcmux" => $Lang::tr{'cake profile pppoe-vcmux 32'},
+ "pppoa-llc" => $Lang::tr{'cake profile pppoa-llc 14'},
+ "pppoa-vcmux" => $Lang::tr{'cake profile pppoa-vcmux 10'},
+ "bridged-llcsnap" => $Lang::tr{'cake profile bridged-llcsnap 32'},
+ "bridged-vcmux" => $Lang::tr{'cake profile bridged-vcmux 24'},
+ "ipoa-llcsnap" => $Lang::tr{'cake profile ipoa-llcsnap 16'},
+ "ipoa-vcmux" => $Lang::tr{'cake profile ipoa-vcmux 8'},
+);
&General::readhash("${General::swroot}/qos/settings", \%qossettings);
&Header::getcgihash(\%qossettings);
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
-my @querry = split(/\?/,$ENV{'QUERY_STRING'});
-$querry[0] = '' unless defined $querry[0];
-$querry[1] = 'hour' unless defined $querry[1];
+$selected{'CAKE_PROFILE'} = ();
+foreach my $key (keys %CAKE_PROFILES) {
+ $selected{'CAKE_PROFILE'}{$key} = '';
+}
+$selected{'CAKE_PROFILE'}{$qossettings{'CAKE_PROFILE'}} = 'selected';
-if ( $querry[0] ne ""){
- print "Content-type: image/png\n\n";
- binmode(STDOUT);
- &Graphs::updateqosgraph($querry[0],$querry[1]);
-}else{
- &Header::showhttpheaders();
+&Header::showhttpheaders();
- &Header::openpage('QoS', 1, '');
- &Header::openbigbox('100%', 'left', '', $errormessage);
+&Header::openpage('QoS', 1, '');
+&Header::openbigbox('100%', 'left', '', $errormessage);
############################################################################################################################
############################################################################################################################
;
close FILE;
}
-elsif ($qossettings{'DOTOS'} eq 'Loeschen')
+elsif ($qossettings{'DOTOS'} eq $Lang::tr{'delete'})
{
open( FILE, "< $tosfile" ) or die "Unable to read $tosfile";
@tosrules = <FILE>;
}
$qossettings{'DEFCLASS_INC'} = "210";
$qossettings{'DEFCLASS_OUT'} = "110";
- $qossettings{'ACK'} ="101";
$qossettings{'ENABLED'} = 'on';
&General::writehash("${General::swroot}/qos/settings", \%qossettings);
&General::system("/usr/local/bin/qosctrl", "generate");
if ($qossettings{'ENABLED'} eq 'on'){
my $output = "";
my @output = &General::system_output("/usr/local/bin/qosctrl", "status");
- $output = &Header::cleanhtml(@output[0],"y");
+ $output = &Header::cleanhtml(join("", @output), "y");
print "<pre>$output</pre>\n";
} else { print "$Lang::tr{'QoS not enabled'}"; }
&Header::closebox();
END
;
}
- if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
+ if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')) {
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='66%'>
<tr><td width='50%' align='right'>$Lang::tr{'downlink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_INC'}
<td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='$Lang::tr{'modify'}' />
<tr><td width='50%' align='right'>$Lang::tr{'uplink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_OUT'}
- <tr><td width='50%' align='right'>ACKs: <td width='30%' align='left'>$qossettings{'ACK'}
<tr><td colspan='3' width='100%'><hr />
<tr><td colspan='3' width='100%' align='center'>
</table>
exit
}
-if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') || ($qossettings{'ACK'} eq '') ) {
+if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') ) {
&changedefclasses();
&Header::closebigbox();
&Header::closepage();
exit
}
- &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}");
- &Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour");
- &Header::closebox();
- &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}");
- &Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour");
- &Header::closebox();
+&Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}");
+&Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour");
+&Header::closebox();
+&Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}");
+&Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour");
+&Header::closebox();
&showclasses($qossettings{'RED_DEV'});
&showclasses($qossettings{'IMQ_DEV'});
&Header::closebigbox();
&Header::closepage();
-}
-
############################################################################################################################
############################################################################################################################
else { print "<option selected value='$c'>$c</option>\n"; }
}
print <<END
- </select><td width='33%' align='center'>
- </table>
- <hr />
- <table width='66%'>
- <tr><td width='100%' colspan='3'>$Lang::tr{'enter ack class'}
- <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
-END
-;
- 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 <<END
</select><td width='33%' align='center'><input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
</table>
</form>
}
sub changebandwidth {
- &Header::openbox('100%', 'center', $Lang::tr{'bandwithsettings'});
+ &Header::openbox('100%', 'center', $Lang::tr{'bandwidthsettings'});
+
if ($qossettings{'ENABLED'} eq 'on') {
- print "$Lang::tr{'bandwitherror'}";
- print "<a href='/cgi-bin/qos.cgi'>$Lang::tr{'back'}</a>";
+ print "$Lang::tr{'bandwidtherror'}";
+ print "<table width='100%'><tr><td align='center'><a href='/cgi-bin/qos.cgi'><img src='/images/back.png' alt='$Lang::tr{'back'}' title='$Lang::tr{'back'}' /></a></td></tr></table>";
} else {
- print <<END
- <form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
- <table width='66%'>
- <tr><td width='100%' colspan='3'>$Lang::tr{'down and up speed'}</td></tr>
- <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
- <td width='30%' align='left'><input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" /></td>
- <td width='20%' align='center' rowspan='2'><input type='submit' name='ACTION' value="$Lang::tr{'template'}" /><br /><input type='submit' name='ACTION' value="$Lang::tr{'save'}" /><br /><input type='reset' name='ACTION' value="$Lang::tr{'reset'}" /></td></tr>
- <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
- <td width='30%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" /></td></tr>
- </table>
- </form>
- <font color='red'>$Lang::tr{'template warning'}</font>
+ print <<END;
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
+ <table width='66%'>
+ <tr>
+ <td width='100%' colspan='2'>$Lang::tr{'down and up speed'}</td>
+ </tr>
+ <tr>
+ <td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
+ <td width='50%' align='left'>
+ <input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" />
+ </td>
+ </tr>
+ <tr>
+ <td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
+ <td width='50%' align='left'>
+ <input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" />
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2"> </td>
+ </tr>
+
+ <tr>
+ <td width='50%' align='right'>$Lang::tr{'link-layer encapsulation'}:</td>
+ <td width='50%' align='left'>
+ <select name="CAKE_PROFILE">
+END
+
+ foreach my $key (sort { $CAKE_PROFILES{$a} cmp $CAKE_PROFILES{$b} } keys %CAKE_PROFILES) {
+ print <<END;
+ <option value="$key" $selected{'CAKE_PROFILE'}{$key}>$CAKE_PROFILES{$key}</option>
+END
+ }
+
+ print <<END;
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2"> </td>
+ </tr>
+
+ <tr>
+ <td width='100%' align='center' colspan="2">
+ <input type='submit' name='ACTION' value="$Lang::tr{'template'}" />
+ <input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
+ <input type='reset' name='ACTION' value="$Lang::tr{'reset'}" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ <font color='red'>$Lang::tr{'template warning'}</font>
END
-;
}
+
&Header::closebox();
}
print <<END
</select>
<td width='33%' align='center'>
- <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
+ <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwidth'}:
<td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
<td width='33%' align='center'>
- <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'} <img src='/blob.gif' alt='*' />:
+ <tr><td width='33%' align='right'>$Lang::tr{'max bandwidth'} <img src='/blob.gif' alt='*' />:
<td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
<td width='33%' align='center'>
<tr><td width='33%' align='right'>Burst:
<tr><td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'interface'}</b>
<td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'Class'}</b>
<td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'priority'}
- <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwith'}
- <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwith'}
+ <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwidth'}
+ <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwidth'}
<td bgcolor='$color{'color20'}' width='10%' align='center'>Burst
<td bgcolor='$color{'color20'}' width='10%' align='center'>Ceil Burst
<td bgcolor='$color{'color20'}' width='10%' align='center'>TOS
}
unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
$qossettings{'VALID'} = 'no';
- $message = "$Lang::tr{'false min bandwith'}";
+ $message = "$Lang::tr{'false min bandwidth'}";
}
$qossettings{'SPD'} = '';
}
}
unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
$qossettings{'VALID'} = 'no';
- $message = "$Lang::tr{'false max bandwith'}";
+ $message = "$Lang::tr{'false max bandwidth'}";
}
$qossettings{'SPD'} = '';
}