blob: 9c0f4a92bcffb5a86f9f1fed0e177ce4974ab27f [file] [log] [blame]
Christopher Ferris25981132017-11-14 16:53:49 -08001/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
Ben Cheng224b54f2013-10-15 18:26:18 -07002#ifndef _UAPI_IPV6_H
3#define _UAPI_IPV6_H
4
Christopher Ferris12e1f282016-02-04 12:35:07 -08005#include <linux/libc-compat.h>
Ben Cheng224b54f2013-10-15 18:26:18 -07006#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
Christopher Ferris12e1f282016-02-04 12:35:07 -080020#if __UAPI_DEF_IN6_PKTINFO
Ben Cheng224b54f2013-10-15 18:26:18 -070021struct in6_pktinfo {
22 struct in6_addr ipi6_addr;
23 int ipi6_ifindex;
24};
Christopher Ferris12e1f282016-02-04 12:35:07 -080025#endif
Ben Cheng224b54f2013-10-15 18:26:18 -070026
Christopher Ferris12e1f282016-02-04 12:35:07 -080027#if __UAPI_DEF_IP6_MTUINFO
Ben Cheng224b54f2013-10-15 18:26:18 -070028struct ip6_mtuinfo {
29 struct sockaddr_in6 ip6m_addr;
30 __u32 ip6m_mtu;
31};
Christopher Ferris12e1f282016-02-04 12:35:07 -080032#endif
Ben Cheng224b54f2013-10-15 18:26:18 -070033
34struct 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 */
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -080043#define IPV6_SRCRT_TYPE_4 4 /* Segment Routing with IPv6 */
Ben Cheng224b54f2013-10-15 18:26:18 -070044
45/*
46 * routing header
47 */
48struct ipv6_rt_hdr {
49 __u8 nexthdr;
50 __u8 hdrlen;
51 __u8 type;
52 __u8 segments_left;
53
54 /*
55 * type specific data
56 * variable length field
57 */
58};
59
60
61struct ipv6_opt_hdr {
62 __u8 nexthdr;
63 __u8 hdrlen;
64 /*
65 * TLV encoded option data follows.
66 */
67} __attribute__((packed)); /* required for some archs */
68
69#define ipv6_destopt_hdr ipv6_opt_hdr
70#define ipv6_hopopt_hdr ipv6_opt_hdr
71
72/* Router Alert option values (RFC2711) */
73#define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */
74
75/*
76 * routing header type 0 (used in cmsghdr struct)
77 */
78
79struct rt0_hdr {
80 struct ipv6_rt_hdr rt_hdr;
81 __u32 reserved;
82 struct in6_addr addr[0];
83
84#define rt0_type rt_hdr.type
85};
86
87/*
88 * routing header type 2
89 */
90
91struct rt2_hdr {
92 struct ipv6_rt_hdr rt_hdr;
93 __u32 reserved;
94 struct in6_addr addr;
95
96#define rt2_type rt_hdr.type
97};
98
99/*
100 * home address option in destination options header
101 */
102
103struct ipv6_destopt_hao {
104 __u8 type;
105 __u8 length;
106 struct in6_addr addr;
107} __attribute__((packed));
108
109/*
110 * IPv6 fixed header
111 *
112 * BEWARE, it is incorrect. The first 4 bits of flow_lbl
113 * are glued to priority now, forming "class".
114 */
115
116struct ipv6hdr {
117#if defined(__LITTLE_ENDIAN_BITFIELD)
118 __u8 priority:4,
119 version:4;
120#elif defined(__BIG_ENDIAN_BITFIELD)
121 __u8 version:4,
122 priority:4;
123#else
124#error "Please fix <asm/byteorder.h>"
125#endif
126 __u8 flow_lbl[3];
127
128 __be16 payload_len;
129 __u8 nexthdr;
130 __u8 hop_limit;
131
132 struct in6_addr saddr;
133 struct in6_addr daddr;
134};
135
136
137/* index values for the variables in ipv6_devconf */
138enum {
139 DEVCONF_FORWARDING = 0,
140 DEVCONF_HOPLIMIT,
141 DEVCONF_MTU6,
142 DEVCONF_ACCEPT_RA,
143 DEVCONF_ACCEPT_REDIRECTS,
144 DEVCONF_AUTOCONF,
145 DEVCONF_DAD_TRANSMITS,
146 DEVCONF_RTR_SOLICITS,
147 DEVCONF_RTR_SOLICIT_INTERVAL,
148 DEVCONF_RTR_SOLICIT_DELAY,
149 DEVCONF_USE_TEMPADDR,
150 DEVCONF_TEMP_VALID_LFT,
151 DEVCONF_TEMP_PREFERED_LFT,
152 DEVCONF_REGEN_MAX_RETRY,
153 DEVCONF_MAX_DESYNC_FACTOR,
154 DEVCONF_MAX_ADDRESSES,
155 DEVCONF_FORCE_MLD_VERSION,
156 DEVCONF_ACCEPT_RA_DEFRTR,
157 DEVCONF_ACCEPT_RA_PINFO,
158 DEVCONF_ACCEPT_RA_RTR_PREF,
159 DEVCONF_RTR_PROBE_INTERVAL,
160 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
161 DEVCONF_PROXY_NDP,
162 DEVCONF_OPTIMISTIC_DAD,
163 DEVCONF_ACCEPT_SOURCE_ROUTE,
164 DEVCONF_MC_FORWARDING,
165 DEVCONF_DISABLE_IPV6,
166 DEVCONF_ACCEPT_DAD,
167 DEVCONF_FORCE_TLLAO,
168 DEVCONF_NDISC_NOTIFY,
Christopher Ferrise0845012014-07-09 14:58:51 -0700169 DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
170 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
171 DEVCONF_SUPPRESS_FRAG_NDISC,
Christopher Ferris7c0b6392015-01-23 15:34:26 -0800172 DEVCONF_ACCEPT_RA_FROM_LOCAL,
Christopher Ferris12e1f282016-02-04 12:35:07 -0800173 DEVCONF_USE_OPTIMISTIC,
174 DEVCONF_ACCEPT_RA_MTU,
175 DEVCONF_STABLE_SECRET,
176 DEVCONF_USE_OIF_ADDRS_ONLY,
177 DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT,
178 DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
Christopher Ferrisccfaccd2016-08-24 12:11:31 -0700179 DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
180 DEVCONF_DROP_UNSOLICITED_NA,
181 DEVCONF_KEEP_ADDR_ON_DOWN,
Christopher Ferris33185402017-01-13 13:28:52 -0800182 DEVCONF_RTR_SOLICIT_MAX_INTERVAL,
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -0800183 DEVCONF_SEG6_ENABLED,
184 DEVCONF_SEG6_REQUIRE_HMAC,
185 DEVCONF_ENHANCED_DAD,
Christopher Ferris0543f742017-07-26 13:09:46 -0700186 DEVCONF_ADDR_GEN_MODE,
187 DEVCONF_DISABLE_POLICY,
188 DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN,
Christopher Ferrisa1a109e2018-01-31 15:03:12 -0800189 DEVCONF_NDISC_TCLASS,
Ben Cheng224b54f2013-10-15 18:26:18 -0700190 DEVCONF_MAX
191};
192
193
194#endif /* _UAPI_IPV6_H */