diff options
Diffstat (limited to 'net/ipv4/gre_demux.c')
-rw-r--r-- | net/ipv4/gre_demux.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c index a4bf22ee3aed..7c4a41dc04bb 100644 --- a/net/ipv4/gre_demux.c +++ b/net/ipv4/gre_demux.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <net/protocol.h> | 26 | #include <net/protocol.h> |
27 | #include <net/gre.h> | 27 | #include <net/gre.h> |
28 | #include <net/erspan.h> | ||
28 | 29 | ||
29 | #include <net/icmp.h> | 30 | #include <net/icmp.h> |
30 | #include <net/route.h> | 31 | #include <net/route.h> |
@@ -119,6 +120,22 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, | |||
119 | hdr_len += 4; | 120 | hdr_len += 4; |
120 | } | 121 | } |
121 | tpi->hdr_len = hdr_len; | 122 | tpi->hdr_len = hdr_len; |
123 | |||
124 | /* ERSPAN ver 1 and 2 protocol sets GRE key field | ||
125 | * to 0 and sets the configured key in the | ||
126 | * inner erspan header field | ||
127 | */ | ||
128 | if (greh->protocol == htons(ETH_P_ERSPAN) || | ||
129 | greh->protocol == htons(ETH_P_ERSPAN2)) { | ||
130 | struct erspan_base_hdr *ershdr; | ||
131 | |||
132 | if (!pskb_may_pull(skb, nhs + hdr_len + sizeof(*ershdr))) | ||
133 | return -EINVAL; | ||
134 | |||
135 | ershdr = (struct erspan_base_hdr *)options; | ||
136 | tpi->key = cpu_to_be32(get_session_id(ershdr)); | ||
137 | } | ||
138 | |||
122 | return hdr_len; | 139 | return hdr_len; |
123 | } | 140 | } |
124 | EXPORT_SYMBOL(gre_parse_header); | 141 | EXPORT_SYMBOL(gre_parse_header); |