Re: htb: HowTo identify squid cache hits

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tc filter add dev <dev> protocol ip parent 1:0 pref 1 u32 match ip dst 192.168.0.12 match ip sport 8080 0xffff match ip tos 8 0xff flowid 1:12
#If squid miss, traffic will go to user queue.



tc filter add dev imq1 protocol ip parent 1:0 pref 2 u32 match ip src 192.168.0.22 match ip sport 8080 0xffff flowid 1:30
#this catch all traffic from source port Squid... but with priority 2 and throw in LAN class.


I'm using this patch:

--- CUT ---

diff -cr squid-2.5.STABLE3/src/client_side.c squid-2.5.STABLE3.patched/src/client_side.c
*** squid-2.5.STABLE3/src/client_side.c 2003-05-24 13:08:41.000000000 +0200
--- squid-2.5.STABLE3.patched/src/client_side.c 2003-08-05 22:08:15.000000000 +0200
***************
*** 2005,2010 ****
--- 2005,2013 ----
/* Avoid copying to MemBuf for non-range requests */
/* Note, if we're here, then 'rep' is known to be NULL */
http->out.offset += body_size;
+ { int tos=isTcpHit(http->log_type) ? 0 : 8;
+ setsockopt(fd,SOL_IP,IP_TOS,&tos,4);
+ }
comm_write(fd, buf, size, clientWriteBodyComplete, http, NULL);
/* NULL because clientWriteBodyComplete frees it */
return;
***************
*** 2062,2067 ****
--- 2065,2073 ----
if (!http->request->range && http->request->method == METHOD_GET)
assert(check_size == size);
/* write */
+ { int tos=isTcpHit(http->log_type) ? 0 : 8;
+ setsockopt(fd,SOL_IP,IP_TOS,&tos,4);
+ }
comm_write_mbuf(fd, mb, clientWriteComplete, http);
/* if we don't do it, who will? */
memFree(buf, MEM_CLIENT_SOCK_BUF);


--- CUT ---

If squid HIT then TOS is 0, if miss then 1.

Here is the place where you can download this: http://sed.pl/~mrk/qos/squid_hit_miss_mark.patch

Throw in to queue of LAN only traffic coming from Squid.
Upload traffic from Squid always queue in users classes.
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux