• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _UAPI_IPV6_H
2 #define _UAPI_IPV6_H
3 
4 #include <linux/types.h>
5 #include <linux/in6.h>
6 #include <asm/byteorder.h>
7 
8 /* The latest drafts declared increase in minimal mtu up to 1280. */
9 
10 #define IPV6_MIN_MTU	1280
11 
12 /*
13  *	Advanced API
14  *	source interface/address selection, source routing, etc...
15  *	*under construction*
16  */
17 
18 
19 struct in6_pktinfo {
20 	struct in6_addr	ipi6_addr;
21 	int		ipi6_ifindex;
22 };
23 
24 struct ip6_mtuinfo {
25 	struct sockaddr_in6	ip6m_addr;
26 	__u32			ip6m_mtu;
27 };
28 
29 struct in6_ifreq {
30 	struct in6_addr	ifr6_addr;
31 	__u32		ifr6_prefixlen;
32 	int		ifr6_ifindex;
33 };
34 
35 #define IPV6_SRCRT_STRICT	0x01	/* Deprecated; will be removed */
36 #define IPV6_SRCRT_TYPE_0	0	/* Deprecated; will be removed */
37 #define IPV6_SRCRT_TYPE_2	2	/* IPv6 type 2 Routing Header	*/
38 
39 /*
40  *	routing header
41  */
42 struct ipv6_rt_hdr {
43 	__u8		nexthdr;
44 	__u8		hdrlen;
45 	__u8		type;
46 	__u8		segments_left;
47 
48 	/*
49 	 *	type specific data
50 	 *	variable length field
51 	 */
52 };
53 
54 
55 struct ipv6_opt_hdr {
56 	__u8 		nexthdr;
57 	__u8 		hdrlen;
58 	/*
59 	 * TLV encoded option data follows.
60 	 */
61 } __attribute__((packed));	/* required for some archs */
62 
63 #define ipv6_destopt_hdr ipv6_opt_hdr
64 #define ipv6_hopopt_hdr  ipv6_opt_hdr
65 
66 /* Router Alert option values (RFC2711) */
67 #define IPV6_OPT_ROUTERALERT_MLD	0x0000	/* MLD(RFC2710) */
68 
69 /*
70  *	routing header type 0 (used in cmsghdr struct)
71  */
72 
73 struct rt0_hdr {
74 	struct ipv6_rt_hdr	rt_hdr;
75 	__u32			reserved;
76 	struct in6_addr		addr[0];
77 
78 #define rt0_type		rt_hdr.type
79 };
80 
81 /*
82  *	routing header type 2
83  */
84 
85 struct rt2_hdr {
86 	struct ipv6_rt_hdr	rt_hdr;
87 	__u32			reserved;
88 	struct in6_addr		addr;
89 
90 #define rt2_type		rt_hdr.type
91 };
92 
93 /*
94  *	home address option in destination options header
95  */
96 
97 struct ipv6_destopt_hao {
98 	__u8			type;
99 	__u8			length;
100 	struct in6_addr		addr;
101 } __attribute__((packed));
102 
103 /*
104  *	IPv6 fixed header
105  *
106  *	BEWARE, it is incorrect. The first 4 bits of flow_lbl
107  *	are glued to priority now, forming "class".
108  */
109 
110 struct ipv6hdr {
111 #if defined(__LITTLE_ENDIAN_BITFIELD)
112 	__u8			priority:4,
113 				version:4;
114 #elif defined(__BIG_ENDIAN_BITFIELD)
115 	__u8			version:4,
116 				priority:4;
117 #else
118 #error	"Please fix <asm/byteorder.h>"
119 #endif
120 	__u8			flow_lbl[3];
121 
122 	__be16			payload_len;
123 	__u8			nexthdr;
124 	__u8			hop_limit;
125 
126 	struct	in6_addr	saddr;
127 	struct	in6_addr	daddr;
128 };
129 
130 
131 /* index values for the variables in ipv6_devconf */
132 enum {
133 	DEVCONF_FORWARDING = 0,
134 	DEVCONF_HOPLIMIT,
135 	DEVCONF_MTU6,
136 	DEVCONF_ACCEPT_RA,
137 	DEVCONF_ACCEPT_REDIRECTS,
138 	DEVCONF_AUTOCONF,
139 	DEVCONF_DAD_TRANSMITS,
140 	DEVCONF_RTR_SOLICITS,
141 	DEVCONF_RTR_SOLICIT_INTERVAL,
142 	DEVCONF_RTR_SOLICIT_DELAY,
143 	DEVCONF_USE_TEMPADDR,
144 	DEVCONF_TEMP_VALID_LFT,
145 	DEVCONF_TEMP_PREFERED_LFT,
146 	DEVCONF_REGEN_MAX_RETRY,
147 	DEVCONF_MAX_DESYNC_FACTOR,
148 	DEVCONF_MAX_ADDRESSES,
149 	DEVCONF_FORCE_MLD_VERSION,
150 	DEVCONF_ACCEPT_RA_DEFRTR,
151 	DEVCONF_ACCEPT_RA_PINFO,
152 	DEVCONF_ACCEPT_RA_RTR_PREF,
153 	DEVCONF_RTR_PROBE_INTERVAL,
154 	DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
155 	DEVCONF_PROXY_NDP,
156 	DEVCONF_OPTIMISTIC_DAD,
157 	DEVCONF_ACCEPT_SOURCE_ROUTE,
158 	DEVCONF_MC_FORWARDING,
159 	DEVCONF_DISABLE_IPV6,
160 	DEVCONF_ACCEPT_DAD,
161 	DEVCONF_FORCE_TLLAO,
162 	DEVCONF_NDISC_NOTIFY,
163 	DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
164 	DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
165 	DEVCONF_SUPPRESS_FRAG_NDISC,
166 	DEVCONF_ACCEPT_RA_FROM_LOCAL,
167 	DEVCONF_MAX
168 };
169 
170 
171 #endif /* _UAPI_IPV6_H */
172