1 #ifndef _IPV6_H
2 #define _IPV6_H
3 
4 #include <linux/in6.h>
5 #include <asm/byteorder.h>
6 
7 /* The latest drafts declared increase in minimal mtu up to 1280. */
8 
9 #define IPV6_MIN_MTU	1280
10 
11 /*
12  *	Advanced API
13  *	source interface/address selection, source routing, etc...
14  *	*under construction*
15  */
16 
17 
18 struct in6_pktinfo {
19 	struct in6_addr	ipi6_addr;
20 	int		ipi6_ifindex;
21 };
22 
23 
24 struct in6_ifreq {
25 	struct in6_addr	ifr6_addr;
26 	__u32		ifr6_prefixlen;
27 	int		ifr6_ifindex;
28 };
29 
30 #define IPV6_SRCRT_STRICT	0x01	/* this hop must be a neighbor	*/
31 #define IPV6_SRCRT_TYPE_0	0	/* IPv6 type 0 Routing Header	*/
32 
33 /*
34  *	routing header
35  */
36 struct ipv6_rt_hdr {
37 	__u8		nexthdr;
38 	__u8		hdrlen;
39 	__u8		type;
40 	__u8		segments_left;
41 
42 	/*
43 	 *	type specific data
44 	 *	variable length field
45 	 */
46 };
47 
48 
49 struct ipv6_opt_hdr {
50 	__u8 		nexthdr;
51 	__u8 		hdrlen;
52 	/*
53 	 * TLV encoded option data follows.
54 	 */
55 };
56 
57 #define ipv6_destopt_hdr ipv6_opt_hdr
58 #define ipv6_hopopt_hdr  ipv6_opt_hdr
59 
60 #ifdef __KERNEL__
61 #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)
62 #endif
63 
64 /*
65  *	routing header type 0 (used in cmsghdr struct)
66  */
67 
68 struct rt0_hdr {
69 	struct ipv6_rt_hdr	rt_hdr;
70 	__u32			bitmap;		/* strict/loose bit map */
71 	struct in6_addr		addr[0];
72 
73 #define rt0_type		rt_hdr.type
74 };
75 
76 /*
77  *	IPv6 fixed header
78  *
79  *	BEWARE, it is incorrect. The first 4 bits of flow_lbl
80  *	are glued to priority now, forming "class".
81  */
82 
83 struct ipv6hdr {
84 #if defined(__LITTLE_ENDIAN_BITFIELD)
85 	__u8			priority:4,
86 				version:4;
87 #elif defined(__BIG_ENDIAN_BITFIELD)
88 	__u8			version:4,
89 				priority:4;
90 #else
91 #error	"Please fix <asm/byteorder.h>"
92 #endif
93 	__u8			flow_lbl[3];
94 
95 	__u16			payload_len;
96 	__u8			nexthdr;
97 	__u8			hop_limit;
98 
99 	struct	in6_addr	saddr;
100 	struct	in6_addr	daddr;
101 };
102 
103 /*
104  * This structure contains configuration options per IPv6 link.
105  */
106 struct ipv6_devconf {
107 	__s32		forwarding;
108 	__s32		hop_limit;
109 	__s32		mtu6;
110 	__s32		accept_ra;
111 	__s32		accept_redirects;
112 	__s32		autoconf;
113 	__s32		dad_transmits;
114 	__s32		rtr_solicits;
115 	__s32		rtr_solicit_interval;
116 	__s32		rtr_solicit_delay;
117 #ifdef CONFIG_IPV6_PRIVACY
118 	__s32		use_tempaddr;
119 	__s32		temp_valid_lft;
120 	__s32		temp_prefered_lft;
121 	__s32		regen_max_retry;
122 	__s32		max_desync_factor;
123 #endif
124 	void		*sysctl;
125 };
126 
127 /* index values for the variables in ipv6_devconf */
128 enum {
129 	DEVCONF_FORWARDING = 0,
130 	DEVCONF_HOPLIMIT,
131 	DEVCONF_MTU6,
132 	DEVCONF_ACCEPT_RA,
133 	DEVCONF_ACCEPT_REDIRECTS,
134 	DEVCONF_AUTOCONF,
135 	DEVCONF_DAD_TRANSMITS,
136 	DEVCONF_RTR_SOLICITS,
137 	DEVCONF_RTR_SOLICIT_INTERVAL,
138 	DEVCONF_RTR_SOLICIT_DELAY,
139 #ifdef CONFIG_IPV6_PRIVACY
140 	DEVCONF_USE_TEMPADDR,
141 	DEVCONF_TEMP_VALID_LFT,
142 	DEVCONF_TEMP_PREFERED_LFT,
143 	DEVCONF_REGEN_MAX_RETRY,
144 	DEVCONF_MAX_DESYNC_FACTOR,
145 #endif
146 	DEVCONF_MAX
147 };
148 
149 #ifdef __KERNEL__
150 
151 /*
152    This structure contains results of exthdrs parsing
153    as offsets from skb->nh.
154  */
155 
156 struct inet6_skb_parm
157 {
158 	int			iif;
159 	__u16			ra;
160 	__u16			hop;
161 	__u16			auth;
162 	__u16			dst0;
163 	__u16			srcrt;
164 	__u16			dst1;
165 };
166 
167 #endif
168 
169 #endif
170