I once again suggest you to try the new patch version that eliminates the necessity of modifying the patch source code. You should only use this patch if you are doing the traffic shaping on the same machine where SQUID is working. In such cases you can gain a little bandwidth (no options field in the packets). If you have a more complex topology (DMZ, for instance) try the new version - it is mote versatile.
This patch is extremely simple in design and any suggestions and improvements are welcome. Currently there is no other way to configure the qdisc handle that will dequeue the HIT type of traffic, except hardcode it in the patch. The current handle is 1:60 and it can be set before or after patching SQUID's source. All you have to do is change this line (in the .diff file of the patch or in the patched file client_side.c from SQUID's source tree):
,to the value of your qdisc handle that will accept the HIT packets. For example, if your handle is 1A:999, the value for priority should be 0x001A0999.unsigned long priority = 0x00010060;
LANDEV=eth1
TC=/sbin/tc
DOWNLINK=506
$TC qdisc add dev $LANDEV root handle 1: htb default 10
$TC class add dev $LANDEV parent 1: classid 1:1 htb rate ${DOWNLINK}kbit
$TC class add dev $LANDEV parent 1: classid 1:60 htb rate 1kbit ceil 100mbit
$TC class add dev $LANDEV parent 1:1 classid 1:10 htb \
rate $[2*$DOWNLINK/10]kbit ceil ${DOWNLINK}kbit
$TC class add dev $LANDEV parent 1:1 classid 1:20 htb \
rate $[3*$DOWNLINK/10]kbit ceil ${DOWNLINK}kbit
$TC class add dev $LANDEV parent 1:1 classid 1:30 htb \
rate $[5*$DOWNLINK/10]kbit ceil ${DOWNLINK}kbit
$TC qdisc add dev $LANDEV parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $LANDEV parent 1:20 handle 20: sfq perturb 10
$TC qdisc add dev $LANDEV parent 1:30 handle 30: sfq perturb 10
This example sets up 4 classes. Three of them (1:10,1:20,1:30) impose the QoS groups within the LAN. They all get SFQ qdisc. The forth class is a special one. Its handle is 1:60 - the one setup in SQUID's patch. This class has a very low rate (only 1 kbit), but its ceil is the maximum possible bandwidth. The low rate and high ceil makes all trafic destined to this handle to go out of $LANDEV device with wire speed, without disturbing the ratios between the other three classes in times of congestions. This class (1:60) is served by the default FIFO qdisc associated with the $LANDEV device.
The associated filters that send traffic to 1:10,1:20 and 1:30 are not shown
since they are irrelevant here.
tar -zxvf squid-2.5.STABLE3.tar.gz3. Change to SQUID's source directory and apply the patch (this assumes you have downloaded the patch one directory above SQUID's source):
or, for the bzip2 archive:
tar -jxvf squid-2.5.STABLE3.tar.bz2
cd squid-2.5.STABLE34. Follow SQUID's INSTALL guide to configure, compile and install the engine.
patch -p1 < ../squid-2.5.STABLE3-hit_prio.diff
tc -s class show dev eth1where you substitute eth1 with your internal (where the clients are connected) device name.