1 #ifndef _IF_TUNNEL_H_
2 #define _IF_TUNNEL_H_
3 
4 #include <linux/types.h>
5 #include <asm/byteorder.h>
6 
7 #ifdef __KERNEL__
8 #include <linux/ip.h>
9 #include <linux/in6.h>
10 #endif
11 
12 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
13 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
14 #define SIOCDELTUNNEL   (SIOCDEVPRIVATE + 2)
15 #define SIOCCHGTUNNEL   (SIOCDEVPRIVATE + 3)
16 #define SIOCGETPRL      (SIOCDEVPRIVATE + 4)
17 #define SIOCADDPRL      (SIOCDEVPRIVATE + 5)
18 #define SIOCDELPRL      (SIOCDEVPRIVATE + 6)
19 #define SIOCCHGPRL      (SIOCDEVPRIVATE + 7)
20 #define SIOCGET6RD      (SIOCDEVPRIVATE + 8)
21 #define SIOCADD6RD      (SIOCDEVPRIVATE + 9)
22 #define SIOCDEL6RD      (SIOCDEVPRIVATE + 10)
23 #define SIOCCHG6RD      (SIOCDEVPRIVATE + 11)
24 
25 #define GRE_CSUM	__cpu_to_be16(0x8000)
26 #define GRE_ROUTING	__cpu_to_be16(0x4000)
27 #define GRE_KEY		__cpu_to_be16(0x2000)
28 #define GRE_SEQ		__cpu_to_be16(0x1000)
29 #define GRE_STRICT	__cpu_to_be16(0x0800)
30 #define GRE_REC		__cpu_to_be16(0x0700)
31 #define GRE_FLAGS	__cpu_to_be16(0x00F8)
32 #define GRE_VERSION	__cpu_to_be16(0x0007)
33 
34 struct ip_tunnel_parm {
35 	char			name[IFNAMSIZ];
36 	int			link;
37 	__be16			i_flags;
38 	__be16			o_flags;
39 	__be32			i_key;
40 	__be32			o_key;
41 	struct iphdr		iph;
42 };
43 
44 /* SIT-mode i_flags */
45 #define	SIT_ISATAP	0x0001
46 
47 struct ip_tunnel_prl {
48 	__be32			addr;
49 	__u16			flags;
50 	__u16			__reserved;
51 	__u32			datalen;
52 	__u32			__reserved2;
53 	/* data follows */
54 };
55 
56 /* PRL flags */
57 #define	PRL_DEFAULT		0x0001
58 
59 struct ip_tunnel_6rd {
60 	struct in6_addr		prefix;
61 	__be32			relay_prefix;
62 	__u16			prefixlen;
63 	__u16			relay_prefixlen;
64 };
65 
66 enum {
67 	IFLA_GRE_UNSPEC,
68 	IFLA_GRE_LINK,
69 	IFLA_GRE_IFLAGS,
70 	IFLA_GRE_OFLAGS,
71 	IFLA_GRE_IKEY,
72 	IFLA_GRE_OKEY,
73 	IFLA_GRE_LOCAL,
74 	IFLA_GRE_REMOTE,
75 	IFLA_GRE_TTL,
76 	IFLA_GRE_TOS,
77 	IFLA_GRE_PMTUDISC,
78 	__IFLA_GRE_MAX,
79 };
80 
81 #define IFLA_GRE_MAX	(__IFLA_GRE_MAX - 1)
82 
83 #endif /* _IF_TUNNEL_H_ */
84