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