RE: [squid-users] WCCP v2 Help

From: Mueller, Rex <[email protected]>
Date: Wed, 24 Mar 2004 12:35:17 -0600

/*
 * $Id: ip_wccp.c,v 1.1 1999/09/30 20:43:37 wessels Exp $
 *
 * Glenn Chisholm <glenn@ircache.net>
 * Jorge Boncompte <jorge@dti2.net> (Modified for kernel 2.4) */

#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/inetdevice.h>
#include <linux/netfilter_ipv4.h>

#include <net/ip.h>

#define WCCP_PROTOCOL_TYPE 0x883E
#define WCCP_GRE_LEN sizeof(long)
#define WCCP_DEBUG 0

static rwlock_t ipwccp_lock = RW_LOCK_UNLOCKED;

int ip_wccp_rcv(struct sk_buff *skb, unsigned short len) {
        long *gre_hdr;

        gre_hdr = (unsigned long *)skb->h.raw;

        if(*gre_hdr != htonl(WCCP_PROTOCOL_TYPE))
                {
#if WCCP_DEBUG > 0
                printk(KERN_ERROR "ip_wccp: Not a valid WCCP packet.
Wrong protocol type\n"); #endif
                goto drop_nolock;
                }

        read_lock(&ipwccp_lock);

        skb->mac.raw = skb->nh.raw;
        skb->nh.raw = skb_pull(skb, skb->h.raw + WCCP_GRE_LEN -
skb->data);

        if (skb->len <= 0)
                {
#if WCCP_DEBUG > 0
                printk(KERN_INFO "ip_wccp: Not a valid IP packet. Wrong
packet lenght\n"); #endif
                goto drop;
                }

        memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
/* skb->protocol = *(u16*)(h + 2);*/
        skb->protocol = __constant_htons(ETH_P_IP);
        skb->pkt_type = PACKET_HOST;
        skb->ip_summed = 0;
        dst_release(skb->dst);
        skb->dst = NULL;

#ifdef CONFIG_NETFILTER
        nf_conntrack_put(skb->nfct);
        skb->nfct = NULL;
#ifdef CONFIG_NETFILTER_DEBUG
        skb->nf_debug = 0;
#endif
#endif

#if WCCP_DEBUG > 0
        printk(KERN_DEBUG "ip_wccp: Packet received SRC=%u.%u.%u.%u
DST=%u.%u.%u.%u \n",
               NIPQUAD(skb->nh.iph->saddr),
NIPQUAD(skb->nh.iph->daddr)); #endif
        netif_rx(skb);
        read_unlock(&ipwccp_lock);
        return(0);

drop:
        read_unlock(&ipwccp_lock);
drop_nolock:
        printk(KERN_DEBUG "ip_wccp: Packet dropped SRC=%u.%u.%u.%u
DST=%u.%u.%u.%u \n",
               NIPQUAD(skb->nh.iph->saddr),
NIPQUAD(skb->nh.iph->daddr));
        kfree_skb(skb);
        return(0);
}

static struct inet_protocol ipwccp_protocol = {
  ip_wccp_rcv,
  NULL,
  0,
  IPPROTO_GRE,
  0,
  NULL,
  "GRE"
};

#ifdef MODULE
int init_module(void)
#else
int __init ipwccp_init(void)
#endif
{
        printk(KERN_INFO "ip_wccp: WCCP IPv4/GRE driver loaded\n");
        inet_add_protocol(&ipwccp_protocol);
        return 0;
}

#ifdef MODULE

void cleanup_module(void)
{
        if ( inet_del_protocol(&ipwccp_protocol) < 0 )
                printk(KERN_INFO "ip_wccp: on close can't remove
protocol\n");
        else
                printk(KERN_INFO "ip_wccp: WCCP IPv4/GRE driver
unloaded\n"); }

#endif
MODULE_LICENSE("GPL");

-----Original Message-----
From: Depto. Investigacion y Desarrollo UNITEC [mailto:iyde@unitec.edu]
Sent: Wednesday, March 24, 2004 11:39 AM
To: squid-users@squid-cache.org
Subject: [squid-users] WCCP v2 Help

I'm trying to configure squid 2.5 stable 5 to do transparent proxing
in a Mandrake 9.1 Box with Kernel 2.4.21, I patch the source code with
the patch that I downloaded from http://devel.squid-cache.org, but
when I try to enter http://squid.visolve.com/developments/wccpv2.htm
the page redirects me to another page. I need the ip_wccp.c module for
WCCP v2, and I can't find it. Can someone tell me a place I can
download this module?

Thankx in advance,
Ricardo Jose Guevara
Received on Wed Mar 24 2004 - 11:29:20 MST

This archive was generated by hypermail pre-2.1.9 : Thu Apr 01 2004 - 12:00:02 MST