diff options
| author | Paul P. Komkoff Jr. <i@stingr.net> | 2004-09-13 02:04:36 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-09-13 02:04:36 -0700 |
| commit | 7ddd8324d0ed0c8002e2a073ffc87ed92b0ebcfc (patch) | |
| tree | ebc6d2ab658d8d786fa4a7907cfde3c6c1bbd8c1 | |
| parent | b1d66a10b4b06216f06458f555a40b01cb550e72 (diff) | |
[IPV4]: Add wccp v1/v2 support to ip_gre.c
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/linux/if_ether.h | 2 | ||||
| -rw-r--r-- | net/ipv4/ip_gre.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 11f31f6d260e..d62b4dfd8305 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -59,6 +59,8 @@ #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol + * defined in draft-wilson-wrec-wccp-v2-00.txt */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ #define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index ed106d11aba1..6f6250e5d9e1 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -603,13 +603,24 @@ int ipgre_rcv(struct sk_buff *skb) if ((tunnel = ipgre_tunnel_lookup(iph->saddr, iph->daddr, key)) != NULL) { secpath_reset(skb); + skb->protocol = *(u16*)(h + 2); + /* WCCP version 1 and 2 protocol decoding. + * - Change protocol to IP + * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header + */ + if (flags == 0 && + skb->protocol == __constant_htons(ETH_P_WCCP)) { + skb->protocol = __constant_htons(ETH_P_IP); + if ((*(h + offset) & 0xF0) != 0x40) + offset += 4; + } + skb->mac.raw = skb->nh.raw; skb->nh.raw = __pskb_pull(skb, offset); memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); if (skb->ip_summed == CHECKSUM_HW) skb->csum = csum_sub(skb->csum, csum_partial(skb->mac.raw, skb->nh.raw-skb->mac.raw, 0)); - skb->protocol = *(u16*)(h + 2); skb->pkt_type = PACKET_HOST; #ifdef CONFIG_NET_IPGRE_BROADCAST if (MULTICAST(iph->daddr)) { |
