bsd-user: Add FreeBSD IPv6 ioctl definitions
Add os-ioctl-in6_var.h with IPv6 network interface ioctl definitions including SIOCAIFADDR_IN6, SIOCDIFADDR_IN6, and related IPv6 configuration ioctls with target_in6_* structure definitions. Signed-off-by: Stacey Son <sson@FreeBSD.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Warner Losh <imp@bsdimp.com>
Stacey Son committed
Mar 13, 2026 at 22:12 UTC
2a00a668c97b49df112003b8a122f83377c56cd9
1 file changed
+226
bsd-user/freebsd/os-ioctl-in6_var.h
new
+226
@@ -0,0 +1,226 @@
1
+/*
2
+ * FreeBSD in6 definitions for ioctl(2) emulation
3
+ *
4
+ * Copyright (c) 2014-2015 Stacey D. Son
5
+ *
6
+ * SPDX-License-Identifier: GPL-2.0-or-later
7
+ */
8
+#ifndef BSD_USER_FREEBSD_OS_IOCTL_IN6_VAR_H
9
+#define BSD_USER_FREEBSD_OS_IOCTL_IN6_VAR_H
10
+
11
+#include "os-ioctl-sockio.h"
12
+
13
+/*
14
+ * see netinet6/in6_var.h
15
+ * and see netinet/in6.h
16
+ * XXX target_in6_addr and target_sockaddr_in6 should maybe go
17
+ * somewhere else.
18
+ */
19
+struct target_in6_addr {
20
+ union {
21
+ uint8_t __u6_addr8[16];
22
+ uint16_t __u6_addr16[8];
23
+ uint32_t __u6_addr32[4];
24
+ } __u6_addr;
25
+};
26
+
27
+struct target_sockaddr_in6 {
28
+ uint8_t sin6_len;
29
+ uint8_t sin6_family;
30
+ uint16_t sin6_port;
31
+ uint32_t sin6_flowinfo;
32
+ struct target_in6_addr sin6_addr;
33
+ uint32_t sin6_scope_id;
34
+};
35
+
36
+struct target_in6_addrlifetime {
37
+ target_time_t ia6t_expire;
38
+ target_time_t ia6t_preferred;
39
+ u_int32_t ia6t_vltime;
40
+ u_int32_t ia6t_pltime;
41
+};
42
+
43
+struct target_in6_ifstat {
44
+ uint64_t ifs6_in_receive;
45
+ uint64_t ifs6_in_hdrerr;
46
+ uint64_t ifs6_in_toobig;
47
+ uint64_t ifs6_in_noroute;
48
+ uint64_t ifs6_in_addrerr;
49
+ uint64_t ifs6_in_protounknown;
50
+
51
+ uint64_t ifs6_in_truncated;
52
+ uint64_t ifs6_in_discard;
53
+
54
+ uint64_t ifs6_in_deliver;
55
+
56
+ uint64_t ifs6_out_forward;
57
+
58
+ uint64_t ifs6_out_request;
59
+
60
+ uint64_t ifs6_out_discard;
61
+ uint64_t ifs6_out_fragok;
62
+ uint64_t ifs6_out_fragfail;
63
+ uint64_t ifs6_out_fragcreat;
64
+
65
+ uint64_t ifs6_reass_reqd;
66
+
67
+ uint64_t ifs6_reass_ok;
68
+
69
+ uint64_t ifs6_reass_fail;
70
+
71
+ uint64_t ifs6_in_mcast;
72
+ uint64_t ifs6_out_mcast;
73
+};
74
+
75
+struct target_icmp6_ifstat {
76
+ uint64_t ifs6_in_msg;
77
+ uint64_t ifs6_in_error;
78
+ uint64_t ifs6_in_dstunreach;
79
+ uint64_t ifs6_in_adminprohib;
80
+ uint64_t ifs6_in_timeexceed;
81
+ uint64_t ifs6_in_paramprob;
82
+ uint64_t ifs6_in_pkttoobig;
83
+ uint64_t ifs6_in_echo;
84
+ uint64_t ifs6_in_echoreply;
85
+ uint64_t ifs6_in_routersolicit;
86
+ uint64_t ifs6_in_routeradvert;
87
+ uint64_t ifs6_in_neighborsolicit;
88
+ uint64_t ifs6_in_neighboradvert;
89
+ uint64_t ifs6_in_redirect;
90
+ uint64_t ifs6_in_mldquery;
91
+ uint64_t ifs6_in_mldreport;
92
+ uint64_t ifs6_in_mlddone;
93
+
94
+ uint64_t ifs6_out_msg;
95
+ uint64_t ifs6_out_error;
96
+ uint64_t ifs6_out_dstunreach;
97
+ uint64_t ifs6_out_adminprohib;
98
+ uint64_t ifs6_out_timeexceed;
99
+ uint64_t ifs6_out_paramprob;
100
+ uint64_t ifs6_out_pkttoobig;
101
+ uint64_t ifs6_out_echo;
102
+ uint64_t ifs6_out_echoreply;
103
+ uint64_t ifs6_out_routersolicit;
104
+ uint64_t ifs6_out_routeradvert;
105
+ uint64_t ifs6_out_neighborsolicit;
106
+ uint64_t ifs6_out_neighboradvert;
107
+ uint64_t ifs6_out_redirect;
108
+ uint64_t ifs6_out_mldquery;
109
+ uint64_t ifs6_out_mldreport;
110
+ uint64_t ifs6_out_mlddone;
111
+};
112
+
113
+struct target_in6_ifreq {
114
+ char ifr_name[TARGET_IFNAMSIZ];
115
+ union {
116
+ struct target_sockaddr_in6 ifru_addr;
117
+ struct target_sockaddr_in6 ifru_dstaddr;
118
+ abi_int ifru_flags;
119
+ abi_int ifru_flags6;
120
+ abi_int ifru_metric;
121
+ abi_ulong ifru_data;
122
+ struct target_in6_addrlifetime ifru_lifetime;
123
+ struct target_in6_ifstat ifru_stat;
124
+ struct target_icmp6_ifstat ifru_icmp6stat;
125
+ u_int32_t ifru_scope_id[16];
126
+ } ifr_ifru;
127
+};
128
+
129
+/* netinet6/nd6.h */
130
+struct target_nd_ifinfo {
131
+ uint32_t linkmtu;
132
+ uint32_t maxmtu;
133
+ uint32_t basereachable;
134
+ uint32_t reachable;
135
+ uint32_t retrans;
136
+ uint32_t flags;
137
+ int32_t recalctm;
138
+ uint8_t chlim;
139
+ uint8_t initialized;
140
+ uint8_t randomseed0[8];
141
+ uint8_t randomseed1[8];
142
+ uint8_t randomid[8];
143
+};
144
+
145
+/* netinet6/nd6.h */
146
+struct target_in6_ndireq {
147
+ char ifname[TARGET_IFNAMSIZ];
148
+ struct target_nd_ifinfo ndi;
149
+};
150
+
151
+struct target_in6_ndifreq {
152
+ char ifname[TARGET_IFNAMSIZ];
153
+ abi_ulong ifindex;
154
+};
155
+
156
+
157
+#define TARGET_SIOCGIFDSTADDR_IN6 TARGET_IOWR('i', 34, struct target_in6_ifreq)
158
+#define TARGET_SIOCGIFNETMASK_IN6 TARGET_IOWR('i', 37, struct target_in6_ifreq)
159
+
160
+#define TARGET_SIOCDIFADDR_IN6 TARGET_IOW('i', 25, struct target_in6_ifreq)
161
+#ifdef notyet
162
+#define TARGET_OSIOCAIFADDR_IN6 TARGET_IOW('i', 26, struct target_oin6_aliasreq)
163
+#define TARGET_SIOCAIFADDR_IN6 TARGET_IOW('i', 27, struct target_in6_aliasreq)
164
+
165
+#define TARGET_SIOCSIFPHYADDR_IN6 TARGET_IOW('i', 70, \
166
+ struct target_in6_aliasreq)
167
+#endif
168
+#define TARGET_SIOCGIFPSRCADDR_IN6 TARGET_IOWR('i', 71, struct target_in6_ifreq)
169
+#define TARGET_SIOCGIFPDSTADDR_IN6 TARGET_IOWR('i', 72, struct target_in6_ifreq)
170
+
171
+#define TARGET_SIOCGIFAFLAG_IN6 TARGET_IOWR('i', 73, struct target_in6_ifreq)
172
+
173
+#ifdef notyet
174
+#define TARGET_SIOCGDRLST_IN6 TARGET_IOWR('i', 74, struct target_in6_drlist)
175
+#endif
176
+
177
+#define TARGET_SIOCGIFINFO_IN6 TARGET_IOWR('i', 108, struct target_in6_ndireq)
178
+#define TARGET_SIOCSIFINFO_IN6 TARGET_IOWR('i', 109, struct target_in6_ndireq)
179
+
180
+#define TARGET_SIOCSNDFLUSH_IN6 TARGET_IOWR('i', 77, struct target_in6_ifreq)
181
+#ifdef notyet
182
+#define TARGET_SIOCGNBRINFO_IN6 TARGET_IOWR('i', 78, struct target_in6_nbrinfo)
183
+#endif
184
+#define TARGET_SIOCSPFXFLUSH_IN6 TARGET_IOWR('i', 79, struct target_in6_ifreq)
185
+#define TARGET_SIOCSRTRFLUSH_IN6 TARGET_IOWR('i', 80, struct target_in6_ifreq)
186
+
187
+#define TARGET_SIOCGIFALIFETIME_IN6 TARGET_IOWR('i', 81, \
188
+ struct target_in6_ifreq)
189
+#define TARGET_SIOCGIFSTAT_IN6 TARGET_IOWR('i', 83, struct target_in6_ifreq)
190
+#define TARGET_SIOCGIFSTAT_ICMP6 TARGET_IOWR('i', 84, struct target_in6_ifreq)
191
+
192
+#define TARGET_SIOCSDEFIFACE_IN6 TARGET_IOWR('i', 85, struct target_in6_ndifreq)
193
+#define TARGET_SIOCGDEFIFACE_IN6 TARGET_IOWR('i', 86, struct target_in6_ndifreq)
194
+
195
+#define TARGET_SIOCSIFINFO_FLAGS TARGET_IOWR('i', 87, struct target_in6_ndireq)
196
+
197
+#define TARGET_SIOCSSCOPE6 TARGET_IOW('i', 88, struct target_in6_ifreq)
198
+#define TARGET_SIOCGSCOPE6 TARGET_IOWR('i', 89, struct target_in6_ifreq)
199
+#define TARGET_SIOCGSCOPE6DEF TARGET_IOWR('i', 90, struct target_in6_ifreq)
200
+
201
+#ifdef notyet
202
+#define TARGET_SIOCSIFPREFIX_IN6 TARGET_IOW('i', 100, \
203
+ struct target_in6_prefixreq)
204
+#define TARGET_SIOCGIFPREFIX_IN6 TARGET_IOWR('i', 101, \
205
+ struct target_in6_prefixreq)
206
+#define TARGET_SIOCDIFPREFIX_IN6 TARGET_IOW('i', 102, \
207
+ struct target_in6_prefixreq)
208
+#define TARGET_SIOCAIFPREFIX_IN6 TARGET_IOW('i', 103, \
209
+ struct target_in6_rrenumreq)
210
+#define TARGET_SIOCCIFPREFIX_IN6 TARGET_IOW('i', 104, \
211
+ struct target_in6_rrenumreq)
212
+#define TARGET_SIOCSGIFPREFIX_IN6 TARGET_IOW('i', 105, \
213
+ struct target_in6_rrenumreq)
214
+
215
+#define TARGET_SIOCGETSGCNT_IN6 TARGET_IOWR('u', 106, \
216
+ struct target_sioc_sg_req6)
217
+#define TARGET_SIOCGETMIFCNT_IN6 TARGET_IOWR('u', 107, \
218
+ struct target_sioc_mif_req6)
219
+
220
+#define TARGET_SIOCAADDRCTL_POLICY TARGET_IOW('u', 108, \
221
+ struct target_in6_addrpolicy)
222
+#define TARGET_SIOCDADDRCTL_POLICY TARGET_IOW('u', 109, \
223
+ struct target_in6_addrpolicy)
224
+#endif
225
+
226
+#endif /* BSD_USER_FREEBSD_OS_IOCTL_IN6_VAR_H */