summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHaishuang Yan <yanhaishuang@cmss.chinamobile.com>2016-05-11 12:48:32 +0200
committerDavid S. Miller <davem@davemloft.net>2016-05-12 22:53:58 +0200
commitda73b4e9538b9be96498241ab3f13eab94181e96 (patch)
treeb22bf974053d15e37a25aa8dcf9c18a51bbd0181 /net
parentip6_gre: Fix get_size calculation for gre6 tunnel (diff)
downloadlinux-da73b4e9538b9be96498241ab3f13eab94181e96.tar.xz
linux-da73b4e9538b9be96498241ab3f13eab94181e96.zip
gre: Fix wrong tpi->proto in WCCP
When dealing with WCCP in gre6 tunnel, it sets the wrong tpi->protocol, that is, ETH_P_IP instead of ETH_P_IPV6 for the encapuslated traffic. Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/gre_demux.c6
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv6/ip6_gre.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index d78e2eefc0f7..4c39f4fd332a 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -62,7 +62,7 @@ EXPORT_SYMBOL_GPL(gre_del_protocol);
/* Fills in tpi and returns header length to be pulled. */
int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
- bool *csum_err)
+ bool *csum_err, __be16 proto)
{
const struct gre_base_hdr *greh;
__be32 *options;
@@ -109,11 +109,11 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
tpi->seq = 0;
}
/* WCCP version 1 and 2 protocol decoding.
- * - Change protocol to IP
+ * - Change protocol to IPv4/IPv6
* - When dealing with WCCPv2, Skip extra 4 bytes in GRE header
*/
if (greh->flags == 0 && tpi->proto == htons(ETH_P_WCCP)) {
- tpi->proto = htons(ETH_P_IP);
+ tpi->proto = proto;
if ((*(u8 *)options & 0xF0) != 0x40)
hdr_len += 4;
}
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2b267e71ebf5..aaeb478b54cd 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -222,7 +222,7 @@ static void gre_err(struct sk_buff *skb, u32 info)
struct tnl_ptk_info tpi;
bool csum_err = false;
- if (gre_parse_header(skb, &tpi, &csum_err) < 0) {
+ if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP)) < 0) {
if (!csum_err) /* ignore csum errors. */
return;
}
@@ -335,7 +335,7 @@ static int gre_rcv(struct sk_buff *skb)
}
#endif
- hdr_len = gre_parse_header(skb, &tpi, &csum_err);
+ hdr_len = gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP));
if (hdr_len < 0)
goto drop;
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 3c25fe67d3da..4541fa54035e 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -468,7 +468,7 @@ static int gre_rcv(struct sk_buff *skb)
bool csum_err = false;
int hdr_len;
- hdr_len = gre_parse_header(skb, &tpi, &csum_err);
+ hdr_len = gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IPV6));
if (hdr_len < 0)
goto drop;