Hello all,
I'm trying to setup my box with squid 2.3 Stable 1 with WCCP
enabled. I am running into problems though with some instruction on the
following page regarding compiling a module:
http://www.squid-cache.org/Doc/FAQ/FAQ-17.html
It says, and I quote :
"This module is not part of the standard Linux distributon. It needs to be
compiled as a module and loaded on your system to function. Do not attempt
to build this in as a static
part of your kernel.
Download the Linux WCCP module and compile it as you would any Linux
network module.
Copy the module to /lib/modules/kernel-version/ipv4/ip_wccp.o. Edit
/lib/modules/kernel-version/modules.dep and add:
/lib/modules/kernel-version/ipv4/ip_wccp.o:
Finally you will need to load the module:
modprobe ip_wccp
"
I've included the source for your inspection at the bottom.
****The problem I have is, how does one compile the file, ip_wccp.c, as a
****module. I tried :
make ip_wccp.o
gcc ip_wccp.c
Often it brings up the error:
Line 19 net/ip.h : No such file or directory.
So I tried to compile it in /usr/src/linux/include so the paths were
correct. Still no luck. I tried to edit the source so it looked in the
full path for " ip.h ". It then compiled but with lots of errors.
If someone knows how I go about compiling as a module, I'd be very
appreciative.
My system: Redhat 6.1 Kernel 2.2.13
The source ip_wccp.c
-----------------------------------------------------------------------
*
* $Id: ip_wccp.c,v 1.1 1999/09/30 20:43:37 wessels Exp $
*
* Glenn Chisholm <[EMAIL PROTECTED]>
*/
#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");
}
----------------------------------------------------------------------------
--------------------------------
--- David Walsh -
--- [EMAIL PROTECTED] -
--- http://www.onthenet.com.au -
--- (07) 55933535 -
--------------------------------
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text