xref: /linux/include/uapi/linux/ipv6.h (revision c2943f14534bdc4230f4da6dcd4ea03c5d8c8162)
1607ca46eSDavid Howells #ifndef _UAPI_IPV6_H
2607ca46eSDavid Howells #define _UAPI_IPV6_H
3607ca46eSDavid Howells 
4c66ad9caSWillem de Bruijn #include <linux/libc-compat.h>
5607ca46eSDavid Howells #include <linux/types.h>
6607ca46eSDavid Howells #include <linux/in6.h>
7607ca46eSDavid Howells #include <asm/byteorder.h>
8607ca46eSDavid Howells 
9607ca46eSDavid Howells /* The latest drafts declared increase in minimal mtu up to 1280. */
10607ca46eSDavid Howells 
11607ca46eSDavid Howells #define IPV6_MIN_MTU	1280
12607ca46eSDavid Howells 
13607ca46eSDavid Howells /*
14607ca46eSDavid Howells  *	Advanced API
15607ca46eSDavid Howells  *	source interface/address selection, source routing, etc...
16607ca46eSDavid Howells  *	*under construction*
17607ca46eSDavid Howells  */
18607ca46eSDavid Howells 
193b50d902SWANG Cong #if __UAPI_DEF_IN6_PKTINFO
20607ca46eSDavid Howells struct in6_pktinfo {
21607ca46eSDavid Howells 	struct in6_addr	ipi6_addr;
22607ca46eSDavid Howells 	int		ipi6_ifindex;
23607ca46eSDavid Howells };
243b50d902SWANG Cong #endif
25607ca46eSDavid Howells 
263b50d902SWANG Cong #if __UAPI_DEF_IP6_MTUINFO
27607ca46eSDavid Howells struct ip6_mtuinfo {
28607ca46eSDavid Howells 	struct sockaddr_in6	ip6m_addr;
29607ca46eSDavid Howells 	__u32			ip6m_mtu;
30607ca46eSDavid Howells };
313b50d902SWANG Cong #endif
32607ca46eSDavid Howells 
33607ca46eSDavid Howells struct in6_ifreq {
34607ca46eSDavid Howells 	struct in6_addr	ifr6_addr;
35607ca46eSDavid Howells 	__u32		ifr6_prefixlen;
36607ca46eSDavid Howells 	int		ifr6_ifindex;
37607ca46eSDavid Howells };
38607ca46eSDavid Howells 
39607ca46eSDavid Howells #define IPV6_SRCRT_STRICT	0x01	/* Deprecated; will be removed */
40607ca46eSDavid Howells #define IPV6_SRCRT_TYPE_0	0	/* Deprecated; will be removed */
41607ca46eSDavid Howells #define IPV6_SRCRT_TYPE_2	2	/* IPv6 type 2 Routing Header	*/
42607ca46eSDavid Howells 
43607ca46eSDavid Howells /*
44607ca46eSDavid Howells  *	routing header
45607ca46eSDavid Howells  */
46607ca46eSDavid Howells struct ipv6_rt_hdr {
47607ca46eSDavid Howells 	__u8		nexthdr;
48607ca46eSDavid Howells 	__u8		hdrlen;
49607ca46eSDavid Howells 	__u8		type;
50607ca46eSDavid Howells 	__u8		segments_left;
51607ca46eSDavid Howells 
52607ca46eSDavid Howells 	/*
53607ca46eSDavid Howells 	 *	type specific data
54607ca46eSDavid Howells 	 *	variable length field
55607ca46eSDavid Howells 	 */
56607ca46eSDavid Howells };
57607ca46eSDavid Howells 
58607ca46eSDavid Howells 
59607ca46eSDavid Howells struct ipv6_opt_hdr {
60607ca46eSDavid Howells 	__u8 		nexthdr;
61607ca46eSDavid Howells 	__u8 		hdrlen;
62607ca46eSDavid Howells 	/*
63607ca46eSDavid Howells 	 * TLV encoded option data follows.
64607ca46eSDavid Howells 	 */
65607ca46eSDavid Howells } __attribute__((packed));	/* required for some archs */
66607ca46eSDavid Howells 
67607ca46eSDavid Howells #define ipv6_destopt_hdr ipv6_opt_hdr
68607ca46eSDavid Howells #define ipv6_hopopt_hdr  ipv6_opt_hdr
69607ca46eSDavid Howells 
70dd3332bfSYOSHIFUJI Hideaki / 吉藤英明 /* Router Alert option values (RFC2711) */
71dd3332bfSYOSHIFUJI Hideaki / 吉藤英明 #define IPV6_OPT_ROUTERALERT_MLD	0x0000	/* MLD(RFC2710) */
72607ca46eSDavid Howells 
73607ca46eSDavid Howells /*
74607ca46eSDavid Howells  *	routing header type 0 (used in cmsghdr struct)
75607ca46eSDavid Howells  */
76607ca46eSDavid Howells 
77607ca46eSDavid Howells struct rt0_hdr {
78607ca46eSDavid Howells 	struct ipv6_rt_hdr	rt_hdr;
79607ca46eSDavid Howells 	__u32			reserved;
80607ca46eSDavid Howells 	struct in6_addr		addr[0];
81607ca46eSDavid Howells 
82607ca46eSDavid Howells #define rt0_type		rt_hdr.type
83607ca46eSDavid Howells };
84607ca46eSDavid Howells 
85607ca46eSDavid Howells /*
86607ca46eSDavid Howells  *	routing header type 2
87607ca46eSDavid Howells  */
88607ca46eSDavid Howells 
89607ca46eSDavid Howells struct rt2_hdr {
90607ca46eSDavid Howells 	struct ipv6_rt_hdr	rt_hdr;
91607ca46eSDavid Howells 	__u32			reserved;
92607ca46eSDavid Howells 	struct in6_addr		addr;
93607ca46eSDavid Howells 
94607ca46eSDavid Howells #define rt2_type		rt_hdr.type
95607ca46eSDavid Howells };
96607ca46eSDavid Howells 
97607ca46eSDavid Howells /*
98607ca46eSDavid Howells  *	home address option in destination options header
99607ca46eSDavid Howells  */
100607ca46eSDavid Howells 
101607ca46eSDavid Howells struct ipv6_destopt_hao {
102607ca46eSDavid Howells 	__u8			type;
103607ca46eSDavid Howells 	__u8			length;
104607ca46eSDavid Howells 	struct in6_addr		addr;
105607ca46eSDavid Howells } __attribute__((packed));
106607ca46eSDavid Howells 
107607ca46eSDavid Howells /*
108607ca46eSDavid Howells  *	IPv6 fixed header
109607ca46eSDavid Howells  *
110607ca46eSDavid Howells  *	BEWARE, it is incorrect. The first 4 bits of flow_lbl
111607ca46eSDavid Howells  *	are glued to priority now, forming "class".
112607ca46eSDavid Howells  */
113607ca46eSDavid Howells 
114607ca46eSDavid Howells struct ipv6hdr {
115607ca46eSDavid Howells #if defined(__LITTLE_ENDIAN_BITFIELD)
116607ca46eSDavid Howells 	__u8			priority:4,
117607ca46eSDavid Howells 				version:4;
118607ca46eSDavid Howells #elif defined(__BIG_ENDIAN_BITFIELD)
119607ca46eSDavid Howells 	__u8			version:4,
120607ca46eSDavid Howells 				priority:4;
121607ca46eSDavid Howells #else
122607ca46eSDavid Howells #error	"Please fix <asm/byteorder.h>"
123607ca46eSDavid Howells #endif
124607ca46eSDavid Howells 	__u8			flow_lbl[3];
125607ca46eSDavid Howells 
126607ca46eSDavid Howells 	__be16			payload_len;
127607ca46eSDavid Howells 	__u8			nexthdr;
128607ca46eSDavid Howells 	__u8			hop_limit;
129607ca46eSDavid Howells 
130607ca46eSDavid Howells 	struct	in6_addr	saddr;
131607ca46eSDavid Howells 	struct	in6_addr	daddr;
132607ca46eSDavid Howells };
133607ca46eSDavid Howells 
134607ca46eSDavid Howells 
135607ca46eSDavid Howells /* index values for the variables in ipv6_devconf */
136607ca46eSDavid Howells enum {
137607ca46eSDavid Howells 	DEVCONF_FORWARDING = 0,
138607ca46eSDavid Howells 	DEVCONF_HOPLIMIT,
139607ca46eSDavid Howells 	DEVCONF_MTU6,
140607ca46eSDavid Howells 	DEVCONF_ACCEPT_RA,
141607ca46eSDavid Howells 	DEVCONF_ACCEPT_REDIRECTS,
142607ca46eSDavid Howells 	DEVCONF_AUTOCONF,
143607ca46eSDavid Howells 	DEVCONF_DAD_TRANSMITS,
144607ca46eSDavid Howells 	DEVCONF_RTR_SOLICITS,
145607ca46eSDavid Howells 	DEVCONF_RTR_SOLICIT_INTERVAL,
146607ca46eSDavid Howells 	DEVCONF_RTR_SOLICIT_DELAY,
147607ca46eSDavid Howells 	DEVCONF_USE_TEMPADDR,
148607ca46eSDavid Howells 	DEVCONF_TEMP_VALID_LFT,
149607ca46eSDavid Howells 	DEVCONF_TEMP_PREFERED_LFT,
150607ca46eSDavid Howells 	DEVCONF_REGEN_MAX_RETRY,
151607ca46eSDavid Howells 	DEVCONF_MAX_DESYNC_FACTOR,
152607ca46eSDavid Howells 	DEVCONF_MAX_ADDRESSES,
153607ca46eSDavid Howells 	DEVCONF_FORCE_MLD_VERSION,
154607ca46eSDavid Howells 	DEVCONF_ACCEPT_RA_DEFRTR,
155607ca46eSDavid Howells 	DEVCONF_ACCEPT_RA_PINFO,
156607ca46eSDavid Howells 	DEVCONF_ACCEPT_RA_RTR_PREF,
157607ca46eSDavid Howells 	DEVCONF_RTR_PROBE_INTERVAL,
158607ca46eSDavid Howells 	DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
159607ca46eSDavid Howells 	DEVCONF_PROXY_NDP,
160607ca46eSDavid Howells 	DEVCONF_OPTIMISTIC_DAD,
161607ca46eSDavid Howells 	DEVCONF_ACCEPT_SOURCE_ROUTE,
162607ca46eSDavid Howells 	DEVCONF_MC_FORWARDING,
163607ca46eSDavid Howells 	DEVCONF_DISABLE_IPV6,
164607ca46eSDavid Howells 	DEVCONF_ACCEPT_DAD,
165607ca46eSDavid Howells 	DEVCONF_FORCE_TLLAO,
1665cb04436SHannes Frederic Sowa 	DEVCONF_NDISC_NOTIFY,
167fc4eba58SHannes Frederic Sowa 	DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
168fc4eba58SHannes Frederic Sowa 	DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
169b800c3b9SHannes Frederic Sowa 	DEVCONF_SUPPRESS_FRAG_NDISC,
170d9333196SBen Greear 	DEVCONF_ACCEPT_RA_FROM_LOCAL,
1717fd2561eSErik Kline 	DEVCONF_USE_OPTIMISTIC,
172*c2943f14SHarout Hedeshian 	DEVCONF_ACCEPT_RA_MTU,
173607ca46eSDavid Howells 	DEVCONF_MAX
174607ca46eSDavid Howells };
175607ca46eSDavid Howells 
176607ca46eSDavid Howells 
177607ca46eSDavid Howells #endif /* _UAPI_IPV6_H */
178