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