| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 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 |  | 
|  | 67 | /* | 
|  | 68 | *	routing header type 0 (used in cmsghdr struct) | 
|  | 69 | */ | 
|  | 70 |  | 
|  | 71 | struct rt0_hdr { | 
|  | 72 | struct ipv6_rt_hdr	rt_hdr; | 
|  | 73 | __u32			reserved; | 
|  | 74 | struct in6_addr		addr[0]; | 
|  | 75 |  | 
|  | 76 | #define rt0_type		rt_hdr.type | 
|  | 77 | }; | 
|  | 78 |  | 
|  | 79 | /* | 
|  | 80 | *	routing header type 2 | 
|  | 81 | */ | 
|  | 82 |  | 
|  | 83 | struct rt2_hdr { | 
|  | 84 | struct ipv6_rt_hdr	rt_hdr; | 
|  | 85 | __u32			reserved; | 
|  | 86 | struct in6_addr		addr; | 
|  | 87 |  | 
|  | 88 | #define rt2_type		rt_hdr.type | 
|  | 89 | }; | 
|  | 90 |  | 
|  | 91 | /* | 
|  | 92 | *	home address option in destination options header | 
|  | 93 | */ | 
|  | 94 |  | 
|  | 95 | struct ipv6_destopt_hao { | 
|  | 96 | __u8			type; | 
|  | 97 | __u8			length; | 
|  | 98 | struct in6_addr		addr; | 
|  | 99 | } __attribute__((packed)); | 
|  | 100 |  | 
|  | 101 | /* | 
|  | 102 | *	IPv6 fixed header | 
|  | 103 | * | 
|  | 104 | *	BEWARE, it is incorrect. The first 4 bits of flow_lbl | 
|  | 105 | *	are glued to priority now, forming "class". | 
|  | 106 | */ | 
|  | 107 |  | 
|  | 108 | struct ipv6hdr { | 
|  | 109 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 
|  | 110 | __u8			priority:4, | 
|  | 111 | version:4; | 
|  | 112 | #elif defined(__BIG_ENDIAN_BITFIELD) | 
|  | 113 | __u8			version:4, | 
|  | 114 | priority:4; | 
|  | 115 | #else | 
|  | 116 | #error	"Please fix <asm/byteorder.h>" | 
|  | 117 | #endif | 
|  | 118 | __u8			flow_lbl[3]; | 
|  | 119 |  | 
|  | 120 | __be16			payload_len; | 
|  | 121 | __u8			nexthdr; | 
|  | 122 | __u8			hop_limit; | 
|  | 123 |  | 
|  | 124 | struct	in6_addr	saddr; | 
|  | 125 | struct	in6_addr	daddr; | 
|  | 126 | }; | 
|  | 127 |  | 
|  | 128 |  | 
|  | 129 | /* index values for the variables in ipv6_devconf */ | 
|  | 130 | enum { | 
|  | 131 | DEVCONF_FORWARDING = 0, | 
|  | 132 | DEVCONF_HOPLIMIT, | 
|  | 133 | DEVCONF_MTU6, | 
|  | 134 | DEVCONF_ACCEPT_RA, | 
|  | 135 | DEVCONF_ACCEPT_REDIRECTS, | 
|  | 136 | DEVCONF_AUTOCONF, | 
|  | 137 | DEVCONF_DAD_TRANSMITS, | 
|  | 138 | DEVCONF_RTR_SOLICITS, | 
|  | 139 | DEVCONF_RTR_SOLICIT_INTERVAL, | 
|  | 140 | DEVCONF_RTR_SOLICIT_DELAY, | 
|  | 141 | DEVCONF_USE_TEMPADDR, | 
|  | 142 | DEVCONF_TEMP_VALID_LFT, | 
|  | 143 | DEVCONF_TEMP_PREFERED_LFT, | 
|  | 144 | DEVCONF_REGEN_MAX_RETRY, | 
|  | 145 | DEVCONF_MAX_DESYNC_FACTOR, | 
|  | 146 | DEVCONF_MAX_ADDRESSES, | 
|  | 147 | DEVCONF_FORCE_MLD_VERSION, | 
|  | 148 | DEVCONF_ACCEPT_RA_DEFRTR, | 
|  | 149 | DEVCONF_ACCEPT_RA_PINFO, | 
|  | 150 | DEVCONF_ACCEPT_RA_RTR_PREF, | 
|  | 151 | DEVCONF_RTR_PROBE_INTERVAL, | 
|  | 152 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, | 
|  | 153 | DEVCONF_PROXY_NDP, | 
|  | 154 | DEVCONF_OPTIMISTIC_DAD, | 
|  | 155 | DEVCONF_ACCEPT_SOURCE_ROUTE, | 
|  | 156 | DEVCONF_MC_FORWARDING, | 
|  | 157 | DEVCONF_DISABLE_IPV6, | 
|  | 158 | DEVCONF_ACCEPT_DAD, | 
|  | 159 | DEVCONF_FORCE_TLLAO, | 
|  | 160 | DEVCONF_MAX | 
|  | 161 | }; | 
|  | 162 |  | 
|  | 163 |  | 
|  | 164 | #endif /* _UAPI_IPV6_H */ |