Commit | Line | Data |
---|---|---|
6f52b16c | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
607ca46e DH |
2 | #ifndef _UAPI_IPV6_H |
3 | #define _UAPI_IPV6_H | |
4 | ||
c66ad9ca | 5 | #include <linux/libc-compat.h> |
607ca46e DH |
6 | #include <linux/types.h> |
7 | #include <linux/in6.h> | |
8 | #include <asm/byteorder.h> | |
9 | ||
10 | /* The latest drafts declared increase in minimal mtu up to 1280. */ | |
11 | ||
12 | #define IPV6_MIN_MTU 1280 | |
13 | ||
14 | /* | |
15 | * Advanced API | |
16 | * source interface/address selection, source routing, etc... | |
17 | * *under construction* | |
18 | */ | |
19 | ||
3b50d902 | 20 | #if __UAPI_DEF_IN6_PKTINFO |
607ca46e DH |
21 | struct in6_pktinfo { |
22 | struct in6_addr ipi6_addr; | |
23 | int ipi6_ifindex; | |
24 | }; | |
3b50d902 | 25 | #endif |
607ca46e | 26 | |
3b50d902 | 27 | #if __UAPI_DEF_IP6_MTUINFO |
607ca46e DH |
28 | struct ip6_mtuinfo { |
29 | struct sockaddr_in6 ip6m_addr; | |
30 | __u32 ip6m_mtu; | |
31 | }; | |
3b50d902 | 32 | #endif |
607ca46e DH |
33 | |
34 | struct in6_ifreq { | |
35 | struct in6_addr ifr6_addr; | |
36 | __u32 ifr6_prefixlen; | |
37 | int ifr6_ifindex; | |
38 | }; | |
39 | ||
40 | #define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */ | |
41 | #define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */ | |
42 | #define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */ | |
8610c7c6 | 43 | #define IPV6_SRCRT_TYPE_3 3 /* RPL Segment Routing with IPv6 */ |
1ababeba | 44 | #define IPV6_SRCRT_TYPE_4 4 /* Segment Routing with IPv6 */ |
607ca46e DH |
45 | |
46 | /* | |
47 | * routing header | |
48 | */ | |
49 | struct ipv6_rt_hdr { | |
50 | __u8 nexthdr; | |
51 | __u8 hdrlen; | |
52 | __u8 type; | |
53 | __u8 segments_left; | |
54 | ||
55 | /* | |
56 | * type specific data | |
57 | * variable length field | |
58 | */ | |
59 | }; | |
60 | ||
61 | ||
62 | struct ipv6_opt_hdr { | |
63 | __u8 nexthdr; | |
64 | __u8 hdrlen; | |
65 | /* | |
66 | * TLV encoded option data follows. | |
67 | */ | |
68 | } __attribute__((packed)); /* required for some archs */ | |
69 | ||
70 | #define ipv6_destopt_hdr ipv6_opt_hdr | |
71 | #define ipv6_hopopt_hdr ipv6_opt_hdr | |
72 | ||
dd3332bf YH |
73 | /* Router Alert option values (RFC2711) */ |
74 | #define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */ | |
607ca46e DH |
75 | |
76 | /* | |
77 | * routing header type 0 (used in cmsghdr struct) | |
78 | */ | |
79 | ||
80 | struct rt0_hdr { | |
81 | struct ipv6_rt_hdr rt_hdr; | |
82 | __u32 reserved; | |
83 | struct in6_addr addr[0]; | |
84 | ||
85 | #define rt0_type rt_hdr.type | |
86 | }; | |
87 | ||
88 | /* | |
89 | * routing header type 2 | |
90 | */ | |
91 | ||
92 | struct rt2_hdr { | |
93 | struct ipv6_rt_hdr rt_hdr; | |
94 | __u32 reserved; | |
95 | struct in6_addr addr; | |
96 | ||
97 | #define rt2_type rt_hdr.type | |
98 | }; | |
99 | ||
100 | /* | |
101 | * home address option in destination options header | |
102 | */ | |
103 | ||
104 | struct ipv6_destopt_hao { | |
105 | __u8 type; | |
106 | __u8 length; | |
107 | struct in6_addr addr; | |
108 | } __attribute__((packed)); | |
109 | ||
110 | /* | |
111 | * IPv6 fixed header | |
112 | * | |
113 | * BEWARE, it is incorrect. The first 4 bits of flow_lbl | |
114 | * are glued to priority now, forming "class". | |
115 | */ | |
116 | ||
117 | struct ipv6hdr { | |
118 | #if defined(__LITTLE_ENDIAN_BITFIELD) | |
119 | __u8 priority:4, | |
120 | version:4; | |
121 | #elif defined(__BIG_ENDIAN_BITFIELD) | |
122 | __u8 version:4, | |
123 | priority:4; | |
124 | #else | |
125 | #error "Please fix <asm/byteorder.h>" | |
126 | #endif | |
127 | __u8 flow_lbl[3]; | |
128 | ||
129 | __be16 payload_len; | |
130 | __u8 nexthdr; | |
131 | __u8 hop_limit; | |
132 | ||
58e0be1e HL |
133 | __struct_group(/* no tag */, addrs, /* no attrs */, |
134 | struct in6_addr saddr; | |
135 | struct in6_addr daddr; | |
136 | ); | |
607ca46e DH |
137 | }; |
138 | ||
139 | ||
140 | /* index values for the variables in ipv6_devconf */ | |
141 | enum { | |
142 | DEVCONF_FORWARDING = 0, | |
143 | DEVCONF_HOPLIMIT, | |
144 | DEVCONF_MTU6, | |
145 | DEVCONF_ACCEPT_RA, | |
146 | DEVCONF_ACCEPT_REDIRECTS, | |
147 | DEVCONF_AUTOCONF, | |
148 | DEVCONF_DAD_TRANSMITS, | |
149 | DEVCONF_RTR_SOLICITS, | |
150 | DEVCONF_RTR_SOLICIT_INTERVAL, | |
151 | DEVCONF_RTR_SOLICIT_DELAY, | |
152 | DEVCONF_USE_TEMPADDR, | |
153 | DEVCONF_TEMP_VALID_LFT, | |
154 | DEVCONF_TEMP_PREFERED_LFT, | |
155 | DEVCONF_REGEN_MAX_RETRY, | |
156 | DEVCONF_MAX_DESYNC_FACTOR, | |
157 | DEVCONF_MAX_ADDRESSES, | |
158 | DEVCONF_FORCE_MLD_VERSION, | |
159 | DEVCONF_ACCEPT_RA_DEFRTR, | |
160 | DEVCONF_ACCEPT_RA_PINFO, | |
161 | DEVCONF_ACCEPT_RA_RTR_PREF, | |
162 | DEVCONF_RTR_PROBE_INTERVAL, | |
163 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, | |
164 | DEVCONF_PROXY_NDP, | |
165 | DEVCONF_OPTIMISTIC_DAD, | |
166 | DEVCONF_ACCEPT_SOURCE_ROUTE, | |
167 | DEVCONF_MC_FORWARDING, | |
168 | DEVCONF_DISABLE_IPV6, | |
169 | DEVCONF_ACCEPT_DAD, | |
170 | DEVCONF_FORCE_TLLAO, | |
5cb04436 | 171 | DEVCONF_NDISC_NOTIFY, |
fc4eba58 HFS |
172 | DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL, |
173 | DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, | |
b800c3b9 | 174 | DEVCONF_SUPPRESS_FRAG_NDISC, |
d9333196 | 175 | DEVCONF_ACCEPT_RA_FROM_LOCAL, |
7fd2561e | 176 | DEVCONF_USE_OPTIMISTIC, |
c2943f14 | 177 | DEVCONF_ACCEPT_RA_MTU, |
3d1bec99 | 178 | DEVCONF_STABLE_SECRET, |
3985e8a3 | 179 | DEVCONF_USE_OIF_ADDRS_ONLY, |
8013d1d7 | 180 | DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT, |
35103d11 | 181 | DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, |
abbc3043 | 182 | DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, |
7a02bf89 | 183 | DEVCONF_DROP_UNSOLICITED_NA, |
f1705ec1 | 184 | DEVCONF_KEEP_ADDR_ON_DOWN, |
bd11f074 | 185 | DEVCONF_RTR_SOLICIT_MAX_INTERVAL, |
1ababeba | 186 | DEVCONF_SEG6_ENABLED, |
bf355b8d | 187 | DEVCONF_SEG6_REQUIRE_HMAC, |
adc176c5 | 188 | DEVCONF_ENHANCED_DAD, |
d35a00b8 | 189 | DEVCONF_ADDR_GEN_MODE, |
df789fe7 | 190 | DEVCONF_DISABLE_POLICY, |
bbea124b | 191 | DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN, |
2210d6b2 | 192 | DEVCONF_NDISC_TCLASS, |
8610c7c6 | 193 | DEVCONF_RPL_SEG_ENABLED, |
6b2e04bc | 194 | DEVCONF_RA_DEFRTR_METRIC, |
9ee11f0f JI |
195 | DEVCONF_IOAM6_ENABLED, |
196 | DEVCONF_IOAM6_ID, | |
197 | DEVCONF_IOAM6_ID_WIDE, | |
18ac597a | 198 | DEVCONF_NDISC_EVICT_NOCARRIER, |
3e0b8f52 | 199 | DEVCONF_ACCEPT_UNTRACKED_NA, |
607ca46e DH |
200 | DEVCONF_MAX |
201 | }; | |
202 | ||
203 | ||
204 | #endif /* _UAPI_IPV6_H */ |