gre.h (e5451c8f8330e03ad3cfa16048b4daf961af434f) gre.h (95f5c64c3c13a609e137d35c4b452519e0b954df)
1#ifndef __LINUX_GRE_H
2#define __LINUX_GRE_H
3
4#include <linux/skbuff.h>
5#include <net/ip_tunnels.h>
6
7struct gre_base_hdr {
8 __be16 flags;

--- 11 unchanged lines hidden (view full) ---

20 void (*err_handler)(struct sk_buff *skb, u32 info);
21};
22
23int gre_add_protocol(const struct gre_protocol *proto, u8 version);
24int gre_del_protocol(const struct gre_protocol *proto, u8 version);
25
26struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
27 u8 name_assign_type);
1#ifndef __LINUX_GRE_H
2#define __LINUX_GRE_H
3
4#include <linux/skbuff.h>
5#include <net/ip_tunnels.h>
6
7struct gre_base_hdr {
8 __be16 flags;

--- 11 unchanged lines hidden (view full) ---

20 void (*err_handler)(struct sk_buff *skb, u32 info);
21};
22
23int gre_add_protocol(const struct gre_protocol *proto, u8 version);
24int gre_del_protocol(const struct gre_protocol *proto, u8 version);
25
26struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
27 u8 name_assign_type);
28int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
29 bool *csum_err, int *hdr_len);
30
31static inline int gre_calc_hlen(__be16 o_flags)
32{
33 int addend = 4;
34
35 if (o_flags & TUNNEL_CSUM)
36 addend += 4;
37 if (o_flags & TUNNEL_KEY)
38 addend += 4;
39 if (o_flags & TUNNEL_SEQ)
40 addend += 4;
41 return addend;
42}
43
44static inline __be16 gre_flags_to_tnl_flags(__be16 flags)
45{
46 __be16 tflags = 0;
47
48 if (flags & GRE_CSUM)
49 tflags |= TUNNEL_CSUM;
50 if (flags & GRE_ROUTING)
51 tflags |= TUNNEL_ROUTING;
52 if (flags & GRE_KEY)
53 tflags |= TUNNEL_KEY;
54 if (flags & GRE_SEQ)
55 tflags |= TUNNEL_SEQ;
56 if (flags & GRE_STRICT)
57 tflags |= TUNNEL_STRICT;
58 if (flags & GRE_REC)
59 tflags |= TUNNEL_REC;
60 if (flags & GRE_VERSION)
61 tflags |= TUNNEL_VERSION;
62
63 return tflags;
64}
65
66static inline __be16 gre_tnl_flags_to_gre_flags(__be16 tflags)
67{
68 __be16 flags = 0;
69
70 if (tflags & TUNNEL_CSUM)
71 flags |= GRE_CSUM;
72 if (tflags & TUNNEL_ROUTING)
73 flags |= GRE_ROUTING;
74 if (tflags & TUNNEL_KEY)
75 flags |= GRE_KEY;
76 if (tflags & TUNNEL_SEQ)
77 flags |= GRE_SEQ;
78 if (tflags & TUNNEL_STRICT)
79 flags |= GRE_STRICT;
80 if (tflags & TUNNEL_REC)
81 flags |= GRE_REC;
82 if (tflags & TUNNEL_VERSION)
83 flags |= GRE_VERSION;
84
85 return flags;
86}
87
28#endif
88#endif