1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #include <netinet/in.h>
5 #include <sys/socket.h>
6 #include <linux/can/vxcan.h>
7 #include <linux/netlink.h>
8 #include <linux/rtnetlink.h>
9 #include <linux/genetlink.h>
12 #include <linux/batman_adv.h>
13 #include <linux/can/netlink.h>
14 #include <linux/fib_rules.h>
15 #include <linux/fou.h>
16 #include <linux/if_addr.h>
17 #include <linux/if_addrlabel.h>
18 #include <linux/if_bridge.h>
19 #include <linux/if_link.h>
20 #include <linux/if_macsec.h>
21 #include <linux/if_tunnel.h>
22 #include <linux/l2tp.h>
23 #include <linux/netfilter/nf_tables.h>
24 #include <linux/netfilter/nfnetlink.h>
25 #include <linux/nexthop.h>
26 #include <linux/nl80211.h>
27 #include <linux/pkt_sched.h>
28 #include <linux/veth.h>
29 #include <linux/wireguard.h>
31 #include "sd-netlink.h"
33 #include "generic-netlink.h"
36 #include "netlink-internal.h"
37 #include "netlink-types.h"
38 #include "string-table.h"
41 /* Maximum ARP IP target defined in kernel */
42 #define BOND_MAX_ARP_TARGETS 16
60 BOND_ARP_TARGETS_MAX
= BOND_MAX_ARP_TARGETS
,
66 const NLTypeSystem
*type_system
;
67 const NLTypeSystemUnion
*type_system_union
;
75 static const NLTypeSystem rtnl_link_type_system
;
77 static const NLType empty_types
[1] = {
78 /* fake array to avoid .types==NULL, which denotes invalid type-systems */
81 static const NLTypeSystem empty_type_system
= {
86 static const NLType rtnl_link_info_data_batadv_types
[] = {
87 [IFLA_BATADV_ALGO_NAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= 20 },
90 static const NLType rtnl_link_info_data_veth_types
[] = {
91 [VETH_INFO_PEER
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
94 static const NLType rtnl_link_info_data_vxcan_types
[] = {
95 [VXCAN_INFO_PEER
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
98 static const NLType rtnl_link_info_data_ipvlan_types
[] = {
99 [IFLA_IPVLAN_MODE
] = { .type
= NETLINK_TYPE_U16
},
100 [IFLA_IPVLAN_FLAGS
] = { .type
= NETLINK_TYPE_U16
},
103 static const NLType rtnl_macvlan_macaddr_types
[] = {
104 [IFLA_MACVLAN_MACADDR
] = { .type
= NETLINK_TYPE_ETHER_ADDR
},
107 static const NLTypeSystem rtnl_macvlan_macaddr_type_system
= {
108 .count
= ELEMENTSOF(rtnl_macvlan_macaddr_types
),
109 .types
= rtnl_macvlan_macaddr_types
,
112 static const NLType rtnl_link_info_data_macvlan_types
[] = {
113 [IFLA_MACVLAN_MODE
] = { .type
= NETLINK_TYPE_U32
},
114 [IFLA_MACVLAN_FLAGS
] = { .type
= NETLINK_TYPE_U16
},
115 [IFLA_MACVLAN_MACADDR_MODE
] = { .type
= NETLINK_TYPE_U32
},
116 [IFLA_MACVLAN_MACADDR_DATA
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_macvlan_macaddr_type_system
},
117 [IFLA_MACVLAN_MACADDR_COUNT
] = { .type
= NETLINK_TYPE_U32
},
118 [IFLA_MACVLAN_BC_QUEUE_LEN
] = { .type
= NETLINK_TYPE_U32
},
119 [IFLA_MACVLAN_BC_QUEUE_LEN_USED
] = { .type
= NETLINK_TYPE_REJECT
},
122 static const NLType rtnl_link_info_data_bridge_types
[] = {
123 [IFLA_BR_FORWARD_DELAY
] = { .type
= NETLINK_TYPE_U32
},
124 [IFLA_BR_HELLO_TIME
] = { .type
= NETLINK_TYPE_U32
},
125 [IFLA_BR_MAX_AGE
] = { .type
= NETLINK_TYPE_U32
},
126 [IFLA_BR_AGEING_TIME
] = { .type
= NETLINK_TYPE_U32
},
127 [IFLA_BR_STP_STATE
] = { .type
= NETLINK_TYPE_U32
},
128 [IFLA_BR_PRIORITY
] = { .type
= NETLINK_TYPE_U16
},
129 [IFLA_BR_VLAN_FILTERING
] = { .type
= NETLINK_TYPE_U8
},
130 [IFLA_BR_VLAN_PROTOCOL
] = { .type
= NETLINK_TYPE_U16
},
131 [IFLA_BR_GROUP_FWD_MASK
] = { .type
= NETLINK_TYPE_U16
},
132 [IFLA_BR_ROOT_PORT
] = { .type
= NETLINK_TYPE_U16
},
133 [IFLA_BR_ROOT_PATH_COST
] = { .type
= NETLINK_TYPE_U32
},
134 [IFLA_BR_TOPOLOGY_CHANGE
] = { .type
= NETLINK_TYPE_U8
},
135 [IFLA_BR_TOPOLOGY_CHANGE_DETECTED
] = { .type
= NETLINK_TYPE_U8
},
136 [IFLA_BR_HELLO_TIMER
] = { .type
= NETLINK_TYPE_U16
},
137 [IFLA_BR_TCN_TIMER
] = { .type
= NETLINK_TYPE_U16
},
138 [IFLA_BR_TOPOLOGY_CHANGE_TIMER
] = { .type
= NETLINK_TYPE_U16
},
139 [IFLA_BR_GC_TIMER
] = { .type
= NETLINK_TYPE_U64
},
140 [IFLA_BR_GROUP_ADDR
] = { .type
= NETLINK_TYPE_U16
},
141 [IFLA_BR_FDB_FLUSH
] = { .type
= NETLINK_TYPE_U16
},
142 [IFLA_BR_MCAST_ROUTER
] = { .type
= NETLINK_TYPE_U8
},
143 [IFLA_BR_MCAST_SNOOPING
] = { .type
= NETLINK_TYPE_U8
},
144 [IFLA_BR_MCAST_QUERY_USE_IFADDR
] = { .type
= NETLINK_TYPE_U8
},
145 [IFLA_BR_MCAST_QUERIER
] = { .type
= NETLINK_TYPE_U8
},
146 [IFLA_BR_MCAST_HASH_ELASTICITY
] = { .type
= NETLINK_TYPE_U32
},
147 [IFLA_BR_MCAST_HASH_MAX
] = { .type
= NETLINK_TYPE_U16
},
148 [IFLA_BR_MCAST_LAST_MEMBER_CNT
] = { .type
= NETLINK_TYPE_U32
},
149 [IFLA_BR_MCAST_STARTUP_QUERY_CNT
] = { .type
= NETLINK_TYPE_U16
},
150 [IFLA_BR_MCAST_LAST_MEMBER_INTVL
] = { .type
= NETLINK_TYPE_U64
},
151 [IFLA_BR_MCAST_MEMBERSHIP_INTVL
] = { .type
= NETLINK_TYPE_U64
},
152 [IFLA_BR_MCAST_QUERIER_INTVL
] = { .type
= NETLINK_TYPE_U64
},
153 [IFLA_BR_MCAST_QUERY_INTVL
] = { .type
= NETLINK_TYPE_U64
},
154 [IFLA_BR_MCAST_QUERY_RESPONSE_INTVL
] = { .type
= NETLINK_TYPE_U64
},
155 [IFLA_BR_MCAST_STARTUP_QUERY_INTVL
] = { .type
= NETLINK_TYPE_U64
},
156 [IFLA_BR_NF_CALL_IPTABLES
] = { .type
= NETLINK_TYPE_U8
},
157 [IFLA_BR_NF_CALL_IP6TABLES
] = { .type
= NETLINK_TYPE_U8
},
158 [IFLA_BR_NF_CALL_ARPTABLES
] = { .type
= NETLINK_TYPE_U8
},
159 [IFLA_BR_VLAN_DEFAULT_PVID
] = { .type
= NETLINK_TYPE_U16
},
160 [IFLA_BR_MCAST_IGMP_VERSION
] = { .type
= NETLINK_TYPE_U8
},
163 static const NLType rtnl_vlan_qos_map_types
[] = {
164 [IFLA_VLAN_QOS_MAPPING
] = { .size
= sizeof(struct ifla_vlan_qos_mapping
) },
167 static const NLTypeSystem rtnl_vlan_qos_map_type_system
= {
168 .count
= ELEMENTSOF(rtnl_vlan_qos_map_types
),
169 .types
= rtnl_vlan_qos_map_types
,
172 static const NLType rtnl_link_info_data_vlan_types
[] = {
173 [IFLA_VLAN_ID
] = { .type
= NETLINK_TYPE_U16
},
174 [IFLA_VLAN_FLAGS
] = { .size
= sizeof(struct ifla_vlan_flags
) },
175 [IFLA_VLAN_EGRESS_QOS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_vlan_qos_map_type_system
},
176 [IFLA_VLAN_INGRESS_QOS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_vlan_qos_map_type_system
},
177 [IFLA_VLAN_PROTOCOL
] = { .type
= NETLINK_TYPE_U16
},
180 static const NLType rtnl_link_info_data_vxlan_types
[] = {
181 [IFLA_VXLAN_ID
] = { .type
= NETLINK_TYPE_U32
},
182 [IFLA_VXLAN_GROUP
] = { .type
= NETLINK_TYPE_IN_ADDR
},
183 [IFLA_VXLAN_LINK
] = { .type
= NETLINK_TYPE_U32
},
184 [IFLA_VXLAN_LOCAL
] = { .type
= NETLINK_TYPE_IN_ADDR
},
185 [IFLA_VXLAN_TTL
] = { .type
= NETLINK_TYPE_U8
},
186 [IFLA_VXLAN_TOS
] = { .type
= NETLINK_TYPE_U8
},
187 [IFLA_VXLAN_LEARNING
] = { .type
= NETLINK_TYPE_U8
},
188 [IFLA_VXLAN_AGEING
] = { .type
= NETLINK_TYPE_U32
},
189 [IFLA_VXLAN_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
190 [IFLA_VXLAN_PORT_RANGE
] = { .type
= NETLINK_TYPE_U32
},
191 [IFLA_VXLAN_PROXY
] = { .type
= NETLINK_TYPE_U8
},
192 [IFLA_VXLAN_RSC
] = { .type
= NETLINK_TYPE_U8
},
193 [IFLA_VXLAN_L2MISS
] = { .type
= NETLINK_TYPE_U8
},
194 [IFLA_VXLAN_L3MISS
] = { .type
= NETLINK_TYPE_U8
},
195 [IFLA_VXLAN_PORT
] = { .type
= NETLINK_TYPE_U16
},
196 [IFLA_VXLAN_GROUP6
] = { .type
= NETLINK_TYPE_IN_ADDR
},
197 [IFLA_VXLAN_LOCAL6
] = { .type
= NETLINK_TYPE_IN_ADDR
},
198 [IFLA_VXLAN_UDP_CSUM
] = { .type
= NETLINK_TYPE_U8
},
199 [IFLA_VXLAN_UDP_ZERO_CSUM6_TX
] = { .type
= NETLINK_TYPE_U8
},
200 [IFLA_VXLAN_UDP_ZERO_CSUM6_RX
] = { .type
= NETLINK_TYPE_U8
},
201 [IFLA_VXLAN_REMCSUM_TX
] = { .type
= NETLINK_TYPE_U8
},
202 [IFLA_VXLAN_REMCSUM_RX
] = { .type
= NETLINK_TYPE_U8
},
203 [IFLA_VXLAN_GBP
] = { .type
= NETLINK_TYPE_FLAG
},
204 [IFLA_VXLAN_REMCSUM_NOPARTIAL
] = { .type
= NETLINK_TYPE_FLAG
},
205 [IFLA_VXLAN_COLLECT_METADATA
] = { .type
= NETLINK_TYPE_U8
},
206 [IFLA_VXLAN_LABEL
] = { .type
= NETLINK_TYPE_U32
},
207 [IFLA_VXLAN_GPE
] = { .type
= NETLINK_TYPE_FLAG
},
208 [IFLA_VXLAN_TTL_INHERIT
] = { .type
= NETLINK_TYPE_FLAG
},
209 [IFLA_VXLAN_DF
] = { .type
= NETLINK_TYPE_U8
},
212 static const NLType rtnl_bond_arp_target_types
[] = {
213 [BOND_ARP_TARGETS_0
] = { .type
= NETLINK_TYPE_U32
},
214 [BOND_ARP_TARGETS_1
] = { .type
= NETLINK_TYPE_U32
},
215 [BOND_ARP_TARGETS_2
] = { .type
= NETLINK_TYPE_U32
},
216 [BOND_ARP_TARGETS_3
] = { .type
= NETLINK_TYPE_U32
},
217 [BOND_ARP_TARGETS_4
] = { .type
= NETLINK_TYPE_U32
},
218 [BOND_ARP_TARGETS_5
] = { .type
= NETLINK_TYPE_U32
},
219 [BOND_ARP_TARGETS_6
] = { .type
= NETLINK_TYPE_U32
},
220 [BOND_ARP_TARGETS_7
] = { .type
= NETLINK_TYPE_U32
},
221 [BOND_ARP_TARGETS_8
] = { .type
= NETLINK_TYPE_U32
},
222 [BOND_ARP_TARGETS_9
] = { .type
= NETLINK_TYPE_U32
},
223 [BOND_ARP_TARGETS_10
] = { .type
= NETLINK_TYPE_U32
},
224 [BOND_ARP_TARGETS_11
] = { .type
= NETLINK_TYPE_U32
},
225 [BOND_ARP_TARGETS_12
] = { .type
= NETLINK_TYPE_U32
},
226 [BOND_ARP_TARGETS_13
] = { .type
= NETLINK_TYPE_U32
},
227 [BOND_ARP_TARGETS_14
] = { .type
= NETLINK_TYPE_U32
},
228 [BOND_ARP_TARGETS_MAX
] = { .type
= NETLINK_TYPE_U32
},
231 static const NLTypeSystem rtnl_bond_arp_type_system
= {
232 .count
= ELEMENTSOF(rtnl_bond_arp_target_types
),
233 .types
= rtnl_bond_arp_target_types
,
236 static const NLType rtnl_link_info_data_bond_types
[] = {
237 [IFLA_BOND_MODE
] = { .type
= NETLINK_TYPE_U8
},
238 [IFLA_BOND_ACTIVE_SLAVE
] = { .type
= NETLINK_TYPE_U32
},
239 [IFLA_BOND_MIIMON
] = { .type
= NETLINK_TYPE_U32
},
240 [IFLA_BOND_UPDELAY
] = { .type
= NETLINK_TYPE_U32
},
241 [IFLA_BOND_DOWNDELAY
] = { .type
= NETLINK_TYPE_U32
},
242 [IFLA_BOND_USE_CARRIER
] = { .type
= NETLINK_TYPE_U8
},
243 [IFLA_BOND_ARP_INTERVAL
] = { .type
= NETLINK_TYPE_U32
},
244 [IFLA_BOND_ARP_IP_TARGET
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_bond_arp_type_system
},
245 [IFLA_BOND_ARP_VALIDATE
] = { .type
= NETLINK_TYPE_U32
},
246 [IFLA_BOND_ARP_ALL_TARGETS
] = { .type
= NETLINK_TYPE_U32
},
247 [IFLA_BOND_PRIMARY
] = { .type
= NETLINK_TYPE_U32
},
248 [IFLA_BOND_PRIMARY_RESELECT
] = { .type
= NETLINK_TYPE_U8
},
249 [IFLA_BOND_FAIL_OVER_MAC
] = { .type
= NETLINK_TYPE_U8
},
250 [IFLA_BOND_XMIT_HASH_POLICY
] = { .type
= NETLINK_TYPE_U8
},
251 [IFLA_BOND_RESEND_IGMP
] = { .type
= NETLINK_TYPE_U32
},
252 [IFLA_BOND_NUM_PEER_NOTIF
] = { .type
= NETLINK_TYPE_U8
},
253 [IFLA_BOND_ALL_SLAVES_ACTIVE
] = { .type
= NETLINK_TYPE_U8
},
254 [IFLA_BOND_MIN_LINKS
] = { .type
= NETLINK_TYPE_U32
},
255 [IFLA_BOND_LP_INTERVAL
] = { .type
= NETLINK_TYPE_U32
},
256 [IFLA_BOND_PACKETS_PER_SLAVE
] = { .type
= NETLINK_TYPE_U32
},
257 [IFLA_BOND_AD_LACP_RATE
] = { .type
= NETLINK_TYPE_U8
},
258 [IFLA_BOND_AD_SELECT
] = { .type
= NETLINK_TYPE_U8
},
259 [IFLA_BOND_AD_INFO
] = { .type
= NETLINK_TYPE_NESTED
},
260 [IFLA_BOND_AD_ACTOR_SYS_PRIO
] = { .type
= NETLINK_TYPE_U16
},
261 [IFLA_BOND_AD_USER_PORT_KEY
] = { .type
= NETLINK_TYPE_U16
},
262 [IFLA_BOND_AD_ACTOR_SYSTEM
] = { .type
= NETLINK_TYPE_ETHER_ADDR
},
263 [IFLA_BOND_TLB_DYNAMIC_LB
] = { .type
= NETLINK_TYPE_U8
},
266 static const NLType rtnl_link_info_data_iptun_types
[] = {
267 [IFLA_IPTUN_LINK
] = { .type
= NETLINK_TYPE_U32
},
268 [IFLA_IPTUN_LOCAL
] = { .type
= NETLINK_TYPE_IN_ADDR
},
269 [IFLA_IPTUN_REMOTE
] = { .type
= NETLINK_TYPE_IN_ADDR
},
270 [IFLA_IPTUN_TTL
] = { .type
= NETLINK_TYPE_U8
},
271 [IFLA_IPTUN_TOS
] = { .type
= NETLINK_TYPE_U8
},
272 [IFLA_IPTUN_PMTUDISC
] = { .type
= NETLINK_TYPE_U8
},
273 [IFLA_IPTUN_FLAGS
] = { .type
= NETLINK_TYPE_U16
},
274 [IFLA_IPTUN_PROTO
] = { .type
= NETLINK_TYPE_U8
},
275 [IFLA_IPTUN_6RD_PREFIX
] = { .type
= NETLINK_TYPE_IN_ADDR
},
276 [IFLA_IPTUN_6RD_RELAY_PREFIX
] = { .type
= NETLINK_TYPE_U32
},
277 [IFLA_IPTUN_6RD_PREFIXLEN
] = { .type
= NETLINK_TYPE_U16
},
278 [IFLA_IPTUN_6RD_RELAY_PREFIXLEN
] = { .type
= NETLINK_TYPE_U16
},
279 [IFLA_IPTUN_ENCAP_TYPE
] = { .type
= NETLINK_TYPE_U16
},
280 [IFLA_IPTUN_ENCAP_FLAGS
] = { .type
= NETLINK_TYPE_U16
},
281 [IFLA_IPTUN_ENCAP_SPORT
] = { .type
= NETLINK_TYPE_U16
},
282 [IFLA_IPTUN_ENCAP_DPORT
] = { .type
= NETLINK_TYPE_U16
},
285 static const NLType rtnl_link_info_data_ipgre_types
[] = {
286 [IFLA_GRE_LINK
] = { .type
= NETLINK_TYPE_U32
},
287 [IFLA_GRE_IFLAGS
] = { .type
= NETLINK_TYPE_U16
},
288 [IFLA_GRE_OFLAGS
] = { .type
= NETLINK_TYPE_U16
},
289 [IFLA_GRE_IKEY
] = { .type
= NETLINK_TYPE_U32
},
290 [IFLA_GRE_OKEY
] = { .type
= NETLINK_TYPE_U32
},
291 [IFLA_GRE_LOCAL
] = { .type
= NETLINK_TYPE_IN_ADDR
},
292 [IFLA_GRE_REMOTE
] = { .type
= NETLINK_TYPE_IN_ADDR
},
293 [IFLA_GRE_TTL
] = { .type
= NETLINK_TYPE_U8
},
294 [IFLA_GRE_TOS
] = { .type
= NETLINK_TYPE_U8
},
295 [IFLA_GRE_PMTUDISC
] = { .type
= NETLINK_TYPE_U8
},
296 [IFLA_GRE_FLOWINFO
] = { .type
= NETLINK_TYPE_U32
},
297 [IFLA_GRE_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
298 [IFLA_GRE_ENCAP_TYPE
] = { .type
= NETLINK_TYPE_U16
},
299 [IFLA_GRE_ENCAP_FLAGS
] = { .type
= NETLINK_TYPE_U16
},
300 [IFLA_GRE_ENCAP_SPORT
] = { .type
= NETLINK_TYPE_U16
},
301 [IFLA_GRE_ENCAP_DPORT
] = { .type
= NETLINK_TYPE_U16
},
302 [IFLA_GRE_ERSPAN_INDEX
] = { .type
= NETLINK_TYPE_U32
},
305 static const NLType rtnl_link_info_data_ipvti_types
[] = {
306 [IFLA_VTI_LINK
] = { .type
= NETLINK_TYPE_U32
},
307 [IFLA_VTI_IKEY
] = { .type
= NETLINK_TYPE_U32
},
308 [IFLA_VTI_OKEY
] = { .type
= NETLINK_TYPE_U32
},
309 [IFLA_VTI_LOCAL
] = { .type
= NETLINK_TYPE_IN_ADDR
},
310 [IFLA_VTI_REMOTE
] = { .type
= NETLINK_TYPE_IN_ADDR
},
313 static const NLType rtnl_link_info_data_ip6tnl_types
[] = {
314 [IFLA_IPTUN_LINK
] = { .type
= NETLINK_TYPE_U32
},
315 [IFLA_IPTUN_LOCAL
] = { .type
= NETLINK_TYPE_IN_ADDR
},
316 [IFLA_IPTUN_REMOTE
] = { .type
= NETLINK_TYPE_IN_ADDR
},
317 [IFLA_IPTUN_TTL
] = { .type
= NETLINK_TYPE_U8
},
318 [IFLA_IPTUN_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
319 [IFLA_IPTUN_PROTO
] = { .type
= NETLINK_TYPE_U8
},
320 [IFLA_IPTUN_ENCAP_LIMIT
] = { .type
= NETLINK_TYPE_U8
},
321 [IFLA_IPTUN_FLOWINFO
] = { .type
= NETLINK_TYPE_U32
},
324 static const NLType rtnl_link_info_data_vrf_types
[] = {
325 [IFLA_VRF_TABLE
] = { .type
= NETLINK_TYPE_U32
},
328 static const NLType rtnl_link_info_data_geneve_types
[] = {
329 [IFLA_GENEVE_ID
] = { .type
= NETLINK_TYPE_U32
},
330 [IFLA_GENEVE_TTL
] = { .type
= NETLINK_TYPE_U8
},
331 [IFLA_GENEVE_TOS
] = { .type
= NETLINK_TYPE_U8
},
332 [IFLA_GENEVE_PORT
] = { .type
= NETLINK_TYPE_U16
},
333 [IFLA_GENEVE_REMOTE
] = { .type
= NETLINK_TYPE_IN_ADDR
},
334 [IFLA_GENEVE_REMOTE6
] = { .type
= NETLINK_TYPE_IN_ADDR
},
335 [IFLA_GENEVE_UDP_CSUM
] = { .type
= NETLINK_TYPE_U8
},
336 [IFLA_GENEVE_UDP_ZERO_CSUM6_TX
] = { .type
= NETLINK_TYPE_U8
},
337 [IFLA_GENEVE_UDP_ZERO_CSUM6_RX
] = { .type
= NETLINK_TYPE_U8
},
338 [IFLA_GENEVE_LABEL
] = { .type
= NETLINK_TYPE_U32
},
339 [IFLA_GENEVE_TTL_INHERIT
] = { .type
= NETLINK_TYPE_U8
},
340 [IFLA_GENEVE_DF
] = { .type
= NETLINK_TYPE_U8
},
343 static const NLType rtnl_link_info_data_can_types
[] = {
344 [IFLA_CAN_BITTIMING
] = { .size
= sizeof(struct can_bittiming
) },
345 [IFLA_CAN_RESTART_MS
] = { .type
= NETLINK_TYPE_U32
},
346 [IFLA_CAN_CTRLMODE
] = { .size
= sizeof(struct can_ctrlmode
) },
347 [IFLA_CAN_TERMINATION
] = { .type
= NETLINK_TYPE_U16
},
350 static const NLType rtnl_link_info_data_macsec_types
[] = {
351 [IFLA_MACSEC_SCI
] = { .type
= NETLINK_TYPE_U64
},
352 [IFLA_MACSEC_PORT
] = { .type
= NETLINK_TYPE_U16
},
353 [IFLA_MACSEC_ICV_LEN
] = { .type
= NETLINK_TYPE_U8
},
354 [IFLA_MACSEC_CIPHER_SUITE
] = { .type
= NETLINK_TYPE_U64
},
355 [IFLA_MACSEC_WINDOW
] = { .type
= NETLINK_TYPE_U32
},
356 [IFLA_MACSEC_ENCODING_SA
] = { .type
= NETLINK_TYPE_U8
},
357 [IFLA_MACSEC_ENCRYPT
] = { .type
= NETLINK_TYPE_U8
},
358 [IFLA_MACSEC_PROTECT
] = { .type
= NETLINK_TYPE_U8
},
359 [IFLA_MACSEC_INC_SCI
] = { .type
= NETLINK_TYPE_U8
},
360 [IFLA_MACSEC_ES
] = { .type
= NETLINK_TYPE_U8
},
361 [IFLA_MACSEC_SCB
] = { .type
= NETLINK_TYPE_U8
},
362 [IFLA_MACSEC_REPLAY_PROTECT
] = { .type
= NETLINK_TYPE_U8
},
363 [IFLA_MACSEC_VALIDATION
] = { .type
= NETLINK_TYPE_U8
},
366 static const NLType rtnl_link_info_data_xfrm_types
[] = {
367 [IFLA_XFRM_LINK
] = { .type
= NETLINK_TYPE_U32
},
368 [IFLA_XFRM_IF_ID
] = { .type
= NETLINK_TYPE_U32
}
371 static const NLType rtnl_link_info_data_bareudp_types
[] = {
372 [IFLA_BAREUDP_PORT
] = { .type
= NETLINK_TYPE_U16
},
373 [IFLA_BAREUDP_ETHERTYPE
] = { .type
= NETLINK_TYPE_U16
},
374 [IFLA_BAREUDP_SRCPORT_MIN
] = { .type
= NETLINK_TYPE_U16
},
375 [IFLA_BAREUDP_MULTIPROTO_MODE
] = { .type
= NETLINK_TYPE_FLAG
},
378 /* these strings must match the .kind entries in the kernel */
379 static const char* const nl_union_link_info_data_table
[] = {
380 [NL_UNION_LINK_INFO_DATA_BOND
] = "bond",
381 [NL_UNION_LINK_INFO_DATA_BRIDGE
] = "bridge",
382 [NL_UNION_LINK_INFO_DATA_VLAN
] = "vlan",
383 [NL_UNION_LINK_INFO_DATA_VETH
] = "veth",
384 [NL_UNION_LINK_INFO_DATA_DUMMY
] = "dummy",
385 [NL_UNION_LINK_INFO_DATA_MACVLAN
] = "macvlan",
386 [NL_UNION_LINK_INFO_DATA_MACVTAP
] = "macvtap",
387 [NL_UNION_LINK_INFO_DATA_IPVLAN
] = "ipvlan",
388 [NL_UNION_LINK_INFO_DATA_IPVTAP
] = "ipvtap",
389 [NL_UNION_LINK_INFO_DATA_VXLAN
] = "vxlan",
390 [NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL
] = "ipip",
391 [NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL
] = "gre",
392 [NL_UNION_LINK_INFO_DATA_ERSPAN
] = "erspan",
393 [NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL
] = "gretap",
394 [NL_UNION_LINK_INFO_DATA_IP6GRE_TUNNEL
] = "ip6gre",
395 [NL_UNION_LINK_INFO_DATA_IP6GRETAP_TUNNEL
] = "ip6gretap",
396 [NL_UNION_LINK_INFO_DATA_SIT_TUNNEL
] = "sit",
397 [NL_UNION_LINK_INFO_DATA_VTI_TUNNEL
] = "vti",
398 [NL_UNION_LINK_INFO_DATA_VTI6_TUNNEL
] = "vti6",
399 [NL_UNION_LINK_INFO_DATA_IP6TNL_TUNNEL
] = "ip6tnl",
400 [NL_UNION_LINK_INFO_DATA_VRF
] = "vrf",
401 [NL_UNION_LINK_INFO_DATA_VCAN
] = "vcan",
402 [NL_UNION_LINK_INFO_DATA_GENEVE
] = "geneve",
403 [NL_UNION_LINK_INFO_DATA_VXCAN
] = "vxcan",
404 [NL_UNION_LINK_INFO_DATA_WIREGUARD
] = "wireguard",
405 [NL_UNION_LINK_INFO_DATA_NETDEVSIM
] = "netdevsim",
406 [NL_UNION_LINK_INFO_DATA_CAN
] = "can",
407 [NL_UNION_LINK_INFO_DATA_MACSEC
] = "macsec",
408 [NL_UNION_LINK_INFO_DATA_NLMON
] = "nlmon",
409 [NL_UNION_LINK_INFO_DATA_XFRM
] = "xfrm",
410 [NL_UNION_LINK_INFO_DATA_IFB
] = "ifb",
411 [NL_UNION_LINK_INFO_DATA_BAREUDP
] = "bareudp",
412 [NL_UNION_LINK_INFO_DATA_BATADV
] = "batadv",
415 DEFINE_STRING_TABLE_LOOKUP(nl_union_link_info_data
, NLUnionLinkInfoData
);
417 static const NLTypeSystem rtnl_link_info_data_type_systems
[] = {
418 [NL_UNION_LINK_INFO_DATA_BOND
] = { .count
= ELEMENTSOF(rtnl_link_info_data_bond_types
),
419 .types
= rtnl_link_info_data_bond_types
},
420 [NL_UNION_LINK_INFO_DATA_BRIDGE
] = { .count
= ELEMENTSOF(rtnl_link_info_data_bridge_types
),
421 .types
= rtnl_link_info_data_bridge_types
},
422 [NL_UNION_LINK_INFO_DATA_VLAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_vlan_types
),
423 .types
= rtnl_link_info_data_vlan_types
},
424 [NL_UNION_LINK_INFO_DATA_VETH
] = { .count
= ELEMENTSOF(rtnl_link_info_data_veth_types
),
425 .types
= rtnl_link_info_data_veth_types
},
426 [NL_UNION_LINK_INFO_DATA_MACVLAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_macvlan_types
),
427 .types
= rtnl_link_info_data_macvlan_types
},
428 [NL_UNION_LINK_INFO_DATA_MACVTAP
] = { .count
= ELEMENTSOF(rtnl_link_info_data_macvlan_types
),
429 .types
= rtnl_link_info_data_macvlan_types
},
430 [NL_UNION_LINK_INFO_DATA_IPVLAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipvlan_types
),
431 .types
= rtnl_link_info_data_ipvlan_types
},
432 [NL_UNION_LINK_INFO_DATA_IPVTAP
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipvlan_types
),
433 .types
= rtnl_link_info_data_ipvlan_types
},
434 [NL_UNION_LINK_INFO_DATA_VXLAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_vxlan_types
),
435 .types
= rtnl_link_info_data_vxlan_types
},
436 [NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_iptun_types
),
437 .types
= rtnl_link_info_data_iptun_types
},
438 [NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipgre_types
),
439 .types
= rtnl_link_info_data_ipgre_types
},
440 [NL_UNION_LINK_INFO_DATA_ERSPAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipgre_types
),
441 .types
= rtnl_link_info_data_ipgre_types
},
442 [NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipgre_types
),
443 .types
= rtnl_link_info_data_ipgre_types
},
444 [NL_UNION_LINK_INFO_DATA_IP6GRE_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipgre_types
),
445 .types
= rtnl_link_info_data_ipgre_types
},
446 [NL_UNION_LINK_INFO_DATA_IP6GRETAP_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipgre_types
),
447 .types
= rtnl_link_info_data_ipgre_types
},
448 [NL_UNION_LINK_INFO_DATA_SIT_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_iptun_types
),
449 .types
= rtnl_link_info_data_iptun_types
},
450 [NL_UNION_LINK_INFO_DATA_VTI_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipvti_types
),
451 .types
= rtnl_link_info_data_ipvti_types
},
452 [NL_UNION_LINK_INFO_DATA_VTI6_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ipvti_types
),
453 .types
= rtnl_link_info_data_ipvti_types
},
454 [NL_UNION_LINK_INFO_DATA_IP6TNL_TUNNEL
] = { .count
= ELEMENTSOF(rtnl_link_info_data_ip6tnl_types
),
455 .types
= rtnl_link_info_data_ip6tnl_types
},
456 [NL_UNION_LINK_INFO_DATA_VRF
] = { .count
= ELEMENTSOF(rtnl_link_info_data_vrf_types
),
457 .types
= rtnl_link_info_data_vrf_types
},
458 [NL_UNION_LINK_INFO_DATA_GENEVE
] = { .count
= ELEMENTSOF(rtnl_link_info_data_geneve_types
),
459 .types
= rtnl_link_info_data_geneve_types
},
460 [NL_UNION_LINK_INFO_DATA_VXCAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_vxcan_types
),
461 .types
= rtnl_link_info_data_vxcan_types
},
462 [NL_UNION_LINK_INFO_DATA_CAN
] = { .count
= ELEMENTSOF(rtnl_link_info_data_can_types
),
463 .types
= rtnl_link_info_data_can_types
},
464 [NL_UNION_LINK_INFO_DATA_MACSEC
] = { .count
= ELEMENTSOF(rtnl_link_info_data_macsec_types
),
465 .types
= rtnl_link_info_data_macsec_types
},
466 [NL_UNION_LINK_INFO_DATA_XFRM
] = { .count
= ELEMENTSOF(rtnl_link_info_data_xfrm_types
),
467 .types
= rtnl_link_info_data_xfrm_types
},
468 [NL_UNION_LINK_INFO_DATA_BAREUDP
] = { .count
= ELEMENTSOF(rtnl_link_info_data_bareudp_types
),
469 .types
= rtnl_link_info_data_bareudp_types
},
470 [NL_UNION_LINK_INFO_DATA_BATADV
] = { .count
= ELEMENTSOF(rtnl_link_info_data_batadv_types
),
471 .types
= rtnl_link_info_data_batadv_types
},
474 static const NLTypeSystemUnion rtnl_link_info_data_type_system_union
= {
475 .num
= _NL_UNION_LINK_INFO_DATA_MAX
,
476 .lookup
= nl_union_link_info_data_from_string
,
477 .type_systems
= rtnl_link_info_data_type_systems
,
478 .match_type
= NL_MATCH_SIBLING
,
479 .match
= IFLA_INFO_KIND
,
482 static const NLType rtnl_link_info_types
[] = {
483 [IFLA_INFO_KIND
] = { .type
= NETLINK_TYPE_STRING
},
484 [IFLA_INFO_DATA
] = { .type
= NETLINK_TYPE_UNION
, .type_system_union
= &rtnl_link_info_data_type_system_union
},
487 [IFLA_INFO_SLAVE_KIND] = { .type = NETLINK_TYPE_STRING },
488 [IFLA_INFO_SLAVE_DATA] = { .type = NETLINK_TYPE_NESTED },
492 static const NLTypeSystem rtnl_link_info_type_system
= {
493 .count
= ELEMENTSOF(rtnl_link_info_types
),
494 .types
= rtnl_link_info_types
,
497 static const struct NLType rtnl_prot_info_bridge_port_types
[] = {
498 [IFLA_BRPORT_STATE
] = { .type
= NETLINK_TYPE_U8
},
499 [IFLA_BRPORT_COST
] = { .type
= NETLINK_TYPE_U32
},
500 [IFLA_BRPORT_PRIORITY
] = { .type
= NETLINK_TYPE_U16
},
501 [IFLA_BRPORT_MODE
] = { .type
= NETLINK_TYPE_U8
},
502 [IFLA_BRPORT_GUARD
] = { .type
= NETLINK_TYPE_U8
},
503 [IFLA_BRPORT_PROTECT
] = { .type
= NETLINK_TYPE_U8
},
504 [IFLA_BRPORT_FAST_LEAVE
] = { .type
= NETLINK_TYPE_U8
},
505 [IFLA_BRPORT_LEARNING
] = { .type
= NETLINK_TYPE_U8
},
506 [IFLA_BRPORT_UNICAST_FLOOD
] = { .type
= NETLINK_TYPE_U8
},
507 [IFLA_BRPORT_PROXYARP
] = { .type
= NETLINK_TYPE_U8
},
508 [IFLA_BRPORT_LEARNING_SYNC
] = { .type
= NETLINK_TYPE_U8
},
509 [IFLA_BRPORT_PROXYARP_WIFI
] = { .type
= NETLINK_TYPE_U8
},
510 [IFLA_BRPORT_ROOT_ID
] = { .type
= NETLINK_TYPE_U8
},
511 [IFLA_BRPORT_BRIDGE_ID
] = { .type
= NETLINK_TYPE_U8
},
512 [IFLA_BRPORT_DESIGNATED_PORT
] = { .type
= NETLINK_TYPE_U16
},
513 [IFLA_BRPORT_DESIGNATED_COST
] = { .type
= NETLINK_TYPE_U16
},
514 [IFLA_BRPORT_ID
] = { .type
= NETLINK_TYPE_U16
},
515 [IFLA_BRPORT_NO
] = { .type
= NETLINK_TYPE_U16
},
516 [IFLA_BRPORT_TOPOLOGY_CHANGE_ACK
] = { .type
= NETLINK_TYPE_U8
},
517 [IFLA_BRPORT_CONFIG_PENDING
] = { .type
= NETLINK_TYPE_U8
},
518 [IFLA_BRPORT_MESSAGE_AGE_TIMER
] = { .type
= NETLINK_TYPE_U64
},
519 [IFLA_BRPORT_FORWARD_DELAY_TIMER
] = { .type
= NETLINK_TYPE_U64
},
520 [IFLA_BRPORT_HOLD_TIMER
] = { .type
= NETLINK_TYPE_U64
},
521 [IFLA_BRPORT_FLUSH
] = { .type
= NETLINK_TYPE_U8
},
522 [IFLA_BRPORT_MULTICAST_ROUTER
] = { .type
= NETLINK_TYPE_U8
},
523 [IFLA_BRPORT_PAD
] = { .type
= NETLINK_TYPE_U8
},
524 [IFLA_BRPORT_MCAST_FLOOD
] = { .type
= NETLINK_TYPE_U8
},
525 [IFLA_BRPORT_MCAST_TO_UCAST
] = { .type
= NETLINK_TYPE_U8
},
526 [IFLA_BRPORT_VLAN_TUNNEL
] = { .type
= NETLINK_TYPE_U8
},
527 [IFLA_BRPORT_BCAST_FLOOD
] = { .type
= NETLINK_TYPE_U8
},
528 [IFLA_BRPORT_GROUP_FWD_MASK
] = { .type
= NETLINK_TYPE_U16
},
529 [IFLA_BRPORT_NEIGH_SUPPRESS
] = { .type
= NETLINK_TYPE_U8
},
530 [IFLA_BRPORT_ISOLATED
] = { .type
= NETLINK_TYPE_U8
},
531 [IFLA_BRPORT_BACKUP_PORT
] = { .type
= NETLINK_TYPE_U32
},
534 static const NLTypeSystem rtnl_prot_info_type_systems
[] = {
535 [AF_BRIDGE
] = { .count
= ELEMENTSOF(rtnl_prot_info_bridge_port_types
),
536 .types
= rtnl_prot_info_bridge_port_types
},
539 static const NLTypeSystemUnion rtnl_prot_info_type_system_union
= {
541 .type_systems
= rtnl_prot_info_type_systems
,
542 .match_type
= NL_MATCH_PROTOCOL
,
545 static const struct NLType rtnl_af_spec_inet6_types
[] = {
546 [IFLA_INET6_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
551 IFLA_INET6_CACHEINFO,
552 IFLA_INET6_ICMP6STATS,
554 [IFLA_INET6_TOKEN
] = { .type
= NETLINK_TYPE_IN_ADDR
},
555 [IFLA_INET6_ADDR_GEN_MODE
] = { .type
= NETLINK_TYPE_U8
},
558 static const NLTypeSystem rtnl_af_spec_inet6_type_system
= {
559 .count
= ELEMENTSOF(rtnl_af_spec_inet6_types
),
560 .types
= rtnl_af_spec_inet6_types
,
563 static const NLType rtnl_af_spec_unspec_types
[] = {
564 [AF_INET6
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_af_spec_inet6_type_system
},
567 static const NLType rtnl_af_spec_bridge_types
[] = {
568 [IFLA_BRIDGE_FLAGS
] = { .type
= NETLINK_TYPE_U16
},
569 [IFLA_BRIDGE_VLAN_INFO
] = { .size
= sizeof(struct bridge_vlan_info
) },
572 static const NLTypeSystem rtnl_af_spec_type_systems
[] = {
573 [AF_UNSPEC
] = { .count
= ELEMENTSOF(rtnl_af_spec_unspec_types
),
574 .types
= rtnl_af_spec_unspec_types
},
575 [AF_BRIDGE
] = { .count
= ELEMENTSOF(rtnl_af_spec_bridge_types
),
576 .types
= rtnl_af_spec_bridge_types
},
579 static const NLTypeSystemUnion rtnl_af_spec_type_system_union
= {
581 .type_systems
= rtnl_af_spec_type_systems
,
582 .match_type
= NL_MATCH_PROTOCOL
,
585 static const NLType rtnl_prop_list_types
[] = {
586 [IFLA_ALT_IFNAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= ALTIFNAMSIZ
- 1 },
589 static const NLTypeSystem rtnl_prop_list_type_system
= {
590 .count
= ELEMENTSOF(rtnl_prop_list_types
),
591 .types
= rtnl_prop_list_types
,
594 static const NLType rtnl_vf_vlan_list_types
[] = {
595 [IFLA_VF_VLAN_INFO
] = { .size
= sizeof(struct ifla_vf_vlan_info
) },
598 static const NLTypeSystem rtnl_vf_vlan_type_system
= {
599 .count
= ELEMENTSOF(rtnl_vf_vlan_list_types
),
600 .types
= rtnl_vf_vlan_list_types
,
603 static const NLType rtnl_vf_vlan_info_types
[] = {
604 [IFLA_VF_MAC
] = { .size
= sizeof(struct ifla_vf_mac
) },
605 [IFLA_VF_VLAN
] = { .size
= sizeof(struct ifla_vf_vlan
) },
606 [IFLA_VF_VLAN_LIST
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_vf_vlan_type_system
},
607 [IFLA_VF_TX_RATE
] = { .size
= sizeof(struct ifla_vf_tx_rate
) },
608 [IFLA_VF_SPOOFCHK
] = { .size
= sizeof(struct ifla_vf_spoofchk
) },
609 [IFLA_VF_RATE
] = { .size
= sizeof(struct ifla_vf_rate
) },
610 [IFLA_VF_LINK_STATE
] = { .size
= sizeof(struct ifla_vf_link_state
) },
611 [IFLA_VF_RSS_QUERY_EN
] = { .size
= sizeof(struct ifla_vf_rss_query_en
) },
612 [IFLA_VF_TRUST
] = { .size
= sizeof(struct ifla_vf_trust
) },
613 [IFLA_VF_IB_NODE_GUID
] = { .size
= sizeof(struct ifla_vf_guid
) },
614 [IFLA_VF_IB_PORT_GUID
] = { .size
= sizeof(struct ifla_vf_guid
) },
617 static const NLTypeSystem rtnl_vf_vlan_info_type_system
= {
618 .count
= ELEMENTSOF(rtnl_vf_vlan_info_types
),
619 .types
= rtnl_vf_vlan_info_types
,
622 static const NLType rtnl_link_io_srv_types
[] = {
623 [IFLA_VF_INFO
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_vf_vlan_info_type_system
},
626 static const NLTypeSystem rtnl_io_srv_type_system
= {
627 .count
= ELEMENTSOF(rtnl_link_io_srv_types
),
628 .types
= rtnl_link_io_srv_types
,
631 static const NLType rtnl_link_types
[] = {
632 [IFLA_ADDRESS
] = { .type
= NETLINK_TYPE_ETHER_ADDR
},
633 [IFLA_BROADCAST
] = { .type
= NETLINK_TYPE_ETHER_ADDR
},
634 [IFLA_IFNAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFNAMSIZ
- 1 },
635 [IFLA_MTU
] = { .type
= NETLINK_TYPE_U32
},
636 [IFLA_LINK
] = { .type
= NETLINK_TYPE_U32
},
637 [IFLA_QDISC
] = { .type
= NETLINK_TYPE_STRING
},
638 [IFLA_STATS
] = { .size
= sizeof(struct rtnl_link_stats
) },
643 [IFLA_MASTER
] = { .type
= NETLINK_TYPE_U32
},
647 [IFLA_PROTINFO
] = { .type
= NETLINK_TYPE_UNION
, .type_system_union
= &rtnl_prot_info_type_system_union
},
648 [IFLA_TXQLEN
] = { .type
= NETLINK_TYPE_U32
},
650 [IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) },
652 [IFLA_WEIGHT
] = { .type
= NETLINK_TYPE_U32
},
653 [IFLA_OPERSTATE
] = { .type
= NETLINK_TYPE_U8
},
654 [IFLA_LINKMODE
] = { .type
= NETLINK_TYPE_U8
},
655 [IFLA_LINKINFO
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_info_type_system
},
656 [IFLA_NET_NS_PID
] = { .type
= NETLINK_TYPE_U32
},
657 [IFLA_IFALIAS
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFALIASZ
- 1 },
658 [IFLA_NUM_VF
] = { .type
= NETLINK_TYPE_U32
},
659 [IFLA_VFINFO_LIST
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_io_srv_type_system
},
660 [IFLA_STATS64
] = { .size
= sizeof(struct rtnl_link_stats64
) },
662 [IFLA_VF_PORTS] = { .type = NETLINK_TYPE_NESTED },
663 [IFLA_PORT_SELF] = { .type = NETLINK_TYPE_NESTED },
665 [IFLA_AF_SPEC
] = { .type
= NETLINK_TYPE_UNION
, .type_system_union
= &rtnl_af_spec_type_system_union
},
670 [IFLA_GROUP
] = { .type
= NETLINK_TYPE_U32
},
671 [IFLA_NET_NS_FD
] = { .type
= NETLINK_TYPE_U32
},
672 [IFLA_EXT_MASK
] = { .type
= NETLINK_TYPE_U32
},
673 [IFLA_PROMISCUITY
] = { .type
= NETLINK_TYPE_U32
},
674 [IFLA_NUM_TX_QUEUES
] = { .type
= NETLINK_TYPE_U32
},
675 [IFLA_NUM_RX_QUEUES
] = { .type
= NETLINK_TYPE_U32
},
676 [IFLA_GSO_MAX_SEGS
] = { .type
= NETLINK_TYPE_U32
},
677 [IFLA_GSO_MAX_SIZE
] = { .type
= NETLINK_TYPE_U32
},
678 [IFLA_CARRIER
] = { .type
= NETLINK_TYPE_U8
},
680 [IFLA_PHYS_PORT_ID] = { .type = NETLINK_TYPE_BINARY, .len = MAX_PHYS_PORT_ID_LEN },
682 [IFLA_MIN_MTU
] = { .type
= NETLINK_TYPE_U32
},
683 [IFLA_MAX_MTU
] = { .type
= NETLINK_TYPE_U32
},
684 [IFLA_PROP_LIST
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_prop_list_type_system
},
685 [IFLA_ALT_IFNAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= ALTIFNAMSIZ
- 1 },
688 static const NLTypeSystem rtnl_link_type_system
= {
689 .count
= ELEMENTSOF(rtnl_link_types
),
690 .types
= rtnl_link_types
,
693 /* IFA_FLAGS was defined in kernel 3.14, but we still support older
694 * kernels where IFA_MAX is lower. */
695 static const NLType rtnl_address_types
[] = {
696 [IFA_ADDRESS
] = { .type
= NETLINK_TYPE_IN_ADDR
},
697 [IFA_LOCAL
] = { .type
= NETLINK_TYPE_IN_ADDR
},
698 [IFA_LABEL
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFNAMSIZ
- 1 },
699 [IFA_BROADCAST
] = { .type
= NETLINK_TYPE_IN_ADDR
},
700 [IFA_ANYCAST
] = { .type
= NETLINK_TYPE_IN_ADDR
},
701 [IFA_CACHEINFO
] = { .type
= NETLINK_TYPE_CACHE_INFO
, .size
= sizeof(struct ifa_cacheinfo
) },
702 [IFA_MULTICAST
] = { .type
= NETLINK_TYPE_IN_ADDR
},
703 [IFA_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
704 [IFA_RT_PRIORITY
] = { .type
= NETLINK_TYPE_U32
},
705 [IFA_TARGET_NETNSID
] = { .type
= NETLINK_TYPE_S32
},
708 static const NLTypeSystem rtnl_address_type_system
= {
709 .count
= ELEMENTSOF(rtnl_address_types
),
710 .types
= rtnl_address_types
,
713 /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
715 static const NLType rtnl_route_metrics_types
[] = {
716 [RTAX_MTU
] = { .type
= NETLINK_TYPE_U32
},
717 [RTAX_WINDOW
] = { .type
= NETLINK_TYPE_U32
},
718 [RTAX_RTT
] = { .type
= NETLINK_TYPE_U32
},
719 [RTAX_RTTVAR
] = { .type
= NETLINK_TYPE_U32
},
720 [RTAX_SSTHRESH
] = { .type
= NETLINK_TYPE_U32
},
721 [RTAX_CWND
] = { .type
= NETLINK_TYPE_U32
},
722 [RTAX_ADVMSS
] = { .type
= NETLINK_TYPE_U32
},
723 [RTAX_REORDERING
] = { .type
= NETLINK_TYPE_U32
},
724 [RTAX_HOPLIMIT
] = { .type
= NETLINK_TYPE_U32
},
725 [RTAX_INITCWND
] = { .type
= NETLINK_TYPE_U32
},
726 [RTAX_FEATURES
] = { .type
= NETLINK_TYPE_U32
},
727 [RTAX_RTO_MIN
] = { .type
= NETLINK_TYPE_U32
},
728 [RTAX_INITRWND
] = { .type
= NETLINK_TYPE_U32
},
729 [RTAX_QUICKACK
] = { .type
= NETLINK_TYPE_U32
},
730 [RTAX_CC_ALGO
] = { .type
= NETLINK_TYPE_U32
},
731 [RTAX_FASTOPEN_NO_COOKIE
] = { .type
= NETLINK_TYPE_U32
},
734 static const NLTypeSystem rtnl_route_metrics_type_system
= {
735 .count
= ELEMENTSOF(rtnl_route_metrics_types
),
736 .types
= rtnl_route_metrics_types
,
739 static const NLType rtnl_route_types
[] = {
740 [RTA_DST
] = { .type
= NETLINK_TYPE_IN_ADDR
}, /* 6? */
741 [RTA_SRC
] = { .type
= NETLINK_TYPE_IN_ADDR
}, /* 6? */
742 [RTA_IIF
] = { .type
= NETLINK_TYPE_U32
},
743 [RTA_OIF
] = { .type
= NETLINK_TYPE_U32
},
744 [RTA_GATEWAY
] = { .type
= NETLINK_TYPE_IN_ADDR
},
745 [RTA_PRIORITY
] = { .type
= NETLINK_TYPE_U32
},
746 [RTA_PREFSRC
] = { .type
= NETLINK_TYPE_IN_ADDR
}, /* 6? */
747 [RTA_METRICS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_route_metrics_type_system
},
748 [RTA_MULTIPATH
] = { .size
= sizeof(struct rtnexthop
) },
749 [RTA_FLOW
] = { .type
= NETLINK_TYPE_U32
}, /* 6? */
750 [RTA_CACHEINFO
] = { .size
= sizeof(struct rta_cacheinfo
) },
751 [RTA_TABLE
] = { .type
= NETLINK_TYPE_U32
},
752 [RTA_MARK
] = { .type
= NETLINK_TYPE_U32
},
753 [RTA_MFC_STATS
] = { .type
= NETLINK_TYPE_U64
},
754 [RTA_VIA
] = { /* See struct rtvia */ },
755 [RTA_NEWDST
] = { .type
= NETLINK_TYPE_U32
},
756 [RTA_PREF
] = { .type
= NETLINK_TYPE_U8
},
757 [RTA_ENCAP_TYPE
] = { .type
= NETLINK_TYPE_U16
},
758 [RTA_ENCAP
] = { .type
= NETLINK_TYPE_NESTED
}, /* Multiple type systems i.e. LWTUNNEL_ENCAP_MPLS/LWTUNNEL_ENCAP_IP/LWTUNNEL_ENCAP_ILA etc... */
759 [RTA_EXPIRES
] = { .type
= NETLINK_TYPE_U32
},
760 [RTA_UID
] = { .type
= NETLINK_TYPE_U32
},
761 [RTA_TTL_PROPAGATE
] = { .type
= NETLINK_TYPE_U8
},
762 [RTA_IP_PROTO
] = { .type
= NETLINK_TYPE_U8
},
763 [RTA_SPORT
] = { .type
= NETLINK_TYPE_U16
},
764 [RTA_DPORT
] = { .type
= NETLINK_TYPE_U16
},
765 [RTA_NH_ID
] = { .type
= NETLINK_TYPE_U32
},
768 static const NLTypeSystem rtnl_route_type_system
= {
769 .count
= ELEMENTSOF(rtnl_route_types
),
770 .types
= rtnl_route_types
,
773 static const NLType rtnl_neigh_types
[] = {
774 [NDA_DST
] = { .type
= NETLINK_TYPE_IN_ADDR
},
775 [NDA_LLADDR
] = { /* struct ether_addr, struct in_addr, or struct in6_addr */ },
776 [NDA_CACHEINFO
] = { .type
= NETLINK_TYPE_CACHE_INFO
, .size
= sizeof(struct nda_cacheinfo
) },
777 [NDA_PROBES
] = { .type
= NETLINK_TYPE_U32
},
778 [NDA_VLAN
] = { .type
= NETLINK_TYPE_U16
},
779 [NDA_PORT
] = { .type
= NETLINK_TYPE_U16
},
780 [NDA_VNI
] = { .type
= NETLINK_TYPE_U32
},
781 [NDA_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
784 static const NLTypeSystem rtnl_neigh_type_system
= {
785 .count
= ELEMENTSOF(rtnl_neigh_types
),
786 .types
= rtnl_neigh_types
,
789 static const NLType rtnl_addrlabel_types
[] = {
790 [IFAL_ADDRESS
] = { .type
= NETLINK_TYPE_IN_ADDR
, .size
= sizeof(struct in6_addr
) },
791 [IFAL_LABEL
] = { .type
= NETLINK_TYPE_U32
},
794 static const NLTypeSystem rtnl_addrlabel_type_system
= {
795 .count
= ELEMENTSOF(rtnl_addrlabel_types
),
796 .types
= rtnl_addrlabel_types
,
799 static const NLType rtnl_routing_policy_rule_types
[] = {
800 [FRA_DST
] = { .type
= NETLINK_TYPE_IN_ADDR
},
801 [FRA_SRC
] = { .type
= NETLINK_TYPE_IN_ADDR
},
802 [FRA_IIFNAME
] = { .type
= NETLINK_TYPE_STRING
},
803 [FRA_GOTO
] = { .type
= NETLINK_TYPE_U32
},
804 [FRA_PRIORITY
] = { .type
= NETLINK_TYPE_U32
},
805 [FRA_FWMARK
] = { .type
= NETLINK_TYPE_U32
},
806 [FRA_FLOW
] = { .type
= NETLINK_TYPE_U32
},
807 [FRA_TUN_ID
] = { .type
= NETLINK_TYPE_U64
},
808 [FRA_SUPPRESS_IFGROUP
] = { .type
= NETLINK_TYPE_U32
},
809 [FRA_SUPPRESS_PREFIXLEN
] = { .type
= NETLINK_TYPE_U32
},
810 [FRA_TABLE
] = { .type
= NETLINK_TYPE_U32
},
811 [FRA_FWMASK
] = { .type
= NETLINK_TYPE_U32
},
812 [FRA_OIFNAME
] = { .type
= NETLINK_TYPE_STRING
},
813 [FRA_PAD
] = { .type
= NETLINK_TYPE_U32
},
814 [FRA_L3MDEV
] = { .type
= NETLINK_TYPE_U8
},
815 [FRA_UID_RANGE
] = { .size
= sizeof(struct fib_rule_uid_range
) },
816 [FRA_PROTOCOL
] = { .type
= NETLINK_TYPE_U8
},
817 [FRA_IP_PROTO
] = { .type
= NETLINK_TYPE_U8
},
818 [FRA_SPORT_RANGE
] = { .size
= sizeof(struct fib_rule_port_range
) },
819 [FRA_DPORT_RANGE
] = { .size
= sizeof(struct fib_rule_port_range
) },
822 static const NLTypeSystem rtnl_routing_policy_rule_type_system
= {
823 .count
= ELEMENTSOF(rtnl_routing_policy_rule_types
),
824 .types
= rtnl_routing_policy_rule_types
,
827 static const NLType rtnl_nexthop_types
[] = {
828 [NHA_ID
] = { .type
= NETLINK_TYPE_U32
},
829 [NHA_GROUP
] = { /* array of struct nexthop_grp */ },
830 [NHA_GROUP_TYPE
] = { .type
= NETLINK_TYPE_U16
},
831 [NHA_BLACKHOLE
] = { .type
= NETLINK_TYPE_FLAG
},
832 [NHA_OIF
] = { .type
= NETLINK_TYPE_U32
},
833 [NHA_GATEWAY
] = { .type
= NETLINK_TYPE_IN_ADDR
},
834 [NHA_ENCAP_TYPE
] = { .type
= NETLINK_TYPE_U16
},
835 [NHA_ENCAP
] = { .type
= NETLINK_TYPE_NESTED
},
836 [NHA_GROUPS
] = { .type
= NETLINK_TYPE_FLAG
},
837 [NHA_MASTER
] = { .type
= NETLINK_TYPE_U32
},
838 [NHA_FDB
] = { .type
= NETLINK_TYPE_FLAG
},
841 static const NLTypeSystem rtnl_nexthop_type_system
= {
842 .count
= ELEMENTSOF(rtnl_nexthop_types
),
843 .types
= rtnl_nexthop_types
,
846 static const NLType rtnl_tca_option_data_cake_types
[] = {
847 [TCA_CAKE_BASE_RATE64
] = { .type
= NETLINK_TYPE_U64
},
848 [TCA_CAKE_OVERHEAD
] = { .type
= NETLINK_TYPE_S32
},
849 [TCA_CAKE_MPU
] = { .type
= NETLINK_TYPE_U32
},
852 static const NLType rtnl_tca_option_data_codel_types
[] = {
853 [TCA_CODEL_TARGET
] = { .type
= NETLINK_TYPE_U32
},
854 [TCA_CODEL_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
855 [TCA_CODEL_INTERVAL
] = { .type
= NETLINK_TYPE_U32
},
856 [TCA_CODEL_ECN
] = { .type
= NETLINK_TYPE_U32
},
857 [TCA_CODEL_CE_THRESHOLD
] = { .type
= NETLINK_TYPE_U32
},
860 static const NLType rtnl_tca_option_data_drr_types
[] = {
861 [TCA_DRR_QUANTUM
] = { .type
= NETLINK_TYPE_U32
},
864 static const NLType rtnl_tca_option_data_ets_quanta_types
[] = {
865 [TCA_ETS_QUANTA_BAND
] = { .type
= NETLINK_TYPE_U32
, },
868 static const NLTypeSystem rtnl_tca_option_data_ets_quanta_type_system
= {
869 .count
= ELEMENTSOF(rtnl_tca_option_data_ets_quanta_types
),
870 .types
= rtnl_tca_option_data_ets_quanta_types
,
873 static const NLType rtnl_tca_option_data_ets_prio_types
[] = {
874 [TCA_ETS_PRIOMAP_BAND
] = { .type
= NETLINK_TYPE_U8
, },
877 static const NLTypeSystem rtnl_tca_option_data_ets_prio_type_system
= {
878 .count
= ELEMENTSOF(rtnl_tca_option_data_ets_prio_types
),
879 .types
= rtnl_tca_option_data_ets_prio_types
,
882 static const NLType rtnl_tca_option_data_ets_types
[] = {
883 [TCA_ETS_NBANDS
] = { .type
= NETLINK_TYPE_U8
},
884 [TCA_ETS_NSTRICT
] = { .type
= NETLINK_TYPE_U8
},
885 [TCA_ETS_QUANTA
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_option_data_ets_quanta_type_system
},
886 [TCA_ETS_PRIOMAP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_option_data_ets_prio_type_system
},
887 [TCA_ETS_QUANTA_BAND
] = { .type
= NETLINK_TYPE_U32
},
890 static const NLType rtnl_tca_option_data_fq_types
[] = {
891 [TCA_FQ_PLIMIT
] = { .type
= NETLINK_TYPE_U32
},
892 [TCA_FQ_FLOW_PLIMIT
] = { .type
= NETLINK_TYPE_U32
},
893 [TCA_FQ_QUANTUM
] = { .type
= NETLINK_TYPE_U32
},
894 [TCA_FQ_INITIAL_QUANTUM
] = { .type
= NETLINK_TYPE_U32
},
895 [TCA_FQ_RATE_ENABLE
] = { .type
= NETLINK_TYPE_U32
},
896 [TCA_FQ_FLOW_DEFAULT_RATE
] = { .type
= NETLINK_TYPE_U32
},
897 [TCA_FQ_FLOW_MAX_RATE
] = { .type
= NETLINK_TYPE_U32
},
898 [TCA_FQ_BUCKETS_LOG
] = { .type
= NETLINK_TYPE_U32
},
899 [TCA_FQ_FLOW_REFILL_DELAY
] = { .type
= NETLINK_TYPE_U32
},
900 [TCA_FQ_LOW_RATE_THRESHOLD
] = { .type
= NETLINK_TYPE_U32
},
901 [TCA_FQ_CE_THRESHOLD
] = { .type
= NETLINK_TYPE_U32
},
902 [TCA_FQ_ORPHAN_MASK
] = { .type
= NETLINK_TYPE_U32
},
905 static const NLType rtnl_tca_option_data_fq_codel_types
[] = {
906 [TCA_FQ_CODEL_TARGET
] = { .type
= NETLINK_TYPE_U32
},
907 [TCA_FQ_CODEL_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
908 [TCA_FQ_CODEL_INTERVAL
] = { .type
= NETLINK_TYPE_U32
},
909 [TCA_FQ_CODEL_ECN
] = { .type
= NETLINK_TYPE_U32
},
910 [TCA_FQ_CODEL_FLOWS
] = { .type
= NETLINK_TYPE_U32
},
911 [TCA_FQ_CODEL_QUANTUM
] = { .type
= NETLINK_TYPE_U32
},
912 [TCA_FQ_CODEL_CE_THRESHOLD
] = { .type
= NETLINK_TYPE_U32
},
913 [TCA_FQ_CODEL_DROP_BATCH_SIZE
] = { .type
= NETLINK_TYPE_U32
},
914 [TCA_FQ_CODEL_MEMORY_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
917 static const NLType rtnl_tca_option_data_fq_pie_types
[] = {
918 [TCA_FQ_PIE_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
921 static const NLType rtnl_tca_option_data_gred_types
[] = {
922 [TCA_GRED_DPS
] = { .size
= sizeof(struct tc_gred_sopt
) },
925 static const NLType rtnl_tca_option_data_hhf_types
[] = {
926 [TCA_HHF_BACKLOG_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
929 static const NLType rtnl_tca_option_data_htb_types
[] = {
930 [TCA_HTB_PARMS
] = { .size
= sizeof(struct tc_htb_opt
) },
931 [TCA_HTB_INIT
] = { .size
= sizeof(struct tc_htb_glob
) },
932 [TCA_HTB_CTAB
] = { .size
= TC_RTAB_SIZE
},
933 [TCA_HTB_RTAB
] = { .size
= TC_RTAB_SIZE
},
934 [TCA_HTB_RATE64
] = { .type
= NETLINK_TYPE_U64
},
935 [TCA_HTB_CEIL64
] = { .type
= NETLINK_TYPE_U64
},
938 static const NLType rtnl_tca_option_data_pie_types
[] = {
939 [TCA_PIE_LIMIT
] = { .type
= NETLINK_TYPE_U32
},
942 static const NLType rtnl_tca_option_data_qfq_types
[] = {
943 [TCA_QFQ_WEIGHT
] = { .type
= NETLINK_TYPE_U32
},
944 [TCA_QFQ_LMAX
] = { .type
= NETLINK_TYPE_U32
},
947 static const NLType rtnl_tca_option_data_sfb_types
[] = {
948 [TCA_SFB_PARMS
] = { .size
= sizeof(struct tc_sfb_qopt
) },
951 static const NLType rtnl_tca_option_data_tbf_types
[] = {
952 [TCA_TBF_PARMS
] = { .size
= sizeof(struct tc_tbf_qopt
) },
953 [TCA_TBF_RTAB
] = { .size
= TC_RTAB_SIZE
},
954 [TCA_TBF_PTAB
] = { .size
= TC_RTAB_SIZE
},
955 [TCA_TBF_RATE64
] = { .type
= NETLINK_TYPE_U64
},
956 [TCA_TBF_PRATE64
] = { .type
= NETLINK_TYPE_U64
},
957 [TCA_TBF_BURST
] = { .type
= NETLINK_TYPE_U32
},
958 [TCA_TBF_PBURST
] = { .type
= NETLINK_TYPE_U32
},
961 static const char* const nl_union_tca_option_data_table
[] = {
962 [NL_UNION_TCA_OPTION_DATA_CAKE
] = "cake",
963 [NL_UNION_TCA_OPTION_DATA_CODEL
] = "codel",
964 [NL_UNION_TCA_OPTION_DATA_DRR
] = "drr",
965 [NL_UNION_TCA_OPTION_DATA_ETS
] = "ets",
966 [NL_UNION_TCA_OPTION_DATA_FQ
] = "fq",
967 [NL_UNION_TCA_OPTION_DATA_FQ_CODEL
] = "fq_codel",
968 [NL_UNION_TCA_OPTION_DATA_FQ_PIE
] = "fq_pie",
969 [NL_UNION_TCA_OPTION_DATA_GRED
] = "gred",
970 [NL_UNION_TCA_OPTION_DATA_HHF
] = "hhf",
971 [NL_UNION_TCA_OPTION_DATA_HTB
] = "htb",
972 [NL_UNION_TCA_OPTION_DATA_PIE
] = "pie",
973 [NL_UNION_TCA_OPTION_DATA_QFQ
] = "qfq",
974 [NL_UNION_TCA_OPTION_DATA_SFB
] = "sfb",
975 [NL_UNION_TCA_OPTION_DATA_TBF
] = "tbf",
978 DEFINE_STRING_TABLE_LOOKUP(nl_union_tca_option_data
, NLUnionTCAOptionData
);
980 static const NLTypeSystem rtnl_tca_option_data_type_systems
[] = {
981 [NL_UNION_TCA_OPTION_DATA_CAKE
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_cake_types
),
982 .types
= rtnl_tca_option_data_cake_types
},
983 [NL_UNION_TCA_OPTION_DATA_CODEL
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_codel_types
),
984 .types
= rtnl_tca_option_data_codel_types
},
985 [NL_UNION_TCA_OPTION_DATA_DRR
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_drr_types
),
986 .types
= rtnl_tca_option_data_drr_types
},
987 [NL_UNION_TCA_OPTION_DATA_ETS
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_ets_types
),
988 .types
= rtnl_tca_option_data_ets_types
},
989 [NL_UNION_TCA_OPTION_DATA_FQ
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_fq_types
),
990 .types
= rtnl_tca_option_data_fq_types
},
991 [NL_UNION_TCA_OPTION_DATA_FQ_CODEL
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_fq_codel_types
),
992 .types
= rtnl_tca_option_data_fq_codel_types
},
993 [NL_UNION_TCA_OPTION_DATA_FQ_PIE
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_fq_pie_types
),
994 .types
= rtnl_tca_option_data_fq_pie_types
},
995 [NL_UNION_TCA_OPTION_DATA_GRED
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_gred_types
),
996 .types
= rtnl_tca_option_data_gred_types
},
997 [NL_UNION_TCA_OPTION_DATA_HHF
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_hhf_types
),
998 .types
= rtnl_tca_option_data_hhf_types
},
999 [NL_UNION_TCA_OPTION_DATA_HTB
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_htb_types
),
1000 .types
= rtnl_tca_option_data_htb_types
},
1001 [NL_UNION_TCA_OPTION_DATA_PIE
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_pie_types
),
1002 .types
= rtnl_tca_option_data_pie_types
},
1003 [NL_UNION_TCA_OPTION_DATA_QFQ
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_qfq_types
),
1004 .types
= rtnl_tca_option_data_qfq_types
},
1005 [NL_UNION_TCA_OPTION_DATA_SFB
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_sfb_types
),
1006 .types
= rtnl_tca_option_data_sfb_types
},
1007 [NL_UNION_TCA_OPTION_DATA_TBF
] = { .count
= ELEMENTSOF(rtnl_tca_option_data_tbf_types
),
1008 .types
= rtnl_tca_option_data_tbf_types
},
1011 static const NLTypeSystemUnion rtnl_tca_option_data_type_system_union
= {
1012 .num
= _NL_UNION_TCA_OPTION_DATA_MAX
,
1013 .lookup
= nl_union_tca_option_data_from_string
,
1014 .type_systems
= rtnl_tca_option_data_type_systems
,
1015 .match_type
= NL_MATCH_SIBLING
,
1019 static const NLType rtnl_tca_types
[] = {
1020 [TCA_KIND
] = { .type
= NETLINK_TYPE_STRING
},
1021 [TCA_OPTIONS
] = { .type
= NETLINK_TYPE_UNION
, .type_system_union
= &rtnl_tca_option_data_type_system_union
},
1022 [TCA_INGRESS_BLOCK
] = { .type
= NETLINK_TYPE_U32
},
1023 [TCA_EGRESS_BLOCK
] = { .type
= NETLINK_TYPE_U32
},
1026 static const NLTypeSystem rtnl_tca_type_system
= {
1027 .count
= ELEMENTSOF(rtnl_tca_types
),
1028 .types
= rtnl_tca_types
,
1031 static const NLType mdb_types
[] = {
1032 [MDBA_SET_ENTRY
] = { .size
= sizeof(struct br_port_msg
) },
1035 static const NLTypeSystem rtnl_mdb_type_system
= {
1036 .count
= ELEMENTSOF(mdb_types
),
1040 static const NLType error_types
[] = {
1041 [NLMSGERR_ATTR_MSG
] = { .type
= NETLINK_TYPE_STRING
},
1042 [NLMSGERR_ATTR_OFFS
] = { .type
= NETLINK_TYPE_U32
},
1045 static const NLTypeSystem error_type_system
= {
1046 .count
= ELEMENTSOF(error_types
),
1047 .types
= error_types
,
1050 static const NLType rtnl_types
[] = {
1051 [NLMSG_DONE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &empty_type_system
, .size
= 0 },
1052 [NLMSG_ERROR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &error_type_system
, .size
= sizeof(struct nlmsgerr
) },
1053 [RTM_NEWLINK
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1054 [RTM_DELLINK
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1055 [RTM_GETLINK
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1056 [RTM_SETLINK
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1057 [RTM_NEWLINKPROP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1058 [RTM_DELLINKPROP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1059 [RTM_GETLINKPROP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_link_type_system
, .size
= sizeof(struct ifinfomsg
) },
1060 [RTM_NEWADDR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_address_type_system
, .size
= sizeof(struct ifaddrmsg
) },
1061 [RTM_DELADDR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_address_type_system
, .size
= sizeof(struct ifaddrmsg
) },
1062 [RTM_GETADDR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_address_type_system
, .size
= sizeof(struct ifaddrmsg
) },
1063 [RTM_NEWROUTE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_route_type_system
, .size
= sizeof(struct rtmsg
) },
1064 [RTM_DELROUTE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_route_type_system
, .size
= sizeof(struct rtmsg
) },
1065 [RTM_GETROUTE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_route_type_system
, .size
= sizeof(struct rtmsg
) },
1066 [RTM_NEWNEIGH
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_neigh_type_system
, .size
= sizeof(struct ndmsg
) },
1067 [RTM_DELNEIGH
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_neigh_type_system
, .size
= sizeof(struct ndmsg
) },
1068 [RTM_GETNEIGH
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_neigh_type_system
, .size
= sizeof(struct ndmsg
) },
1069 [RTM_NEWADDRLABEL
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_addrlabel_type_system
, .size
= sizeof(struct ifaddrlblmsg
) },
1070 [RTM_DELADDRLABEL
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_addrlabel_type_system
, .size
= sizeof(struct ifaddrlblmsg
) },
1071 [RTM_GETADDRLABEL
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_addrlabel_type_system
, .size
= sizeof(struct ifaddrlblmsg
) },
1072 [RTM_NEWRULE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_routing_policy_rule_type_system
, .size
= sizeof(struct fib_rule_hdr
) },
1073 [RTM_DELRULE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_routing_policy_rule_type_system
, .size
= sizeof(struct fib_rule_hdr
) },
1074 [RTM_GETRULE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_routing_policy_rule_type_system
, .size
= sizeof(struct fib_rule_hdr
) },
1075 [RTM_NEWNEXTHOP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_nexthop_type_system
, .size
= sizeof(struct nhmsg
) },
1076 [RTM_DELNEXTHOP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_nexthop_type_system
, .size
= sizeof(struct nhmsg
) },
1077 [RTM_GETNEXTHOP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_nexthop_type_system
, .size
= sizeof(struct nhmsg
) },
1078 [RTM_NEWQDISC
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_type_system
, .size
= sizeof(struct tcmsg
) },
1079 [RTM_DELQDISC
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_type_system
, .size
= sizeof(struct tcmsg
) },
1080 [RTM_GETQDISC
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_type_system
, .size
= sizeof(struct tcmsg
) },
1081 [RTM_NEWTCLASS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_type_system
, .size
= sizeof(struct tcmsg
) },
1082 [RTM_DELTCLASS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_type_system
, .size
= sizeof(struct tcmsg
) },
1083 [RTM_GETTCLASS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_tca_type_system
, .size
= sizeof(struct tcmsg
) },
1084 [RTM_NEWMDB
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_mdb_type_system
, .size
= sizeof(struct br_port_msg
) },
1085 [RTM_DELMDB
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_mdb_type_system
, .size
= sizeof(struct br_port_msg
) },
1086 [RTM_GETMDB
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &rtnl_mdb_type_system
, .size
= sizeof(struct br_port_msg
) },
1089 const NLTypeSystem rtnl_type_system_root
= {
1090 .count
= ELEMENTSOF(rtnl_types
),
1091 .types
= rtnl_types
,
1094 static const NLType genl_wireguard_allowedip_types
[] = {
1095 [WGALLOWEDIP_A_FAMILY
] = { .type
= NETLINK_TYPE_U16
},
1096 [WGALLOWEDIP_A_IPADDR
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1097 [WGALLOWEDIP_A_CIDR_MASK
] = { .type
= NETLINK_TYPE_U8
},
1100 static const NLTypeSystem genl_wireguard_allowedip_type_system
= {
1101 .count
= ELEMENTSOF(genl_wireguard_allowedip_types
),
1102 .types
= genl_wireguard_allowedip_types
,
1105 static const NLType genl_wireguard_peer_types
[] = {
1106 [WGPEER_A_PUBLIC_KEY
] = { .size
= WG_KEY_LEN
},
1107 [WGPEER_A_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1108 [WGPEER_A_PRESHARED_KEY
] = { .size
= WG_KEY_LEN
},
1109 [WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL
] = { .type
= NETLINK_TYPE_U16
},
1110 [WGPEER_A_ENDPOINT
] = { .type
= NETLINK_TYPE_SOCKADDR
},
1111 [WGPEER_A_ALLOWEDIPS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_wireguard_allowedip_type_system
},
1114 static const NLTypeSystem genl_wireguard_peer_type_system
= {
1115 .count
= ELEMENTSOF(genl_wireguard_peer_types
),
1116 .types
= genl_wireguard_peer_types
,
1119 static const NLType genl_wireguard_set_device_types
[] = {
1120 [WGDEVICE_A_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1121 [WGDEVICE_A_IFNAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFNAMSIZ
-1 },
1122 [WGDEVICE_A_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1123 [WGDEVICE_A_PRIVATE_KEY
] = { .size
= WG_KEY_LEN
},
1124 [WGDEVICE_A_LISTEN_PORT
] = { .type
= NETLINK_TYPE_U16
},
1125 [WGDEVICE_A_FWMARK
] = { .type
= NETLINK_TYPE_U32
},
1126 [WGDEVICE_A_PEERS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_wireguard_peer_type_system
},
1129 static const NLTypeSystem genl_wireguard_set_device_type_system
= {
1130 .count
= ELEMENTSOF(genl_wireguard_set_device_types
),
1131 .types
= genl_wireguard_set_device_types
,
1134 static const NLType genl_wireguard_cmds
[] = {
1135 [WG_CMD_SET_DEVICE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_wireguard_set_device_type_system
},
1138 static const NLTypeSystem genl_wireguard_type_system
= {
1139 .count
= ELEMENTSOF(genl_wireguard_cmds
),
1140 .types
= genl_wireguard_cmds
,
1143 static const NLType genl_mcast_group_types
[] = {
1144 [CTRL_ATTR_MCAST_GRP_NAME
] = { .type
= NETLINK_TYPE_STRING
},
1145 [CTRL_ATTR_MCAST_GRP_ID
] = { .type
= NETLINK_TYPE_U32
},
1148 static const NLTypeSystem genl_mcast_group_type_system
= {
1149 .count
= ELEMENTSOF(genl_mcast_group_types
),
1150 .types
= genl_mcast_group_types
,
1153 static const NLType genl_get_family_types
[] = {
1154 [CTRL_ATTR_FAMILY_NAME
] = { .type
= NETLINK_TYPE_STRING
},
1155 [CTRL_ATTR_FAMILY_ID
] = { .type
= NETLINK_TYPE_U16
},
1156 [CTRL_ATTR_MCAST_GROUPS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_mcast_group_type_system
},
1159 static const NLTypeSystem genl_get_family_type_system
= {
1160 .count
= ELEMENTSOF(genl_get_family_types
),
1161 .types
= genl_get_family_types
,
1164 static const NLType genl_ctrl_id_ctrl_cmds
[] = {
1165 [CTRL_CMD_GETFAMILY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_get_family_type_system
},
1168 static const NLTypeSystem genl_ctrl_id_ctrl_type_system
= {
1169 .count
= ELEMENTSOF(genl_ctrl_id_ctrl_cmds
),
1170 .types
= genl_ctrl_id_ctrl_cmds
,
1173 static const NLType genl_fou_types
[] = {
1174 [FOU_ATTR_PORT
] = { .type
= NETLINK_TYPE_U16
},
1175 [FOU_ATTR_AF
] = { .type
= NETLINK_TYPE_U8
},
1176 [FOU_ATTR_IPPROTO
] = { .type
= NETLINK_TYPE_U8
},
1177 [FOU_ATTR_TYPE
] = { .type
= NETLINK_TYPE_U8
},
1178 [FOU_ATTR_REMCSUM_NOPARTIAL
] = { .type
= NETLINK_TYPE_FLAG
},
1179 [FOU_ATTR_LOCAL_V4
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1180 [FOU_ATTR_PEER_V4
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1181 [FOU_ATTR_LOCAL_V6
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1182 [FOU_ATTR_PEER_V6
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1183 [FOU_ATTR_PEER_PORT
] = { .type
= NETLINK_TYPE_U16
},
1184 [FOU_ATTR_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1187 static const NLTypeSystem genl_fou_type_system
= {
1188 .count
= ELEMENTSOF(genl_fou_types
),
1189 .types
= genl_fou_types
,
1192 static const NLType genl_fou_cmds
[] = {
1193 [FOU_CMD_ADD
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_fou_type_system
},
1194 [FOU_CMD_DEL
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_fou_type_system
},
1195 [FOU_CMD_GET
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_fou_type_system
},
1198 static const NLTypeSystem genl_fou_cmds_type_system
= {
1199 .count
= ELEMENTSOF(genl_fou_cmds
),
1200 .types
= genl_fou_cmds
,
1203 static const NLType genl_l2tp_types
[] = {
1204 [L2TP_ATTR_PW_TYPE
] = { .type
= NETLINK_TYPE_U16
},
1205 [L2TP_ATTR_ENCAP_TYPE
] = { .type
= NETLINK_TYPE_U16
},
1206 [L2TP_ATTR_OFFSET
] = { .type
= NETLINK_TYPE_U16
},
1207 [L2TP_ATTR_DATA_SEQ
] = { .type
= NETLINK_TYPE_U16
},
1208 [L2TP_ATTR_L2SPEC_TYPE
] = { .type
= NETLINK_TYPE_U8
},
1209 [L2TP_ATTR_L2SPEC_LEN
] = { .type
= NETLINK_TYPE_U8
},
1210 [L2TP_ATTR_PROTO_VERSION
] = { .type
= NETLINK_TYPE_U8
},
1211 [L2TP_ATTR_IFNAME
] = { .type
= NETLINK_TYPE_STRING
},
1212 [L2TP_ATTR_CONN_ID
] = { .type
= NETLINK_TYPE_U32
},
1213 [L2TP_ATTR_PEER_CONN_ID
] = { .type
= NETLINK_TYPE_U32
},
1214 [L2TP_ATTR_SESSION_ID
] = { .type
= NETLINK_TYPE_U32
},
1215 [L2TP_ATTR_PEER_SESSION_ID
] = { .type
= NETLINK_TYPE_U32
},
1216 [L2TP_ATTR_UDP_CSUM
] = { .type
= NETLINK_TYPE_U8
},
1217 [L2TP_ATTR_VLAN_ID
] = { .type
= NETLINK_TYPE_U16
},
1218 [L2TP_ATTR_RECV_SEQ
] = { .type
= NETLINK_TYPE_U8
},
1219 [L2TP_ATTR_SEND_SEQ
] = { .type
= NETLINK_TYPE_U8
},
1220 [L2TP_ATTR_LNS_MODE
] = { .type
= NETLINK_TYPE_U8
},
1221 [L2TP_ATTR_USING_IPSEC
] = { .type
= NETLINK_TYPE_U8
},
1222 [L2TP_ATTR_FD
] = { .type
= NETLINK_TYPE_U32
},
1223 [L2TP_ATTR_IP_SADDR
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1224 [L2TP_ATTR_IP_DADDR
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1225 [L2TP_ATTR_UDP_SPORT
] = { .type
= NETLINK_TYPE_U16
},
1226 [L2TP_ATTR_UDP_DPORT
] = { .type
= NETLINK_TYPE_U16
},
1227 [L2TP_ATTR_IP6_SADDR
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1228 [L2TP_ATTR_IP6_DADDR
] = { .type
= NETLINK_TYPE_IN_ADDR
},
1229 [L2TP_ATTR_UDP_ZERO_CSUM6_TX
] = { .type
= NETLINK_TYPE_FLAG
},
1230 [L2TP_ATTR_UDP_ZERO_CSUM6_RX
] = { .type
= NETLINK_TYPE_FLAG
},
1233 static const NLTypeSystem genl_l2tp_type_system
= {
1234 .count
= ELEMENTSOF(genl_l2tp_types
),
1235 .types
= genl_l2tp_types
,
1238 static const NLType genl_l2tp
[] = {
1239 [L2TP_CMD_TUNNEL_CREATE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1240 [L2TP_CMD_TUNNEL_DELETE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1241 [L2TP_CMD_TUNNEL_MODIFY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1242 [L2TP_CMD_TUNNEL_GET
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1243 [L2TP_CMD_SESSION_CREATE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1244 [L2TP_CMD_SESSION_DELETE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1245 [L2TP_CMD_SESSION_MODIFY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1246 [L2TP_CMD_SESSION_GET
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_type_system
},
1249 static const NLTypeSystem genl_l2tp_tunnel_session_type_system
= {
1250 .count
= ELEMENTSOF(genl_l2tp
),
1254 static const NLType genl_rxsc_types
[] = {
1255 [MACSEC_RXSC_ATTR_SCI
] = { .type
= NETLINK_TYPE_U64
},
1258 static const NLTypeSystem genl_rxsc_config_type_system
= {
1259 .count
= ELEMENTSOF(genl_rxsc_types
),
1260 .types
= genl_rxsc_types
,
1263 static const NLType genl_macsec_rxsc_types
[] = {
1264 [MACSEC_ATTR_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1265 [MACSEC_ATTR_RXSC_CONFIG
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_rxsc_config_type_system
},
1268 static const NLTypeSystem genl_macsec_rxsc_type_system
= {
1269 .count
= ELEMENTSOF(genl_macsec_rxsc_types
),
1270 .types
= genl_macsec_rxsc_types
,
1273 static const NLType genl_macsec_sa_config_types
[] = {
1274 [MACSEC_SA_ATTR_AN
] = { .type
= NETLINK_TYPE_U8
},
1275 [MACSEC_SA_ATTR_ACTIVE
] = { .type
= NETLINK_TYPE_U8
},
1276 [MACSEC_SA_ATTR_PN
] = { .type
= NETLINK_TYPE_U32
},
1277 [MACSEC_SA_ATTR_KEYID
] = { .size
= MACSEC_KEYID_LEN
},
1278 [MACSEC_SA_ATTR_KEY
] = { .size
= MACSEC_MAX_KEY_LEN
},
1281 static const NLTypeSystem genl_macsec_sa_config_type_system
= {
1282 .count
= ELEMENTSOF(genl_macsec_sa_config_types
),
1283 .types
= genl_macsec_sa_config_types
,
1286 static const NLType genl_macsec_rxsa_types
[] = {
1287 [MACSEC_ATTR_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1288 [MACSEC_ATTR_SA_CONFIG
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_macsec_sa_config_type_system
},
1291 static const NLTypeSystem genl_macsec_rxsa_type_system
= {
1292 .count
= ELEMENTSOF(genl_macsec_rxsa_types
),
1293 .types
= genl_macsec_rxsa_types
,
1296 static const NLType genl_macsec_sa_types
[] = {
1297 [MACSEC_ATTR_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1298 [MACSEC_ATTR_RXSC_CONFIG
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_rxsc_config_type_system
},
1299 [MACSEC_ATTR_SA_CONFIG
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_macsec_sa_config_type_system
},
1302 static const NLTypeSystem genl_macsec_sa_type_system
= {
1303 .count
= ELEMENTSOF(genl_macsec_sa_types
),
1304 .types
= genl_macsec_sa_types
,
1307 static const NLType genl_macsec
[] = {
1308 [MACSEC_CMD_ADD_RXSC
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_macsec_rxsc_type_system
},
1309 [MACSEC_CMD_ADD_TXSA
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_macsec_rxsa_type_system
},
1310 [MACSEC_CMD_ADD_RXSA
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_macsec_sa_type_system
},
1313 static const NLTypeSystem genl_macsec_device_type_system
= {
1314 .count
= ELEMENTSOF(genl_macsec
),
1315 .types
= genl_macsec
,
1318 static const NLType genl_nl80211_types
[] = {
1319 [NL80211_ATTR_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1320 [NL80211_ATTR_MAC
] = { .type
= NETLINK_TYPE_ETHER_ADDR
},
1321 [NL80211_ATTR_SSID
] = { .type
= NETLINK_TYPE_STRING
},
1322 [NL80211_ATTR_IFTYPE
] = { .type
= NETLINK_TYPE_U32
},
1325 static const NLTypeSystem genl_nl80211_type_system
= {
1326 .count
= ELEMENTSOF(genl_nl80211_types
),
1327 .types
= genl_nl80211_types
,
1330 static const NLType genl_nl80211_cmds
[] = {
1331 [NL80211_CMD_GET_WIPHY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1332 [NL80211_CMD_SET_WIPHY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1333 [NL80211_CMD_NEW_WIPHY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1334 [NL80211_CMD_DEL_WIPHY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1335 [NL80211_CMD_GET_INTERFACE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1336 [NL80211_CMD_SET_INTERFACE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1337 [NL80211_CMD_NEW_INTERFACE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1338 [NL80211_CMD_DEL_INTERFACE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1339 [NL80211_CMD_GET_STATION
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1340 [NL80211_CMD_SET_STATION
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1341 [NL80211_CMD_NEW_STATION
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1342 [NL80211_CMD_DEL_STATION
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
},
1345 static const NLTypeSystem genl_nl80211_cmds_type_system
= {
1346 .count
= ELEMENTSOF(genl_nl80211_cmds
),
1347 .types
= genl_nl80211_cmds
,
1350 static const NLType genl_batadv_types
[] = {
1351 [BATADV_ATTR_VERSION
] = { .type
= NETLINK_TYPE_STRING
},
1352 [BATADV_ATTR_ALGO_NAME
] = { .type
= NETLINK_TYPE_STRING
},
1353 [BATADV_ATTR_MESH_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1354 [BATADV_ATTR_MESH_IFNAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFNAMSIZ
},
1355 [BATADV_ATTR_MESH_ADDRESS
] = { .size
= ETH_ALEN
},
1356 [BATADV_ATTR_HARD_IFINDEX
] = { .type
= NETLINK_TYPE_U32
},
1357 [BATADV_ATTR_HARD_IFNAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFNAMSIZ
},
1358 [BATADV_ATTR_HARD_ADDRESS
] = { .size
= ETH_ALEN
},
1359 [BATADV_ATTR_ORIG_ADDRESS
] = { .size
= ETH_ALEN
},
1360 [BATADV_ATTR_TPMETER_RESULT
] = { .type
= NETLINK_TYPE_U8
},
1361 [BATADV_ATTR_TPMETER_TEST_TIME
] = { .type
= NETLINK_TYPE_U32
},
1362 [BATADV_ATTR_TPMETER_BYTES
] = { .type
= NETLINK_TYPE_U64
},
1363 [BATADV_ATTR_TPMETER_COOKIE
] = { .type
= NETLINK_TYPE_U32
},
1364 [BATADV_ATTR_PAD
] = { .type
= NETLINK_TYPE_UNSPEC
},
1365 [BATADV_ATTR_ACTIVE
] = { .type
= NETLINK_TYPE_FLAG
},
1366 [BATADV_ATTR_TT_ADDRESS
] = { .size
= ETH_ALEN
},
1367 [BATADV_ATTR_TT_TTVN
] = { .type
= NETLINK_TYPE_U8
},
1368 [BATADV_ATTR_TT_LAST_TTVN
] = { .type
= NETLINK_TYPE_U8
},
1369 [BATADV_ATTR_TT_CRC32
] = { .type
= NETLINK_TYPE_U32
},
1370 [BATADV_ATTR_TT_VID
] = { .type
= NETLINK_TYPE_U16
},
1371 [BATADV_ATTR_TT_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1372 [BATADV_ATTR_FLAG_BEST
] = { .type
= NETLINK_TYPE_FLAG
},
1373 [BATADV_ATTR_LAST_SEEN_MSECS
] = { .type
= NETLINK_TYPE_U32
},
1374 [BATADV_ATTR_NEIGH_ADDRESS
] = { .size
= ETH_ALEN
},
1375 [BATADV_ATTR_TQ
] = { .type
= NETLINK_TYPE_U8
},
1376 [BATADV_ATTR_THROUGHPUT
] = { .type
= NETLINK_TYPE_U32
},
1377 [BATADV_ATTR_BANDWIDTH_UP
] = { .type
= NETLINK_TYPE_U32
},
1378 [BATADV_ATTR_BANDWIDTH_DOWN
] = { .type
= NETLINK_TYPE_U32
},
1379 [BATADV_ATTR_ROUTER
] = { .size
= ETH_ALEN
},
1380 [BATADV_ATTR_BLA_OWN
] = { .type
= NETLINK_TYPE_FLAG
},
1381 [BATADV_ATTR_BLA_ADDRESS
] = { .size
= ETH_ALEN
},
1382 [BATADV_ATTR_BLA_VID
] = { .type
= NETLINK_TYPE_U16
},
1383 [BATADV_ATTR_BLA_BACKBONE
] = { .size
= ETH_ALEN
},
1384 [BATADV_ATTR_BLA_CRC
] = { .type
= NETLINK_TYPE_U16
},
1385 [BATADV_ATTR_DAT_CACHE_IP4ADDRESS
] = { .type
= NETLINK_TYPE_U32
},
1386 [BATADV_ATTR_DAT_CACHE_HWADDRESS
] = { .size
= ETH_ALEN
},
1387 [BATADV_ATTR_DAT_CACHE_VID
] = { .type
= NETLINK_TYPE_U16
},
1388 [BATADV_ATTR_MCAST_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1389 [BATADV_ATTR_MCAST_FLAGS_PRIV
] = { .type
= NETLINK_TYPE_U32
},
1390 [BATADV_ATTR_VLANID
] = { .type
= NETLINK_TYPE_U16
},
1391 [BATADV_ATTR_AGGREGATED_OGMS_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1392 [BATADV_ATTR_AP_ISOLATION_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1393 [BATADV_ATTR_ISOLATION_MARK
] = { .type
= NETLINK_TYPE_U32
},
1394 [BATADV_ATTR_ISOLATION_MASK
] = { .type
= NETLINK_TYPE_U32
},
1395 [BATADV_ATTR_BONDING_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1396 [BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1397 [BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1398 [BATADV_ATTR_FRAGMENTATION_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1399 [BATADV_ATTR_GW_BANDWIDTH_DOWN
] = { .type
= NETLINK_TYPE_U32
},
1400 [BATADV_ATTR_GW_BANDWIDTH_UP
] = { .type
= NETLINK_TYPE_U32
},
1401 [BATADV_ATTR_GW_MODE
] = { .type
= NETLINK_TYPE_U8
},
1402 [BATADV_ATTR_GW_SEL_CLASS
] = { .type
= NETLINK_TYPE_U32
},
1403 [BATADV_ATTR_HOP_PENALTY
] = { .type
= NETLINK_TYPE_U8
},
1404 [BATADV_ATTR_LOG_LEVEL
] = { .type
= NETLINK_TYPE_U32
},
1405 [BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1406 [BATADV_ATTR_MULTICAST_FANOUT
] = { .type
= NETLINK_TYPE_U32
},
1407 [BATADV_ATTR_NETWORK_CODING_ENABLED
] = { .type
= NETLINK_TYPE_U8
},
1408 [BATADV_ATTR_ORIG_INTERVAL
] = { .type
= NETLINK_TYPE_U32
},
1409 [BATADV_ATTR_ELP_INTERVAL
] = { .type
= NETLINK_TYPE_U32
},
1410 [BATADV_ATTR_THROUGHPUT_OVERRIDE
] = { .type
= NETLINK_TYPE_U32
},
1413 static const NLTypeSystem genl_batadv_type_system
= {
1414 .count
= ELEMENTSOF(genl_batadv_types
),
1415 .types
= genl_batadv_types
,
1418 static const NLType genl_batadv_cmds
[] = {
1419 [BATADV_CMD_SET_MESH
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_batadv_type_system
},
1422 static const NLTypeSystem genl_batadv_cmds_type_system
= {
1423 .count
= ELEMENTSOF(genl_batadv_cmds
),
1424 .types
= genl_batadv_cmds
,
1427 static const NLType genl_families
[] = {
1428 [SD_GENL_ID_CTRL
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_ctrl_id_ctrl_type_system
},
1429 [SD_GENL_WIREGUARD
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_wireguard_type_system
},
1430 [SD_GENL_FOU
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_fou_cmds_type_system
},
1431 [SD_GENL_L2TP
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_l2tp_tunnel_session_type_system
},
1432 [SD_GENL_MACSEC
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_macsec_device_type_system
},
1433 [SD_GENL_NL80211
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_cmds_type_system
},
1434 [SD_GENL_BATADV
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_batadv_cmds_type_system
},
1437 static const NLType nfnl_nft_table_types
[] = {
1438 [NFTA_TABLE_NAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1439 [NFTA_TABLE_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1442 static const NLTypeSystem nfnl_nft_table_type_system
= {
1443 .count
= ELEMENTSOF(nfnl_nft_table_types
),
1444 .types
= nfnl_nft_table_types
,
1447 static const NLType nfnl_nft_chain_hook_types
[] = {
1448 [NFTA_HOOK_HOOKNUM
] = { .type
= NETLINK_TYPE_U32
},
1449 [NFTA_HOOK_PRIORITY
] = { .type
= NETLINK_TYPE_U32
},
1450 [NFTA_HOOK_DEV
] = { .type
= NETLINK_TYPE_STRING
, .size
= IFNAMSIZ
- 1 },
1453 static const NLTypeSystem nfnl_nft_chain_hook_type_system
= {
1454 .count
= ELEMENTSOF(nfnl_nft_chain_hook_types
),
1455 .types
= nfnl_nft_chain_hook_types
,
1458 static const NLType nfnl_nft_chain_types
[] = {
1459 [NFTA_CHAIN_TABLE
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1460 [NFTA_CHAIN_NAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1461 [NFTA_CHAIN_HOOK
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_chain_hook_type_system
},
1462 [NFTA_CHAIN_TYPE
] = { .type
= NETLINK_TYPE_STRING
, .size
= 16 },
1463 [NFTA_CHAIN_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1466 static const NLTypeSystem nfnl_nft_chain_type_system
= {
1467 .count
= ELEMENTSOF(nfnl_nft_chain_types
),
1468 .types
= nfnl_nft_chain_types
,
1471 static const NLType nfnl_nft_expr_meta_types
[] = {
1472 [NFTA_META_DREG
] = { .type
= NETLINK_TYPE_U32
},
1473 [NFTA_META_KEY
] = { .type
= NETLINK_TYPE_U32
},
1474 [NFTA_META_SREG
] = { .type
= NETLINK_TYPE_U32
},
1477 static const NLType nfnl_nft_expr_payload_types
[] = {
1478 [NFTA_PAYLOAD_DREG
] = { .type
= NETLINK_TYPE_U32
},
1479 [NFTA_PAYLOAD_BASE
] = { .type
= NETLINK_TYPE_U32
},
1480 [NFTA_PAYLOAD_OFFSET
] = { .type
= NETLINK_TYPE_U32
},
1481 [NFTA_PAYLOAD_LEN
] = { .type
= NETLINK_TYPE_U32
},
1484 static const NLType nfnl_nft_expr_nat_types
[] = {
1485 [NFTA_NAT_TYPE
] = { .type
= NETLINK_TYPE_U32
},
1486 [NFTA_NAT_FAMILY
] = { .type
= NETLINK_TYPE_U32
},
1487 [NFTA_NAT_REG_ADDR_MIN
] = { .type
= NETLINK_TYPE_U32
},
1488 [NFTA_NAT_REG_ADDR_MAX
] = { .type
= NETLINK_TYPE_U32
},
1489 [NFTA_NAT_REG_PROTO_MIN
] = { .type
= NETLINK_TYPE_U32
},
1490 [NFTA_NAT_REG_PROTO_MAX
] = { .type
= NETLINK_TYPE_U32
},
1491 [NFTA_NAT_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1494 static const NLType nfnl_nft_data_types
[] = {
1495 [NFTA_DATA_VALUE
] = { .type
= NETLINK_TYPE_BINARY
},
1498 static const NLTypeSystem nfnl_nft_data_type_system
= {
1499 .count
= ELEMENTSOF(nfnl_nft_data_types
),
1500 .types
= nfnl_nft_data_types
,
1503 static const NLType nfnl_nft_expr_bitwise_types
[] = {
1504 [NFTA_BITWISE_SREG
] = { .type
= NETLINK_TYPE_U32
},
1505 [NFTA_BITWISE_DREG
] = { .type
= NETLINK_TYPE_U32
},
1506 [NFTA_BITWISE_LEN
] = { .type
= NETLINK_TYPE_U32
},
1507 [NFTA_BITWISE_MASK
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_data_type_system
},
1508 [NFTA_BITWISE_XOR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_data_type_system
},
1511 static const NLType nfnl_nft_expr_cmp_types
[] = {
1512 [NFTA_CMP_SREG
] = { .type
= NETLINK_TYPE_U32
},
1513 [NFTA_CMP_OP
] = { .type
= NETLINK_TYPE_U32
},
1514 [NFTA_CMP_DATA
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_data_type_system
},
1517 static const NLType nfnl_nft_expr_fib_types
[] = {
1518 [NFTA_FIB_DREG
] = { .type
= NETLINK_TYPE_U32
},
1519 [NFTA_FIB_RESULT
] = { .type
= NETLINK_TYPE_U32
},
1520 [NFTA_FIB_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1523 static const NLType nfnl_nft_expr_lookup_types
[] = {
1524 [NFTA_LOOKUP_SET
] = { .type
= NETLINK_TYPE_STRING
},
1525 [NFTA_LOOKUP_SREG
] = { .type
= NETLINK_TYPE_U32
},
1526 [NFTA_LOOKUP_DREG
] = { .type
= NETLINK_TYPE_U32
},
1527 [NFTA_LOOKUP_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1530 static const NLType nfnl_nft_expr_masq_types
[] = {
1531 [NFTA_MASQ_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1532 [NFTA_MASQ_REG_PROTO_MIN
] = { .type
= NETLINK_TYPE_U32
},
1533 [NFTA_MASQ_REG_PROTO_MAX
] = { .type
= NETLINK_TYPE_U32
},
1536 static const NLTypeSystem nfnl_expr_data_type_systems
[] = {
1537 [NL_UNION_NFT_EXPR_DATA_BITWISE
] = { .count
= ELEMENTSOF(nfnl_nft_expr_bitwise_types
),
1538 .types
= nfnl_nft_expr_bitwise_types
},
1539 [NL_UNION_NFT_EXPR_DATA_CMP
] = { .count
= ELEMENTSOF(nfnl_nft_expr_cmp_types
),
1540 .types
= nfnl_nft_expr_cmp_types
},
1541 [NL_UNION_NFT_EXPR_DATA_FIB
] = { .count
= ELEMENTSOF(nfnl_nft_expr_fib_types
),
1542 .types
= nfnl_nft_expr_fib_types
},
1543 [NL_UNION_NFT_EXPR_DATA_LOOKUP
] = { .count
= ELEMENTSOF(nfnl_nft_expr_lookup_types
),
1544 .types
= nfnl_nft_expr_lookup_types
},
1545 [NL_UNION_NFT_EXPR_DATA_MASQ
] = { .count
= ELEMENTSOF(nfnl_nft_expr_masq_types
),
1546 .types
= nfnl_nft_expr_masq_types
},
1547 [NL_UNION_NFT_EXPR_DATA_META
] = { .count
= ELEMENTSOF(nfnl_nft_expr_meta_types
),
1548 .types
= nfnl_nft_expr_meta_types
},
1549 [NL_UNION_NFT_EXPR_DATA_NAT
] = { .count
= ELEMENTSOF(nfnl_nft_expr_nat_types
),
1550 .types
= nfnl_nft_expr_nat_types
},
1551 [NL_UNION_NFT_EXPR_DATA_PAYLOAD
] = { .count
= ELEMENTSOF(nfnl_nft_expr_payload_types
),
1552 .types
= nfnl_nft_expr_payload_types
},
1555 static const char* const nl_union_nft_expr_data_table
[] = {
1556 [NL_UNION_NFT_EXPR_DATA_BITWISE
] = "bitwise",
1557 [NL_UNION_NFT_EXPR_DATA_CMP
] = "cmp",
1558 [NL_UNION_NFT_EXPR_DATA_LOOKUP
] = "lookup",
1559 [NL_UNION_NFT_EXPR_DATA_META
] = "meta",
1560 [NL_UNION_NFT_EXPR_DATA_FIB
] = "fib",
1561 [NL_UNION_NFT_EXPR_DATA_MASQ
] = "masq",
1562 [NL_UNION_NFT_EXPR_DATA_NAT
] = "nat",
1563 [NL_UNION_NFT_EXPR_DATA_PAYLOAD
] = "payload",
1566 DEFINE_STRING_TABLE_LOOKUP(nl_union_nft_expr_data
, NLUnionNFTExprData
);
1568 static const NLTypeSystemUnion nfnl_nft_data_expr_type_system_union
= {
1569 .num
= _NL_UNION_NFT_EXPR_DATA_MAX
,
1570 .lookup
= nl_union_nft_expr_data_from_string
,
1571 .type_systems
= nfnl_expr_data_type_systems
,
1572 .match_type
= NL_MATCH_SIBLING
,
1573 .match
= NFTA_EXPR_NAME
,
1576 static const NLType nfnl_nft_rule_expr_types
[] = {
1577 [NFTA_EXPR_NAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= 16 },
1578 [NFTA_EXPR_DATA
] = { .type
= NETLINK_TYPE_UNION
,
1579 .type_system_union
= &nfnl_nft_data_expr_type_system_union
},
1582 static const NLTypeSystem nfnl_nft_rule_expr_type_system
= {
1583 .count
= ELEMENTSOF(nfnl_nft_rule_expr_types
),
1584 .types
= nfnl_nft_rule_expr_types
,
1587 static const NLType nfnl_nft_rule_types
[] = {
1588 [NFTA_RULE_TABLE
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1589 [NFTA_RULE_CHAIN
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1590 [NFTA_RULE_EXPRESSIONS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_rule_expr_type_system
}
1593 static const NLTypeSystem nfnl_nft_rule_type_system
= {
1594 .count
= ELEMENTSOF(nfnl_nft_rule_types
),
1595 .types
= nfnl_nft_rule_types
,
1598 static const NLType nfnl_nft_set_types
[] = {
1599 [NFTA_SET_TABLE
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1600 [NFTA_SET_NAME
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1601 [NFTA_SET_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1602 [NFTA_SET_KEY_TYPE
] = { .type
= NETLINK_TYPE_U32
},
1603 [NFTA_SET_KEY_LEN
] = { .type
= NETLINK_TYPE_U32
},
1604 [NFTA_SET_DATA_TYPE
] = { .type
= NETLINK_TYPE_U32
},
1605 [NFTA_SET_DATA_LEN
] = { .type
= NETLINK_TYPE_U32
},
1606 [NFTA_SET_POLICY
] = { .type
= NETLINK_TYPE_U32
},
1607 [NFTA_SET_ID
] = { .type
= NETLINK_TYPE_U32
},
1610 static const NLTypeSystem nfnl_nft_set_type_system
= {
1611 .count
= ELEMENTSOF(nfnl_nft_set_types
),
1612 .types
= nfnl_nft_set_types
,
1615 static const NLType nfnl_nft_setelem_types
[] = {
1616 [NFTA_SET_ELEM_KEY
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_data_type_system
},
1617 [NFTA_SET_ELEM_DATA
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_data_type_system
},
1618 [NFTA_SET_ELEM_FLAGS
] = { .type
= NETLINK_TYPE_U32
},
1621 static const NLTypeSystem nfnl_nft_setelem_type_system
= {
1622 .count
= ELEMENTSOF(nfnl_nft_setelem_types
),
1623 .types
= nfnl_nft_setelem_types
,
1626 static const NLType nfnl_nft_setelem_list_types
[] = {
1627 [NFTA_SET_ELEM_LIST_TABLE
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1628 [NFTA_SET_ELEM_LIST_SET
] = { .type
= NETLINK_TYPE_STRING
, .size
= NFT_TABLE_MAXNAMELEN
- 1 },
1629 [NFTA_SET_ELEM_LIST_ELEMENTS
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_setelem_type_system
},
1632 static const NLTypeSystem nfnl_nft_setelem_list_type_system
= {
1633 .count
= ELEMENTSOF(nfnl_nft_setelem_list_types
),
1634 .types
= nfnl_nft_setelem_list_types
,
1637 static const NLType nfnl_nft_msg_types
[] = {
1638 [NFT_MSG_DELTABLE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_table_type_system
, .size
= sizeof(struct nfgenmsg
) },
1639 [NFT_MSG_NEWTABLE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_table_type_system
, .size
= sizeof(struct nfgenmsg
) },
1640 [NFT_MSG_NEWCHAIN
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_chain_type_system
, .size
= sizeof(struct nfgenmsg
) },
1641 [NFT_MSG_NEWRULE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_rule_type_system
, .size
= sizeof(struct nfgenmsg
) },
1642 [NFT_MSG_NEWSET
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_set_type_system
, .size
= sizeof(struct nfgenmsg
) },
1643 [NFT_MSG_NEWSETELEM
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_setelem_list_type_system
, .size
= sizeof(struct nfgenmsg
) },
1644 [NFT_MSG_DELSETELEM
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_setelem_list_type_system
, .size
= sizeof(struct nfgenmsg
) },
1647 static const NLTypeSystem nfnl_nft_msg_type_system
= {
1648 .count
= ELEMENTSOF(nfnl_nft_msg_types
),
1649 .types
= nfnl_nft_msg_types
,
1652 static const NLType nfnl_msg_batch_types
[] = {
1653 [NFNL_BATCH_GENID
] = { .type
= NETLINK_TYPE_U32
}
1656 static const NLTypeSystem nfnl_msg_batch_type_system
= {
1657 .count
= ELEMENTSOF(nfnl_msg_batch_types
),
1658 .types
= nfnl_msg_batch_types
,
1661 static const NLType nfnl_types
[] = {
1662 [NLMSG_DONE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &empty_type_system
, .size
= 0 },
1663 [NLMSG_ERROR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &error_type_system
, .size
= sizeof(struct nlmsgerr
) },
1664 [NFNL_MSG_BATCH_BEGIN
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_msg_batch_type_system
, .size
= sizeof(struct nfgenmsg
) },
1665 [NFNL_MSG_BATCH_END
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_msg_batch_type_system
, .size
= sizeof(struct nfgenmsg
) },
1666 [NFNL_SUBSYS_NFTABLES
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &nfnl_nft_msg_type_system
, .size
= sizeof(struct nfgenmsg
) },
1669 const NLTypeSystem nfnl_type_system_root
= {
1670 .count
= ELEMENTSOF(nfnl_types
),
1671 .types
= nfnl_types
,
1674 /* Mainly used when sending message */
1675 const NLTypeSystem genl_family_type_system_root
= {
1676 .count
= ELEMENTSOF(genl_families
),
1677 .types
= genl_families
,
1680 static const NLType genl_types
[] = {
1681 [SD_GENL_ERROR
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &error_type_system
, .size
= sizeof(struct nlmsgerr
) },
1682 [SD_GENL_DONE
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &empty_type_system
},
1683 [SD_GENL_ID_CTRL
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_get_family_type_system
, .size
= sizeof(struct genlmsghdr
) },
1684 [SD_GENL_NL80211
] = { .type
= NETLINK_TYPE_NESTED
, .type_system
= &genl_nl80211_type_system
, .size
= sizeof(struct genlmsghdr
) },
1687 /* Mainly used when message received */
1688 const NLTypeSystem genl_type_system_root
= {
1689 .count
= ELEMENTSOF(genl_types
),
1690 .types
= genl_types
,
1693 uint16_t type_get_type(const NLType
*type
) {
1698 size_t type_get_size(const NLType
*type
) {
1703 const NLTypeSystem
*type_get_type_system(const NLType
*nl_type
) {
1705 assert(nl_type
->type
== NETLINK_TYPE_NESTED
);
1706 assert(nl_type
->type_system
);
1707 return nl_type
->type_system
;
1710 const NLTypeSystemUnion
*type_get_type_system_union(const NLType
*nl_type
) {
1712 assert(nl_type
->type
== NETLINK_TYPE_UNION
);
1713 assert(nl_type
->type_system_union
);
1714 return nl_type
->type_system_union
;
1717 uint16_t type_system_get_count(const NLTypeSystem
*type_system
) {
1718 assert(type_system
);
1719 return type_system
->count
;
1722 const NLTypeSystem
*type_system_get_root(int protocol
) {
1724 case NETLINK_GENERIC
:
1725 return &genl_type_system_root
;
1726 case NETLINK_NETFILTER
:
1727 return &nfnl_type_system_root
;
1728 default: /* NETLINK_ROUTE: */
1729 return &rtnl_type_system_root
;
1733 int type_system_root_get_type(sd_netlink
*nl
, const NLType
**ret
, uint16_t type
) {
1734 sd_genl_family_t family
;
1735 const NLType
*nl_type
;
1739 return type_system_get_type(&rtnl_type_system_root
, ret
, type
);
1741 if (nl
->protocol
!= NETLINK_GENERIC
)
1742 return type_system_get_type(type_system_get_root(nl
->protocol
), ret
, type
);
1744 r
= nlmsg_type_to_genl_family(nl
, type
, &family
);
1748 if (family
>= genl_type_system_root
.count
)
1751 nl_type
= &genl_type_system_root
.types
[family
];
1753 if (nl_type
->type
== NETLINK_TYPE_UNSPEC
)
1761 int type_system_get_type(const NLTypeSystem
*type_system
, const NLType
**ret
, uint16_t type
) {
1762 const NLType
*nl_type
;
1765 assert(type_system
);
1766 assert(type_system
->types
);
1768 if (type
>= type_system
->count
)
1771 nl_type
= &type_system
->types
[type
];
1773 if (nl_type
->type
== NETLINK_TYPE_UNSPEC
)
1780 int type_system_get_type_system(const NLTypeSystem
*type_system
, const NLTypeSystem
**ret
, uint16_t type
) {
1781 const NLType
*nl_type
;
1786 r
= type_system_get_type(type_system
, &nl_type
, type
);
1790 *ret
= type_get_type_system(nl_type
);
1794 int type_system_get_type_system_union(const NLTypeSystem
*type_system
, const NLTypeSystemUnion
**ret
, uint16_t type
) {
1795 const NLType
*nl_type
;
1800 r
= type_system_get_type(type_system
, &nl_type
, type
);
1804 *ret
= type_get_type_system_union(nl_type
);
1808 int type_system_union_get_type_system_by_string(const NLTypeSystemUnion
*type_system_union
, const NLTypeSystem
**ret
, const char *key
) {
1811 assert(type_system_union
);
1812 assert(type_system_union
->match_type
== NL_MATCH_SIBLING
);
1813 assert(type_system_union
->lookup
);
1814 assert(type_system_union
->type_systems
);
1818 type
= type_system_union
->lookup(key
);
1822 assert(type
< type_system_union
->num
);
1824 *ret
= &type_system_union
->type_systems
[type
];
1828 int type_system_union_get_type_system_by_protocol(const NLTypeSystemUnion
*type_system_union
, const NLTypeSystem
**ret
, uint16_t protocol
) {
1829 const NLTypeSystem
*type_system
;
1831 assert(type_system_union
);
1832 assert(type_system_union
->type_systems
);
1833 assert(type_system_union
->match_type
== NL_MATCH_PROTOCOL
);
1836 if (protocol
>= type_system_union
->num
)
1839 type_system
= &type_system_union
->type_systems
[protocol
];
1840 if (!type_system
->types
)