Home | History | Annotate | Download | only in linux
      1 #ifndef _UAPI_IF_TUNNEL_H_
      2 #define _UAPI_IF_TUNNEL_H_
      3 
      4 #include <linux/types.h>
      5 #include <linux/if.h>
      6 #include <linux/ip.h>
      7 #include <linux/in6.h>
      8 #include <asm/byteorder.h>
      9 
     10 
     11 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
     12 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
     13 #define SIOCDELTUNNEL   (SIOCDEVPRIVATE + 2)
     14 #define SIOCCHGTUNNEL   (SIOCDEVPRIVATE + 3)
     15 #define SIOCGETPRL      (SIOCDEVPRIVATE + 4)
     16 #define SIOCADDPRL      (SIOCDEVPRIVATE + 5)
     17 #define SIOCDELPRL      (SIOCDEVPRIVATE + 6)
     18 #define SIOCCHGPRL      (SIOCDEVPRIVATE + 7)
     19 #define SIOCGET6RD      (SIOCDEVPRIVATE + 8)
     20 #define SIOCADD6RD      (SIOCDEVPRIVATE + 9)
     21 #define SIOCDEL6RD      (SIOCDEVPRIVATE + 10)
     22 #define SIOCCHG6RD      (SIOCDEVPRIVATE + 11)
     23 
     24 #define GRE_CSUM	__cpu_to_be16(0x8000)
     25 #define GRE_ROUTING	__cpu_to_be16(0x4000)
     26 #define GRE_KEY		__cpu_to_be16(0x2000)
     27 #define GRE_SEQ		__cpu_to_be16(0x1000)
     28 #define GRE_STRICT	__cpu_to_be16(0x0800)
     29 #define GRE_REC		__cpu_to_be16(0x0700)
     30 #define GRE_ACK		__cpu_to_be16(0x0080)
     31 #define GRE_FLAGS	__cpu_to_be16(0x0078)
     32 #define GRE_VERSION	__cpu_to_be16(0x0007)
     33 
     34 #define GRE_IS_CSUM(f)		((f) & GRE_CSUM)
     35 #define GRE_IS_ROUTING(f)	((f) & GRE_ROUTING)
     36 #define GRE_IS_KEY(f)		((f) & GRE_KEY)
     37 #define GRE_IS_SEQ(f)		((f) & GRE_SEQ)
     38 #define GRE_IS_STRICT(f)	((f) & GRE_STRICT)
     39 #define GRE_IS_REC(f)		((f) & GRE_REC)
     40 #define GRE_IS_ACK(f)		((f) & GRE_ACK)
     41 
     42 #define GRE_VERSION_0		__cpu_to_be16(0x0000)
     43 #define GRE_VERSION_1		__cpu_to_be16(0x0001)
     44 #define GRE_PROTO_PPP		__cpu_to_be16(0x880b)
     45 #define GRE_PPTP_KEY_MASK	__cpu_to_be32(0xffff)
     46 
     47 struct ip_tunnel_parm {
     48 	char			name[IFNAMSIZ];
     49 	int			link;
     50 	__be16			i_flags;
     51 	__be16			o_flags;
     52 	__be32			i_key;
     53 	__be32			o_key;
     54 	struct iphdr		iph;
     55 };
     56 
     57 enum {
     58 	IFLA_IPTUN_UNSPEC,
     59 	IFLA_IPTUN_LINK,
     60 	IFLA_IPTUN_LOCAL,
     61 	IFLA_IPTUN_REMOTE,
     62 	IFLA_IPTUN_TTL,
     63 	IFLA_IPTUN_TOS,
     64 	IFLA_IPTUN_ENCAP_LIMIT,
     65 	IFLA_IPTUN_FLOWINFO,
     66 	IFLA_IPTUN_FLAGS,
     67 	IFLA_IPTUN_PROTO,
     68 	IFLA_IPTUN_PMTUDISC,
     69 	IFLA_IPTUN_6RD_PREFIX,
     70 	IFLA_IPTUN_6RD_RELAY_PREFIX,
     71 	IFLA_IPTUN_6RD_PREFIXLEN,
     72 	IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
     73 	IFLA_IPTUN_ENCAP_TYPE,
     74 	IFLA_IPTUN_ENCAP_FLAGS,
     75 	IFLA_IPTUN_ENCAP_SPORT,
     76 	IFLA_IPTUN_ENCAP_DPORT,
     77 	IFLA_IPTUN_COLLECT_METADATA,
     78 	__IFLA_IPTUN_MAX,
     79 };
     80 #define IFLA_IPTUN_MAX	(__IFLA_IPTUN_MAX - 1)
     81 
     82 enum tunnel_encap_types {
     83 	TUNNEL_ENCAP_NONE,
     84 	TUNNEL_ENCAP_FOU,
     85 	TUNNEL_ENCAP_GUE,
     86 };
     87 
     88 #define TUNNEL_ENCAP_FLAG_CSUM		(1<<0)
     89 #define TUNNEL_ENCAP_FLAG_CSUM6		(1<<1)
     90 #define TUNNEL_ENCAP_FLAG_REMCSUM	(1<<2)
     91 
     92 /* SIT-mode i_flags */
     93 #define	SIT_ISATAP	0x0001
     94 
     95 struct ip_tunnel_prl {
     96 	__be32			addr;
     97 	__u16			flags;
     98 	__u16			__reserved;
     99 	__u32			datalen;
    100 	__u32			__reserved2;
    101 	/* data follows */
    102 };
    103 
    104 /* PRL flags */
    105 #define	PRL_DEFAULT		0x0001
    106 
    107 struct ip_tunnel_6rd {
    108 	struct in6_addr		prefix;
    109 	__be32			relay_prefix;
    110 	__u16			prefixlen;
    111 	__u16			relay_prefixlen;
    112 };
    113 
    114 enum {
    115 	IFLA_GRE_UNSPEC,
    116 	IFLA_GRE_LINK,
    117 	IFLA_GRE_IFLAGS,
    118 	IFLA_GRE_OFLAGS,
    119 	IFLA_GRE_IKEY,
    120 	IFLA_GRE_OKEY,
    121 	IFLA_GRE_LOCAL,
    122 	IFLA_GRE_REMOTE,
    123 	IFLA_GRE_TTL,
    124 	IFLA_GRE_TOS,
    125 	IFLA_GRE_PMTUDISC,
    126 	IFLA_GRE_ENCAP_LIMIT,
    127 	IFLA_GRE_FLOWINFO,
    128 	IFLA_GRE_FLAGS,
    129 	IFLA_GRE_ENCAP_TYPE,
    130 	IFLA_GRE_ENCAP_FLAGS,
    131 	IFLA_GRE_ENCAP_SPORT,
    132 	IFLA_GRE_ENCAP_DPORT,
    133 	IFLA_GRE_COLLECT_METADATA,
    134 	IFLA_GRE_IGNORE_DF,
    135 	__IFLA_GRE_MAX,
    136 };
    137 
    138 #define IFLA_GRE_MAX	(__IFLA_GRE_MAX - 1)
    139 
    140 /* VTI-mode i_flags */
    141 #define VTI_ISVTI ((__force __be16)0x0001)
    142 
    143 enum {
    144 	IFLA_VTI_UNSPEC,
    145 	IFLA_VTI_LINK,
    146 	IFLA_VTI_IKEY,
    147 	IFLA_VTI_OKEY,
    148 	IFLA_VTI_LOCAL,
    149 	IFLA_VTI_REMOTE,
    150 	__IFLA_VTI_MAX,
    151 };
    152 
    153 #define IFLA_VTI_MAX	(__IFLA_VTI_MAX - 1)
    154 #endif /* _UAPI_IF_TUNNEL_H_ */
    155