diff -u /usr/src/linux-2.4.17-0.4.orig/Documentation/Configure.help /usr/src/linux-2.4.17-0.4/Documentation/Configure.help --- /usr/src/linux-2.4.17-0.4.orig/Documentation/Configure.help Sun Jan 20 00:31:03 2002 +++ /usr/src/linux-2.4.17-0.4/Documentation/Configure.help Mon Mar 4 17:29:13 2002 @@ -5146,6 +5146,15 @@ Network), but can be distributed all over the Internet. If you want to do that, say Y here and to "IP multicast routing" below. +IP: WCCP tunnels over IP +CONFIG_NET_IPWCCP + Tunneling means encapsulating data of one protocol type within + another protocol and sending it over a channel that understands the + encapsulating protocol. This particular tunneling driver implements + WCCP (Web Cache Coordination Protocol) GRE. This driver is useful + if you have a WCCP-enabled router, and would like to use WCCP to + redirect packets to a web cache. + IP multicast routing CONFIG_IP_MROUTE This is used if you want your machine to act as a router for IP diff -Nur /usr/src/linux-2.4.17-0.4.orig/net/ipv4/Config.in /usr/src/linux-2.4.17-0.4/net/ipv4/Config.in --- /usr/src/linux-2.4.17-0.4.orig/net/ipv4/Config.in Sun Jan 20 00:31:03 2002 +++ /usr/src/linux-2.4.17-0.4/net/ipv4/Config.in Mon Jan 21 01:57:55 2002 @@ -26,6 +26,7 @@ fi tristate ' IP: tunneling' CONFIG_NET_IPIP tristate ' IP: GRE tunnels over IP' CONFIG_NET_IPGRE +tristate ' IP: WCCP GRE tunnels over IP' CONFIG_NET_IPWCCP if [ "$CONFIG_IP_MULTICAST" = "y" ]; then if [ "$CONFIG_NET_IPGRE" != "n" ]; then bool ' IP: broadcast GRE over IP' CONFIG_NET_IPGRE_BROADCAST diff -Nur /usr/src/linux-2.4.17-0.4.orig/net/ipv4/Config.in.orig /usr/src/linux-2.4.17-0.4/net/ipv4/Config.in.orig --- /usr/src/linux-2.4.17-0.4.orig/net/ipv4/Config.in.orig Thu Jan 1 02:00:00 1970 +++ /usr/src/linux-2.4.17-0.4/net/ipv4/Config.in.orig Sun Jan 20 00:31:03 2002 @@ -0,0 +1,49 @@ +# +# IP configuration +# +bool ' IP: multicasting' CONFIG_IP_MULTICAST +bool ' IP: advanced router' CONFIG_IP_ADVANCED_ROUTER +if [ "$CONFIG_IP_ADVANCED_ROUTER" = "y" ]; then + bool ' IP: policy routing' CONFIG_IP_MULTIPLE_TABLES + if [ "$CONFIG_IP_MULTIPLE_TABLES" = "y" ]; then + if [ "$CONFIG_NETFILTER" = "y" ]; then + bool ' IP: use netfilter MARK value as routing key' CONFIG_IP_ROUTE_FWMARK + fi + bool ' IP: fast network address translation' CONFIG_IP_ROUTE_NAT + fi + bool ' IP: equal cost multipath' CONFIG_IP_ROUTE_MULTIPATH + bool ' IP: use TOS value as routing key' CONFIG_IP_ROUTE_TOS + bool ' IP: verbose route monitoring' CONFIG_IP_ROUTE_VERBOSE + bool ' IP: large routing tables' CONFIG_IP_ROUTE_LARGE_TABLES +fi +bool ' IP: kernel level autoconfiguration' CONFIG_IP_PNP +if [ "$CONFIG_IP_PNP" = "y" ]; then + bool ' IP: DHCP support' CONFIG_IP_PNP_DHCP + bool ' IP: BOOTP support' CONFIG_IP_PNP_BOOTP + bool ' IP: RARP support' CONFIG_IP_PNP_RARP +# not yet ready.. +# bool ' IP: ARP support' CONFIG_IP_PNP_ARP +fi +tristate ' IP: tunneling' CONFIG_NET_IPIP +tristate ' IP: GRE tunnels over IP' CONFIG_NET_IPGRE +if [ "$CONFIG_IP_MULTICAST" = "y" ]; then + if [ "$CONFIG_NET_IPGRE" != "n" ]; then + bool ' IP: broadcast GRE over IP' CONFIG_NET_IPGRE_BROADCAST + fi + bool ' IP: multicast routing' CONFIG_IP_MROUTE + if [ "$CONFIG_IP_MROUTE" = "y" ]; then + bool ' IP: PIM-SM version 1 support' CONFIG_IP_PIMSM_V1 + bool ' IP: PIM-SM version 2 support' CONFIG_IP_PIMSM_V2 + fi +fi +if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool ' IP: ARP daemon support (EXPERIMENTAL)' CONFIG_ARPD +fi +bool ' IP: TCP Explicit Congestion Notification support' CONFIG_INET_ECN +bool ' IP: TCP syncookie support (disabled per default)' CONFIG_SYN_COOKIES +if [ "$CONFIG_NETFILTER" != "n" ]; then + source net/ipv4/netfilter/Config.in +fi +if [ "$CONFIG_NETFILTER" != "n" ]; then + source net/ipv4/ipvs/Config.in +fi diff -Nur /usr/src/linux-2.4.17-0.4.orig/net/ipv4/Makefile /usr/src/linux-2.4.17-0.4/net/ipv4/Makefile --- /usr/src/linux-2.4.17-0.4.orig/net/ipv4/Makefile Fri Dec 21 19:42:05 2001 +++ /usr/src/linux-2.4.17-0.4/net/ipv4/Makefile Mon Jan 21 01:57:55 2002 @@ -9,7 +9,7 @@ O_TARGET := ipv4.o -export-objs = ipip.o ip_gre.o +export-objs = ipip.o ip_gre.o ip_wccp.o obj-y := utils.o route.o inetpeer.o proc.o protocol.o \ ip_input.o ip_fragment.o ip_forward.o ip_options.o \ @@ -22,6 +22,7 @@ obj-$(CONFIG_IP_ROUTE_NAT) += ip_nat_dumb.o obj-$(CONFIG_IP_MROUTE) += ipmr.o obj-$(CONFIG_NET_IPIP) += ipip.o +obj-$(CONFIG_NET_IPWCCP) += ip_wccp.o obj-$(CONFIG_NET_IPGRE) += ip_gre.o obj-$(CONFIG_SYN_COOKIES) += syncookies.o obj-$(CONFIG_IP_PNP) += ipconfig.o diff -Nur /usr/src/linux-2.4.17-0.4.orig/net/ipv4/ip_wccp.c /usr/src/linux-2.4.17-0.4/net/ipv4/ip_wccp.c --- /usr/src/linux-2.4.17-0.4.orig/net/ipv4/ip_wccp.c Thu Jan 1 02:00:00 1970 +++ /usr/src/linux-2.4.17-0.4/net/ipv4/ip_wccp.c Mon Jan 21 20:07:28 2002 @@ -0,0 +1,126 @@ +/* + * $Id: ip_wccp.c,v 1.1 1999/09/30 20:43:37 wessels Exp $ + * + * Glenn Chisholm + * Jorge Boncompte (Modified for kernel 2.4) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MODULE_LICENSE("GPL"); + +#define WCCP_PROTOCOL_TYPE 0x883E +#define WCCP_GRE_LEN sizeof(long) +#define WCCP2_GRE_EXTRA sizeof(long) + +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)) + { + printk(KERN_INFO "ip_wccp: Not a valid WCCP packet. Wrong protocol type\n"); + goto drop_nolock; + } + + read_lock(&ipwccp_lock); + + skb->mac.raw = skb->nh.raw; + /* WCCP2 puts an extra 4 octets into the header, but uses the same + encapsulation type; if it looks as if the first octet of the packet + isn't the beginning of an IPv4 header, assume it's WCCP2. */ + if ((skb->h.raw[WCCP_GRE_LEN] & 0xF0) != 0x40) { + skb->nh.raw = skb_pull(skb, skb->h.raw + WCCP_GRE_LEN + WCCP2_GRE_EXTRA - skb->data); + } else { + skb->nh.raw = skb_pull(skb, skb->h.raw + WCCP_GRE_LEN - skb->data); + } + + if (skb->len <= 0) + { + printk(KERN_INFO "ip_wccp: Not a valid IP packet. Wrong packet lenght\n"); + 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 + +/* 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));*/ +/* ip_rcv(skb, skb->dev, NULL); */ + + 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 ipgre_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(&ipgre_protocol); + return 0; +} + +#ifdef MODULE + +void cleanup_module(void) +{ + if ( inet_del_protocol(&ipgre_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