Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _UAPI__LINUX_NETLINK_H |
| 20 | #define _UAPI__LINUX_NETLINK_H |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 21 | #include <linux/const.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 22 | #include <linux/socket.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | #include <linux/types.h> |
| 24 | #define NETLINK_ROUTE 0 |
| 25 | #define NETLINK_UNUSED 1 |
| 26 | #define NETLINK_USERSOCK 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 27 | #define NETLINK_FIREWALL 3 |
| 28 | #define NETLINK_SOCK_DIAG 4 |
| 29 | #define NETLINK_NFLOG 5 |
| 30 | #define NETLINK_XFRM 6 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 31 | #define NETLINK_SELINUX 7 |
| 32 | #define NETLINK_ISCSI 8 |
| 33 | #define NETLINK_AUDIT 9 |
| 34 | #define NETLINK_FIB_LOOKUP 10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 35 | #define NETLINK_CONNECTOR 11 |
| 36 | #define NETLINK_NETFILTER 12 |
| 37 | #define NETLINK_IP6_FW 13 |
| 38 | #define NETLINK_DNRTMSG 14 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 39 | #define NETLINK_KOBJECT_UEVENT 15 |
| 40 | #define NETLINK_GENERIC 16 |
| 41 | #define NETLINK_SCSITRANSPORT 18 |
| 42 | #define NETLINK_ECRYPTFS 19 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 43 | #define NETLINK_RDMA 20 |
| 44 | #define NETLINK_CRYPTO 21 |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 45 | #define NETLINK_SMC 22 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 46 | #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG |
| 47 | #define MAX_LINKS 32 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 48 | struct sockaddr_nl { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 49 | __kernel_sa_family_t nl_family; |
| 50 | unsigned short nl_pad; |
| 51 | __u32 nl_pid; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 52 | __u32 nl_groups; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 53 | }; |
| 54 | struct nlmsghdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | __u32 nlmsg_len; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 56 | __u16 nlmsg_type; |
| 57 | __u16 nlmsg_flags; |
| 58 | __u32 nlmsg_seq; |
| 59 | __u32 nlmsg_pid; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 60 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 61 | #define NLM_F_REQUEST 0x01 |
| 62 | #define NLM_F_MULTI 0x02 |
| 63 | #define NLM_F_ACK 0x04 |
| 64 | #define NLM_F_ECHO 0x08 |
| 65 | #define NLM_F_DUMP_INTR 0x10 |
| 66 | #define NLM_F_DUMP_FILTERED 0x20 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 67 | #define NLM_F_ROOT 0x100 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 68 | #define NLM_F_MATCH 0x200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 69 | #define NLM_F_ATOMIC 0x400 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 70 | #define NLM_F_DUMP (NLM_F_ROOT | NLM_F_MATCH) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 71 | #define NLM_F_REPLACE 0x100 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 72 | #define NLM_F_EXCL 0x200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 73 | #define NLM_F_CREATE 0x400 |
| 74 | #define NLM_F_APPEND 0x800 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 75 | #define NLM_F_NONREC 0x100 |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 76 | #define NLM_F_BULK 0x200 |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 77 | #define NLM_F_CAPPED 0x100 |
| 78 | #define NLM_F_ACK_TLVS 0x200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 79 | #define NLMSG_ALIGNTO 4U |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 80 | #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 81 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
| 82 | #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) |
| 83 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 84 | #define NLMSG_DATA(nlh) ((void *) (((char *) nlh) + NLMSG_HDRLEN)) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 85 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr *) (((char *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) |
| 86 | #define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 87 | #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 88 | #define NLMSG_NOOP 0x1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 89 | #define NLMSG_ERROR 0x2 |
| 90 | #define NLMSG_DONE 0x3 |
| 91 | #define NLMSG_OVERRUN 0x4 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 92 | #define NLMSG_MIN_TYPE 0x10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 93 | struct nlmsgerr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 94 | int error; |
| 95 | struct nlmsghdr msg; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 96 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 97 | enum nlmsgerr_attrs { |
| 98 | NLMSGERR_ATTR_UNUSED, |
| 99 | NLMSGERR_ATTR_MSG, |
| 100 | NLMSGERR_ATTR_OFFS, |
| 101 | NLMSGERR_ATTR_COOKIE, |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 102 | NLMSGERR_ATTR_POLICY, |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 103 | NLMSGERR_ATTR_MISS_TYPE, |
| 104 | NLMSGERR_ATTR_MISS_NEST, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 105 | __NLMSGERR_ATTR_MAX, |
| 106 | NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 |
| 107 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 108 | #define NETLINK_ADD_MEMBERSHIP 1 |
| 109 | #define NETLINK_DROP_MEMBERSHIP 2 |
| 110 | #define NETLINK_PKTINFO 3 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 111 | #define NETLINK_BROADCAST_ERROR 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 112 | #define NETLINK_NO_ENOBUFS 5 |
| 113 | #define NETLINK_RX_RING 6 |
| 114 | #define NETLINK_TX_RING 7 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 115 | #define NETLINK_LISTEN_ALL_NSID 8 |
| 116 | #define NETLINK_LIST_MEMBERSHIPS 9 |
| 117 | #define NETLINK_CAP_ACK 10 |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 118 | #define NETLINK_EXT_ACK 11 |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 119 | #define NETLINK_GET_STRICT_CHK 12 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 120 | struct nl_pktinfo { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 121 | __u32 group; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 122 | }; |
| 123 | struct nl_mmap_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 124 | unsigned int nm_block_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 125 | unsigned int nm_block_nr; |
| 126 | unsigned int nm_frame_size; |
| 127 | unsigned int nm_frame_nr; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 128 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 129 | struct nl_mmap_hdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 130 | unsigned int nm_status; |
| 131 | unsigned int nm_len; |
| 132 | __u32 nm_group; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 133 | __u32 nm_pid; |
| 134 | __u32 nm_uid; |
| 135 | __u32 nm_gid; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 136 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 137 | enum nl_mmap_status { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 138 | NL_MMAP_STATUS_UNUSED, |
| 139 | NL_MMAP_STATUS_RESERVED, |
| 140 | NL_MMAP_STATUS_VALID, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 141 | NL_MMAP_STATUS_COPY, |
| 142 | NL_MMAP_STATUS_SKIP, |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 143 | }; |
| 144 | #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 145 | #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) |
| 146 | #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) |
| 147 | #define NET_MAJOR 36 |
| 148 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 149 | NETLINK_UNCONNECTED = 0, |
| 150 | NETLINK_CONNECTED, |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 151 | }; |
| 152 | struct nlattr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 153 | __u16 nla_len; |
| 154 | __u16 nla_type; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 155 | }; |
| 156 | #define NLA_F_NESTED (1 << 15) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 157 | #define NLA_F_NET_BYTEORDER (1 << 14) |
| 158 | #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) |
| 159 | #define NLA_ALIGNTO 4 |
| 160 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 161 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 162 | struct nla_bitfield32 { |
| 163 | __u32 value; |
| 164 | __u32 selector; |
| 165 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 166 | enum netlink_attribute_type { |
| 167 | NL_ATTR_TYPE_INVALID, |
| 168 | NL_ATTR_TYPE_FLAG, |
| 169 | NL_ATTR_TYPE_U8, |
| 170 | NL_ATTR_TYPE_U16, |
| 171 | NL_ATTR_TYPE_U32, |
| 172 | NL_ATTR_TYPE_U64, |
| 173 | NL_ATTR_TYPE_S8, |
| 174 | NL_ATTR_TYPE_S16, |
| 175 | NL_ATTR_TYPE_S32, |
| 176 | NL_ATTR_TYPE_S64, |
| 177 | NL_ATTR_TYPE_BINARY, |
| 178 | NL_ATTR_TYPE_STRING, |
| 179 | NL_ATTR_TYPE_NUL_STRING, |
| 180 | NL_ATTR_TYPE_NESTED, |
| 181 | NL_ATTR_TYPE_NESTED_ARRAY, |
| 182 | NL_ATTR_TYPE_BITFIELD32, |
| 183 | }; |
| 184 | enum netlink_policy_type_attr { |
| 185 | NL_POLICY_TYPE_ATTR_UNSPEC, |
| 186 | NL_POLICY_TYPE_ATTR_TYPE, |
| 187 | NL_POLICY_TYPE_ATTR_MIN_VALUE_S, |
| 188 | NL_POLICY_TYPE_ATTR_MAX_VALUE_S, |
| 189 | NL_POLICY_TYPE_ATTR_MIN_VALUE_U, |
| 190 | NL_POLICY_TYPE_ATTR_MAX_VALUE_U, |
| 191 | NL_POLICY_TYPE_ATTR_MIN_LENGTH, |
| 192 | NL_POLICY_TYPE_ATTR_MAX_LENGTH, |
| 193 | NL_POLICY_TYPE_ATTR_POLICY_IDX, |
| 194 | NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE, |
| 195 | NL_POLICY_TYPE_ATTR_BITFIELD32_MASK, |
| 196 | NL_POLICY_TYPE_ATTR_PAD, |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 197 | NL_POLICY_TYPE_ATTR_MASK, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 198 | __NL_POLICY_TYPE_ATTR_MAX, |
| 199 | NL_POLICY_TYPE_ATTR_MAX = __NL_POLICY_TYPE_ATTR_MAX - 1 |
| 200 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 201 | #endif |