Re: WCCP in 2.3.DEVEL3

From: jati <jati@dont-contact.us>
Date: Thu, 2 Dec 1999 17:14:36 +0700

i bet you'd need Glenn's ip_wccp compiled as a module...
here's the code:

/*
 * $Id: ip_wccp.c,v 1.1 1999/09/30 20:43:37 wessels Exp $
 *
 * Glenn Chisholm <glenn@ircache.net>
 */

#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 <net/ip.h>

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

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))
  goto drop;

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

 if (skb->len <= 0)
                goto drop;

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

 return ip_rcv(skb, skb->dev, NULL);

drop:
 kfree_skb(skb);
 return(0);
}

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

int init_module(void)
{
 printk(KERN_INFO "WCCP IPv4/GRE driver\n");
 inet_add_protocol(&ipgre_protocol);
 return 0;
}

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

Jati

----- Original Message -----
From: Jan Van Ham <Responsible@g-net.be>
To: <squid-users@ircache.net>
Sent: 01 Desember 1999 15:22
Subject: WCCP in 2.3.DEVEL3

> Hi,
>
> I'm running a Linux 2.2.5 box with Squid 2.3.DEVEL3 on it...
> It seems to work rather fine for forward/transparant proxy but now I want
to
> drag WCCP v1.0 in it...
> I've done such a config with an ICS and it worked on the spot !
>
> I've defined the "WCCP router" statement in squid.conf and the Cisco
> actually "sees" the web-cache..but packets that Cisco redirects seems to
get
> "lost"
>
> I'm also using "ipchains" for redirecting port 80 into 8080 (where Squid
> listens) so I have actually 2 rules
>
> ipchains -A input -j ACCEPT -i eth0 -d 10.10.10.10/32 (10.10.10.10 =
Squid)
> ipchains -A input -j REDIRECT 8080 -p tcp -d 0.0.0.0/0 80
>
> Does something suck here ? Perhaps the WCCP-packets are discarded ???
> Anyone ?
>
> Thanx in advance,
> Jan Van Ham
>
>
Received on Thu Dec 02 1999 - 03:14:46 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:49:41 MST