Modified TOS marking code!

From: Lizzy Dizzy <lizzy_99@dont-contact.us>
Date: Thu, 22 Apr 2004 09:38:51 +0000

Hi Squid Developers,

Need your help on TOS marking

I need my Squid to mark packets going back to the clients according to the
Squid result code. Requests that results in outgoing traffic, such as
TCP_MISS will be tagged at 0x20(32) whereas all other traffic will be tagged
at 0x40(64). As I do not do cache peering in my network, I've removed the
portion that talks about parent/sibling stuff (I'm modifying the ZPH patch
that's found at http://www.it-academy.bg/zph/)

Does the code looks right? Can I put the code under the "if
(http->out.offset == 0)" condition?

Thanks alot!
Lizzy

if (http->out.offset == 0) { //no data has been sent to the client yet

/*Start of ZPH*/
        int tos = 0;
        switch ( http->log_type )
        {
                case LOG_TCP_MISS:
                case LOG_TCP_REFRESH_MISS:
                case LOG_TCP_SWAPFAIL_MISS:
                case LOG_TCP_CLIENT_REFRESH_MISS:
                        tos = 32;
                        break;
                default:
                        tos = 64;
                        break;
        }

        enter_suid();
        if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
                debug(50, 1) ("ZPH: setsockopt(IP_TOS) on FD %d: %s\n", fd,
xstrerror());
        }
        leave_suid();

/*End of ZPH*/

_________________________________________________________________
Get 10mb of inbox space with MSN Hotmail Extra Storage
http://join.msn.com/?pgmarket=en-sg
Received on Thu Apr 22 2004 - 03:39:33 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Apr 29 2004 - 12:00:03 MDT