From: Warner Losh <imp@bsdimp.com>
To: qemu-devel@nongnu.org
Cc: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>,
Stacey Son <sson@FreeBSD.org>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Subject: [PULL 13/25] bsd-user: Add FreeBSD IPv6 ioctl definitions
Date: Wed, 6 May 2026 20:28:15 -0600 [thread overview]
Message-ID: <20260507022827.44499-14-imp@bsdimp.com> (raw)
In-Reply-To: <20260507022827.44499-1-imp@bsdimp.com>
From: Stacey Son <sson@FreeBSD.org>
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>
---
bsd-user/freebsd/os-ioctl-in6_var.h | 226 ++++++++++++++++++++++++++++
1 file changed, 226 insertions(+)
create mode 100644 bsd-user/freebsd/os-ioctl-in6_var.h
diff --git a/bsd-user/freebsd/os-ioctl-in6_var.h b/bsd-user/freebsd/os-ioctl-in6_var.h
new file mode 100644
index 0000000000..82f0514c7b
--- /dev/null
+++ b/bsd-user/freebsd/os-ioctl-in6_var.h
@@ -0,0 +1,226 @@
+/*
+ * FreeBSD in6 definitions for ioctl(2) emulation
+ *
+ * Copyright (c) 2014-2015 Stacey D. Son
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef BSD_USER_FREEBSD_OS_IOCTL_IN6_VAR_H
+#define BSD_USER_FREEBSD_OS_IOCTL_IN6_VAR_H
+
+#include "os-ioctl-sockio.h"
+
+/*
+ * see netinet6/in6_var.h
+ * and see netinet/in6.h
+ * XXX target_in6_addr and target_sockaddr_in6 should maybe go
+ * somewhere else.
+ */
+struct target_in6_addr {
+ union {
+ uint8_t __u6_addr8[16];
+ uint16_t __u6_addr16[8];
+ uint32_t __u6_addr32[4];
+ } __u6_addr;
+};
+
+struct target_sockaddr_in6 {
+ uint8_t sin6_len;
+ uint8_t sin6_family;
+ uint16_t sin6_port;
+ uint32_t sin6_flowinfo;
+ struct target_in6_addr sin6_addr;
+ uint32_t sin6_scope_id;
+};
+
+struct target_in6_addrlifetime {
+ target_time_t ia6t_expire;
+ target_time_t ia6t_preferred;
+ u_int32_t ia6t_vltime;
+ u_int32_t ia6t_pltime;
+};
+
+struct target_in6_ifstat {
+ uint64_t ifs6_in_receive;
+ uint64_t ifs6_in_hdrerr;
+ uint64_t ifs6_in_toobig;
+ uint64_t ifs6_in_noroute;
+ uint64_t ifs6_in_addrerr;
+ uint64_t ifs6_in_protounknown;
+
+ uint64_t ifs6_in_truncated;
+ uint64_t ifs6_in_discard;
+
+ uint64_t ifs6_in_deliver;
+
+ uint64_t ifs6_out_forward;
+
+ uint64_t ifs6_out_request;
+
+ uint64_t ifs6_out_discard;
+ uint64_t ifs6_out_fragok;
+ uint64_t ifs6_out_fragfail;
+ uint64_t ifs6_out_fragcreat;
+
+ uint64_t ifs6_reass_reqd;
+
+ uint64_t ifs6_reass_ok;
+
+ uint64_t ifs6_reass_fail;
+
+ uint64_t ifs6_in_mcast;
+ uint64_t ifs6_out_mcast;
+};
+
+struct target_icmp6_ifstat {
+ uint64_t ifs6_in_msg;
+ uint64_t ifs6_in_error;
+ uint64_t ifs6_in_dstunreach;
+ uint64_t ifs6_in_adminprohib;
+ uint64_t ifs6_in_timeexceed;
+ uint64_t ifs6_in_paramprob;
+ uint64_t ifs6_in_pkttoobig;
+ uint64_t ifs6_in_echo;
+ uint64_t ifs6_in_echoreply;
+ uint64_t ifs6_in_routersolicit;
+ uint64_t ifs6_in_routeradvert;
+ uint64_t ifs6_in_neighborsolicit;
+ uint64_t ifs6_in_neighboradvert;
+ uint64_t ifs6_in_redirect;
+ uint64_t ifs6_in_mldquery;
+ uint64_t ifs6_in_mldreport;
+ uint64_t ifs6_in_mlddone;
+
+ uint64_t ifs6_out_msg;
+ uint64_t ifs6_out_error;
+ uint64_t ifs6_out_dstunreach;
+ uint64_t ifs6_out_adminprohib;
+ uint64_t ifs6_out_timeexceed;
+ uint64_t ifs6_out_paramprob;
+ uint64_t ifs6_out_pkttoobig;
+ uint64_t ifs6_out_echo;
+ uint64_t ifs6_out_echoreply;
+ uint64_t ifs6_out_routersolicit;
+ uint64_t ifs6_out_routeradvert;
+ uint64_t ifs6_out_neighborsolicit;
+ uint64_t ifs6_out_neighboradvert;
+ uint64_t ifs6_out_redirect;
+ uint64_t ifs6_out_mldquery;
+ uint64_t ifs6_out_mldreport;
+ uint64_t ifs6_out_mlddone;
+};
+
+struct target_in6_ifreq {
+ char ifr_name[TARGET_IFNAMSIZ];
+ union {
+ struct target_sockaddr_in6 ifru_addr;
+ struct target_sockaddr_in6 ifru_dstaddr;
+ abi_int ifru_flags;
+ abi_int ifru_flags6;
+ abi_int ifru_metric;
+ abi_ulong ifru_data;
+ struct target_in6_addrlifetime ifru_lifetime;
+ struct target_in6_ifstat ifru_stat;
+ struct target_icmp6_ifstat ifru_icmp6stat;
+ u_int32_t ifru_scope_id[16];
+ } ifr_ifru;
+};
+
+/* netinet6/nd6.h */
+struct target_nd_ifinfo {
+ uint32_t linkmtu;
+ uint32_t maxmtu;
+ uint32_t basereachable;
+ uint32_t reachable;
+ uint32_t retrans;
+ uint32_t flags;
+ int32_t recalctm;
+ uint8_t chlim;
+ uint8_t initialized;
+ uint8_t randomseed0[8];
+ uint8_t randomseed1[8];
+ uint8_t randomid[8];
+};
+
+/* netinet6/nd6.h */
+struct target_in6_ndireq {
+ char ifname[TARGET_IFNAMSIZ];
+ struct target_nd_ifinfo ndi;
+};
+
+struct target_in6_ndifreq {
+ char ifname[TARGET_IFNAMSIZ];
+ abi_ulong ifindex;
+};
+
+
+#define TARGET_SIOCGIFDSTADDR_IN6 TARGET_IOWR('i', 34, struct target_in6_ifreq)
+#define TARGET_SIOCGIFNETMASK_IN6 TARGET_IOWR('i', 37, struct target_in6_ifreq)
+
+#define TARGET_SIOCDIFADDR_IN6 TARGET_IOW('i', 25, struct target_in6_ifreq)
+#ifdef notyet
+#define TARGET_OSIOCAIFADDR_IN6 TARGET_IOW('i', 26, struct target_oin6_aliasreq)
+#define TARGET_SIOCAIFADDR_IN6 TARGET_IOW('i', 27, struct target_in6_aliasreq)
+
+#define TARGET_SIOCSIFPHYADDR_IN6 TARGET_IOW('i', 70, \
+ struct target_in6_aliasreq)
+#endif
+#define TARGET_SIOCGIFPSRCADDR_IN6 TARGET_IOWR('i', 71, struct target_in6_ifreq)
+#define TARGET_SIOCGIFPDSTADDR_IN6 TARGET_IOWR('i', 72, struct target_in6_ifreq)
+
+#define TARGET_SIOCGIFAFLAG_IN6 TARGET_IOWR('i', 73, struct target_in6_ifreq)
+
+#ifdef notyet
+#define TARGET_SIOCGDRLST_IN6 TARGET_IOWR('i', 74, struct target_in6_drlist)
+#endif
+
+#define TARGET_SIOCGIFINFO_IN6 TARGET_IOWR('i', 108, struct target_in6_ndireq)
+#define TARGET_SIOCSIFINFO_IN6 TARGET_IOWR('i', 109, struct target_in6_ndireq)
+
+#define TARGET_SIOCSNDFLUSH_IN6 TARGET_IOWR('i', 77, struct target_in6_ifreq)
+#ifdef notyet
+#define TARGET_SIOCGNBRINFO_IN6 TARGET_IOWR('i', 78, struct target_in6_nbrinfo)
+#endif
+#define TARGET_SIOCSPFXFLUSH_IN6 TARGET_IOWR('i', 79, struct target_in6_ifreq)
+#define TARGET_SIOCSRTRFLUSH_IN6 TARGET_IOWR('i', 80, struct target_in6_ifreq)
+
+#define TARGET_SIOCGIFALIFETIME_IN6 TARGET_IOWR('i', 81, \
+ struct target_in6_ifreq)
+#define TARGET_SIOCGIFSTAT_IN6 TARGET_IOWR('i', 83, struct target_in6_ifreq)
+#define TARGET_SIOCGIFSTAT_ICMP6 TARGET_IOWR('i', 84, struct target_in6_ifreq)
+
+#define TARGET_SIOCSDEFIFACE_IN6 TARGET_IOWR('i', 85, struct target_in6_ndifreq)
+#define TARGET_SIOCGDEFIFACE_IN6 TARGET_IOWR('i', 86, struct target_in6_ndifreq)
+
+#define TARGET_SIOCSIFINFO_FLAGS TARGET_IOWR('i', 87, struct target_in6_ndireq)
+
+#define TARGET_SIOCSSCOPE6 TARGET_IOW('i', 88, struct target_in6_ifreq)
+#define TARGET_SIOCGSCOPE6 TARGET_IOWR('i', 89, struct target_in6_ifreq)
+#define TARGET_SIOCGSCOPE6DEF TARGET_IOWR('i', 90, struct target_in6_ifreq)
+
+#ifdef notyet
+#define TARGET_SIOCSIFPREFIX_IN6 TARGET_IOW('i', 100, \
+ struct target_in6_prefixreq)
+#define TARGET_SIOCGIFPREFIX_IN6 TARGET_IOWR('i', 101, \
+ struct target_in6_prefixreq)
+#define TARGET_SIOCDIFPREFIX_IN6 TARGET_IOW('i', 102, \
+ struct target_in6_prefixreq)
+#define TARGET_SIOCAIFPREFIX_IN6 TARGET_IOW('i', 103, \
+ struct target_in6_rrenumreq)
+#define TARGET_SIOCCIFPREFIX_IN6 TARGET_IOW('i', 104, \
+ struct target_in6_rrenumreq)
+#define TARGET_SIOCSGIFPREFIX_IN6 TARGET_IOW('i', 105, \
+ struct target_in6_rrenumreq)
+
+#define TARGET_SIOCGETSGCNT_IN6 TARGET_IOWR('u', 106, \
+ struct target_sioc_sg_req6)
+#define TARGET_SIOCGETMIFCNT_IN6 TARGET_IOWR('u', 107, \
+ struct target_sioc_mif_req6)
+
+#define TARGET_SIOCAADDRCTL_POLICY TARGET_IOW('u', 108, \
+ struct target_in6_addrpolicy)
+#define TARGET_SIOCDADDRCTL_POLICY TARGET_IOW('u', 109, \
+ struct target_in6_addrpolicy)
+#endif
+
+#endif /* BSD_USER_FREEBSD_OS_IOCTL_IN6_VAR_H */
--
2.52.0
next prev parent reply other threads:[~2026-05-07 2:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 2:28 [PULL 00/25] Bsd user 2026 05 patches Warner Losh
2026-05-07 2:28 ` [PULL 01/25] bsd-user: Switch to SPDX-License-Expression Warner Losh
2026-05-07 2:28 ` [PULL 02/25] bsd-user: Add syscall header generator for FreeBSD Warner Losh
2026-05-07 2:28 ` [PULL 03/25] bsd-user: Delete sbrk and sstk system calls Warner Losh
2026-05-07 2:28 ` [PULL 04/25] bsd-user: Create os-syscall.h Warner Losh
2026-05-07 2:28 ` [PULL 05/25] bsd-user: Switch to generated syscall_nr.h Warner Losh
2026-05-07 2:28 ` [PULL 06/25] bsd-user: Copy linux-user/thunk.c to bsd-user Warner Losh
2026-05-07 2:28 ` [PULL 07/25] bsd-user: ioctl: add common definitions Warner Losh
2026-05-07 2:28 ` [PULL 08/25] bsd-user: Add FreeBSD tty ioctl definitions Warner Losh
2026-05-07 2:28 ` [PULL 09/25] bsd-user: Add FreeBSD file I/O " Warner Losh
2026-05-07 2:28 ` [PULL 10/25] bsd-user: Add FreeBSD socket " Warner Losh
2026-05-07 2:28 ` [PULL 11/25] bsd-user: Add FreeBSD cryptodev " Warner Losh
2026-05-07 2:28 ` [PULL 12/25] bsd-user: Add FreeBSD disk " Warner Losh
2026-05-07 2:28 ` Warner Losh [this message]
2026-05-07 2:28 ` [PULL 14/25] bsd-user: Add FreeBSD ioctl type definitions Warner Losh
2026-05-07 2:28 ` [PULL 15/25] bsd-user: Add FreeBSD ioctl command table Warner Losh
2026-05-07 2:28 ` [PULL 16/25] bsd-user: Add bsd-ioctl.h header Warner Losh
2026-05-07 2:28 ` [PULL 17/25] bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h Warner Losh
2026-05-07 2:28 ` [PULL 18/25] bsd-user: Add bsd-ioctl.c infrastructure and termios conversion Warner Losh
2026-05-07 2:28 ` [PULL 19/25] bsd-user: Add log_unsupported_ioctl function Warner Losh
2026-05-07 2:28 ` [PULL 20/25] bsd-user: Add do_ioctl_unsupported function Warner Losh
2026-05-07 2:28 ` [PULL 21/25] bsd-user: Add target_to_host_sockaddr_in6 function Warner Losh
2026-05-07 2:28 ` [PULL 22/25] bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function Warner Losh
2026-05-07 2:28 ` [PULL 23/25] bsd-user: Add do_bsd_ioctl main function Warner Losh
2026-05-07 2:28 ` [PULL 24/25] bsd-user: Add init_bsd_ioctl function Warner Losh
2026-05-07 2:28 ` [PULL 25/25] bsd-user: Add call to do_bsd_ioctl and add bsd-ioctl.c to the build Warner Losh
2026-05-11 14:21 ` [PULL 00/25] Bsd user 2026 05 patches Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260507022827.44499-14-imp@bsdimp.com \
--to=imp@bsdimp.com \
--cc=kevans@freebsd.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=sson@FreeBSD.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox