diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-06-17 20:49:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-19 21:07:40 -0400 |
commit | bda7bb46343647f68591366731295a0f3eea59ed (patch) | |
tree | 99fa502fe0439a7776227238bfc3a5b0d4dbe7b3 /include | |
parent | 20fd4d1f04da07d09192ad8ad366a70d5125bfaf (diff) |
gre: Allow multiple protocol listener for gre protocol.
Currently there is only one user is allowed to register for gre
protocol. Following patch adds de-multiplexer. So that multiple
modules can listen on gre protocol e.g. kernel gre devices and ovs.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/gre.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/net/gre.h b/include/net/gre.h index 9f03a390c826..c6ea0c72c605 100644 --- a/include/net/gre.h +++ b/include/net/gre.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define GREPROTO_CISCO 0 | 7 | #define GREPROTO_CISCO 0 |
8 | #define GREPROTO_PPTP 1 | 8 | #define GREPROTO_PPTP 1 |
9 | #define GREPROTO_MAX 2 | 9 | #define GREPROTO_MAX 2 |
10 | #define GRE_IP_PROTO_MAX 2 | ||
10 | 11 | ||
11 | struct gre_protocol { | 12 | struct gre_protocol { |
12 | int (*handler)(struct sk_buff *skb); | 13 | int (*handler)(struct sk_buff *skb); |
@@ -22,6 +23,29 @@ struct gre_base_hdr { | |||
22 | int gre_add_protocol(const struct gre_protocol *proto, u8 version); | 23 | int gre_add_protocol(const struct gre_protocol *proto, u8 version); |
23 | int gre_del_protocol(const struct gre_protocol *proto, u8 version); | 24 | int gre_del_protocol(const struct gre_protocol *proto, u8 version); |
24 | 25 | ||
26 | struct gre_cisco_protocol { | ||
27 | int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi); | ||
28 | int (*err_handler)(struct sk_buff *skb, u32 info, | ||
29 | const struct tnl_ptk_info *tpi); | ||
30 | u8 priority; | ||
31 | }; | ||
32 | |||
33 | int gre_cisco_register(struct gre_cisco_protocol *proto); | ||
34 | int gre_cisco_unregister(struct gre_cisco_protocol *proto); | ||
35 | |||
36 | static inline int ip_gre_calc_hlen(__be16 o_flags) | ||
37 | { | ||
38 | int addend = 4; | ||
39 | |||
40 | if (o_flags&TUNNEL_CSUM) | ||
41 | addend += 4; | ||
42 | if (o_flags&TUNNEL_KEY) | ||
43 | addend += 4; | ||
44 | if (o_flags&TUNNEL_SEQ) | ||
45 | addend += 4; | ||
46 | return addend; | ||
47 | } | ||
48 | |||
25 | static inline __be16 gre_flags_to_tnl_flags(__be16 flags) | 49 | static inline __be16 gre_flags_to_tnl_flags(__be16 flags) |
26 | { | 50 | { |
27 | __be16 tflags = 0; | 51 | __be16 tflags = 0; |