1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _LINUX_NF_TABLES_H
3 #define _LINUX_NF_TABLES_H
4 
5 #define NFT_NAME_MAXLEN		256
6 #define NFT_TABLE_MAXNAMELEN	NFT_NAME_MAXLEN
7 #define NFT_CHAIN_MAXNAMELEN	NFT_NAME_MAXLEN
8 #define NFT_SET_MAXNAMELEN	NFT_NAME_MAXLEN
9 #define NFT_OBJ_MAXNAMELEN	NFT_NAME_MAXLEN
10 #define NFT_USERDATA_MAXLEN	256
11 #define NFT_OSF_MAXGENRELEN	16
12 
13 /**
14  * enum nft_registers - nf_tables registers
15  *
16  * nf_tables used to have five registers: a verdict register and four data
17  * registers of size 16. The data registers have been changed to 16 registers
18  * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still
19  * map to areas of size 16, the 4 byte registers are addressed using
20  * NFT_REG32_00 - NFT_REG32_15.
21  */
22 enum nft_registers {
23 	NFT_REG_VERDICT,
24 	NFT_REG_1,
25 	NFT_REG_2,
26 	NFT_REG_3,
27 	NFT_REG_4,
28 	__NFT_REG_MAX,
29 
30 	NFT_REG32_00	= 8,
31 	NFT_REG32_01,
32 	NFT_REG32_02,
33 	NFT_REG32_03,
34 	NFT_REG32_04,
35 	NFT_REG32_05,
36 	NFT_REG32_06,
37 	NFT_REG32_07,
38 	NFT_REG32_08,
39 	NFT_REG32_09,
40 	NFT_REG32_10,
41 	NFT_REG32_11,
42 	NFT_REG32_12,
43 	NFT_REG32_13,
44 	NFT_REG32_14,
45 	NFT_REG32_15,
46 };
47 #define NFT_REG_MAX	(__NFT_REG_MAX - 1)
48 
49 #define NFT_REG_SIZE	16
50 #define NFT_REG32_SIZE	4
51 #define NFT_REG32_COUNT	(NFT_REG32_15 - NFT_REG32_00 + 1)
52 
53 /**
54  * enum nft_verdicts - nf_tables internal verdicts
55  *
56  * @NFT_CONTINUE: continue evaluation of the current rule
57  * @NFT_BREAK: terminate evaluation of the current rule
58  * @NFT_JUMP: push the current chain on the jump stack and jump to a chain
59  * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack
60  * @NFT_RETURN: return to the topmost chain on the jump stack
61  *
62  * The nf_tables verdicts share their numeric space with the netfilter verdicts.
63  */
64 enum nft_verdicts {
65 	NFT_CONTINUE	= -1,
66 	NFT_BREAK	= -2,
67 	NFT_JUMP	= -3,
68 	NFT_GOTO	= -4,
69 	NFT_RETURN	= -5,
70 };
71 
72 /**
73  * enum nf_tables_msg_types - nf_tables netlink message types
74  *
75  * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes)
76  * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes)
77  * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes)
78  * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes)
79  * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes)
80  * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes)
81  * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes)
82  * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes)
83  * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes)
84  * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes)
85  * @NFT_MSG_GETSET: get a set (enum nft_set_attributes)
86  * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes)
87  * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes)
88  * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes)
89  * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
90  * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes)
91  * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes)
92  * @NFT_MSG_TRACE: trace event (enum nft_trace_attributes)
93  * @NFT_MSG_NEWOBJ: create a stateful object (enum nft_obj_attributes)
94  * @NFT_MSG_GETOBJ: get a stateful object (enum nft_obj_attributes)
95  * @NFT_MSG_DELOBJ: delete a stateful object (enum nft_obj_attributes)
96  * @NFT_MSG_GETOBJ_RESET: get and reset a stateful object (enum nft_obj_attributes)
97  * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes)
98  * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes)
99  * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes)
100  */
101 enum nf_tables_msg_types {
102 	NFT_MSG_NEWTABLE,
103 	NFT_MSG_GETTABLE,
104 	NFT_MSG_DELTABLE,
105 	NFT_MSG_NEWCHAIN,
106 	NFT_MSG_GETCHAIN,
107 	NFT_MSG_DELCHAIN,
108 	NFT_MSG_NEWRULE,
109 	NFT_MSG_GETRULE,
110 	NFT_MSG_DELRULE,
111 	NFT_MSG_NEWSET,
112 	NFT_MSG_GETSET,
113 	NFT_MSG_DELSET,
114 	NFT_MSG_NEWSETELEM,
115 	NFT_MSG_GETSETELEM,
116 	NFT_MSG_DELSETELEM,
117 	NFT_MSG_NEWGEN,
118 	NFT_MSG_GETGEN,
119 	NFT_MSG_TRACE,
120 	NFT_MSG_NEWOBJ,
121 	NFT_MSG_GETOBJ,
122 	NFT_MSG_DELOBJ,
123 	NFT_MSG_GETOBJ_RESET,
124 	NFT_MSG_NEWFLOWTABLE,
125 	NFT_MSG_GETFLOWTABLE,
126 	NFT_MSG_DELFLOWTABLE,
127 	NFT_MSG_MAX,
128 };
129 
130 /**
131  * enum nft_list_attributes - nf_tables generic list netlink attributes
132  *
133  * @NFTA_LIST_ELEM: list element (NLA_NESTED)
134  */
135 enum nft_list_attributes {
136 	NFTA_LIST_UNSPEC,
137 	NFTA_LIST_ELEM,
138 	__NFTA_LIST_MAX
139 };
140 #define NFTA_LIST_MAX		(__NFTA_LIST_MAX - 1)
141 
142 /**
143  * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes
144  *
145  * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32)
146  * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
147  * @NFTA_HOOK_DEV: netdevice name (NLA_STRING)
148  * @NFTA_HOOK_DEVS: list of netdevices (NLA_NESTED)
149  */
150 enum nft_hook_attributes {
151 	NFTA_HOOK_UNSPEC,
152 	NFTA_HOOK_HOOKNUM,
153 	NFTA_HOOK_PRIORITY,
154 	NFTA_HOOK_DEV,
155 	NFTA_HOOK_DEVS,
156 	__NFTA_HOOK_MAX
157 };
158 #define NFTA_HOOK_MAX		(__NFTA_HOOK_MAX - 1)
159 
160 /**
161  * enum nft_table_flags - nf_tables table flags
162  *
163  * @NFT_TABLE_F_DORMANT: this table is not active
164  */
165 enum nft_table_flags {
166 	NFT_TABLE_F_DORMANT	= 0x1,
167 	NFT_TABLE_F_OWNER	= 0x2,
168 };
169 #define NFT_TABLE_F_MASK	(NFT_TABLE_F_DORMANT | \
170 				 NFT_TABLE_F_OWNER)
171 
172 /**
173  * enum nft_table_attributes - nf_tables table netlink attributes
174  *
175  * @NFTA_TABLE_NAME: name of the table (NLA_STRING)
176  * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32)
177  * @NFTA_TABLE_USE: number of chains in this table (NLA_U32)
178  * @NFTA_TABLE_USERDATA: user data (NLA_BINARY)
179  * @NFTA_TABLE_OWNER: owner of this table through netlink portID (NLA_U32)
180  */
181 enum nft_table_attributes {
182 	NFTA_TABLE_UNSPEC,
183 	NFTA_TABLE_NAME,
184 	NFTA_TABLE_FLAGS,
185 	NFTA_TABLE_USE,
186 	NFTA_TABLE_HANDLE,
187 	NFTA_TABLE_PAD,
188 	NFTA_TABLE_USERDATA,
189 	NFTA_TABLE_OWNER,
190 	__NFTA_TABLE_MAX
191 };
192 #define NFTA_TABLE_MAX		(__NFTA_TABLE_MAX - 1)
193 
194 enum nft_chain_flags {
195 	NFT_CHAIN_BASE		= (1 << 0),
196 	NFT_CHAIN_HW_OFFLOAD	= (1 << 1),
197 	NFT_CHAIN_BINDING	= (1 << 2),
198 };
199 #define NFT_CHAIN_FLAGS		(NFT_CHAIN_BASE		| \
200 				 NFT_CHAIN_HW_OFFLOAD	| \
201 				 NFT_CHAIN_BINDING)
202 
203 /**
204  * enum nft_chain_attributes - nf_tables chain netlink attributes
205  *
206  * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING)
207  * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64)
208  * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING)
209  * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes)
210  * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32)
211  * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32)
212  * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING)
213  * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes)
214  * @NFTA_CHAIN_FLAGS: chain flags
215  * @NFTA_CHAIN_ID: uniquely identifies a chain in a transaction (NLA_U32)
216  * @NFTA_CHAIN_USERDATA: user data (NLA_BINARY)
217  */
218 enum nft_chain_attributes {
219 	NFTA_CHAIN_UNSPEC,
220 	NFTA_CHAIN_TABLE,
221 	NFTA_CHAIN_HANDLE,
222 	NFTA_CHAIN_NAME,
223 	NFTA_CHAIN_HOOK,
224 	NFTA_CHAIN_POLICY,
225 	NFTA_CHAIN_USE,
226 	NFTA_CHAIN_TYPE,
227 	NFTA_CHAIN_COUNTERS,
228 	NFTA_CHAIN_PAD,
229 	NFTA_CHAIN_FLAGS,
230 	NFTA_CHAIN_ID,
231 	NFTA_CHAIN_USERDATA,
232 	__NFTA_CHAIN_MAX
233 };
234 #define NFTA_CHAIN_MAX		(__NFTA_CHAIN_MAX - 1)
235 
236 /**
237  * enum nft_rule_attributes - nf_tables rule netlink attributes
238  *
239  * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING)
240  * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING)
241  * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64)
242  * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
243  * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
244  * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
245  * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN)
246  * @NFTA_RULE_ID: uniquely identifies a rule in a transaction (NLA_U32)
247  * @NFTA_RULE_POSITION_ID: transaction unique identifier of the previous rule (NLA_U32)
248  */
249 enum nft_rule_attributes {
250 	NFTA_RULE_UNSPEC,
251 	NFTA_RULE_TABLE,
252 	NFTA_RULE_CHAIN,
253 	NFTA_RULE_HANDLE,
254 	NFTA_RULE_EXPRESSIONS,
255 	NFTA_RULE_COMPAT,
256 	NFTA_RULE_POSITION,
257 	NFTA_RULE_USERDATA,
258 	NFTA_RULE_PAD,
259 	NFTA_RULE_ID,
260 	NFTA_RULE_POSITION_ID,
261 	NFTA_RULE_CHAIN_ID,
262 	__NFTA_RULE_MAX
263 };
264 #define NFTA_RULE_MAX		(__NFTA_RULE_MAX - 1)
265 
266 /**
267  * enum nft_rule_compat_flags - nf_tables rule compat flags
268  *
269  * @NFT_RULE_COMPAT_F_INV: invert the check result
270  */
271 enum nft_rule_compat_flags {
272 	NFT_RULE_COMPAT_F_INV	= (1 << 1),
273 	NFT_RULE_COMPAT_F_MASK	= NFT_RULE_COMPAT_F_INV,
274 };
275 
276 /**
277  * enum nft_rule_compat_attributes - nf_tables rule compat attributes
278  *
279  * @NFTA_RULE_COMPAT_PROTO: numeric value of handled protocol (NLA_U32)
280  * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32)
281  */
282 enum nft_rule_compat_attributes {
283 	NFTA_RULE_COMPAT_UNSPEC,
284 	NFTA_RULE_COMPAT_PROTO,
285 	NFTA_RULE_COMPAT_FLAGS,
286 	__NFTA_RULE_COMPAT_MAX
287 };
288 #define NFTA_RULE_COMPAT_MAX	(__NFTA_RULE_COMPAT_MAX - 1)
289 
290 /**
291  * enum nft_set_flags - nf_tables set flags
292  *
293  * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink
294  * @NFT_SET_CONSTANT: set contents may not change while bound
295  * @NFT_SET_INTERVAL: set contains intervals
296  * @NFT_SET_MAP: set is used as a dictionary
297  * @NFT_SET_TIMEOUT: set uses timeouts
298  * @NFT_SET_EVAL: set can be updated from the evaluation path
299  * @NFT_SET_OBJECT: set contains stateful objects
300  * @NFT_SET_CONCAT: set contains a concatenation
301  * @NFT_SET_EXPR: set contains expressions
302  */
303 enum nft_set_flags {
304 	NFT_SET_ANONYMOUS		= 0x1,
305 	NFT_SET_CONSTANT		= 0x2,
306 	NFT_SET_INTERVAL		= 0x4,
307 	NFT_SET_MAP			= 0x8,
308 	NFT_SET_TIMEOUT			= 0x10,
309 	NFT_SET_EVAL			= 0x20,
310 	NFT_SET_OBJECT			= 0x40,
311 	NFT_SET_CONCAT			= 0x80,
312 	NFT_SET_EXPR			= 0x100,
313 };
314 
315 /**
316  * enum nft_set_policies - set selection policy
317  *
318  * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use
319  * @NFT_SET_POL_MEMORY: prefer low memory use over high performance
320  */
321 enum nft_set_policies {
322 	NFT_SET_POL_PERFORMANCE,
323 	NFT_SET_POL_MEMORY,
324 };
325 
326 /**
327  * enum nft_set_desc_attributes - set element description
328  *
329  * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32)
330  * @NFTA_SET_DESC_CONCAT: description of field concatenation (NLA_NESTED)
331  */
332 enum nft_set_desc_attributes {
333 	NFTA_SET_DESC_UNSPEC,
334 	NFTA_SET_DESC_SIZE,
335 	NFTA_SET_DESC_CONCAT,
336 	__NFTA_SET_DESC_MAX
337 };
338 #define NFTA_SET_DESC_MAX	(__NFTA_SET_DESC_MAX - 1)
339 
340 /**
341  * enum nft_set_field_attributes - attributes of concatenated fields
342  *
343  * @NFTA_SET_FIELD_LEN: length of single field, in bits (NLA_U32)
344  */
345 enum nft_set_field_attributes {
346 	NFTA_SET_FIELD_UNSPEC,
347 	NFTA_SET_FIELD_LEN,
348 	__NFTA_SET_FIELD_MAX
349 };
350 #define NFTA_SET_FIELD_MAX	(__NFTA_SET_FIELD_MAX - 1)
351 
352 /**
353  * enum nft_set_attributes - nf_tables set netlink attributes
354  *
355  * @NFTA_SET_TABLE: table name (NLA_STRING)
356  * @NFTA_SET_NAME: set name (NLA_STRING)
357  * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32)
358  * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32)
359  * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
360  * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
361  * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
362  * @NFTA_SET_POLICY: selection policy (NLA_U32)
363  * @NFTA_SET_DESC: set description (NLA_NESTED)
364  * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
365  * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64)
366  * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32)
367  * @NFTA_SET_USERDATA: user data (NLA_BINARY)
368  * @NFTA_SET_OBJ_TYPE: stateful object type (NLA_U32: NFT_OBJECT_*)
369  * @NFTA_SET_HANDLE: set handle (NLA_U64)
370  * @NFTA_SET_EXPR: set expression (NLA_NESTED: nft_expr_attributes)
371  * @NFTA_SET_EXPRESSIONS: list of expressions (NLA_NESTED: nft_list_attributes)
372  */
373 enum nft_set_attributes {
374 	NFTA_SET_UNSPEC,
375 	NFTA_SET_TABLE,
376 	NFTA_SET_NAME,
377 	NFTA_SET_FLAGS,
378 	NFTA_SET_KEY_TYPE,
379 	NFTA_SET_KEY_LEN,
380 	NFTA_SET_DATA_TYPE,
381 	NFTA_SET_DATA_LEN,
382 	NFTA_SET_POLICY,
383 	NFTA_SET_DESC,
384 	NFTA_SET_ID,
385 	NFTA_SET_TIMEOUT,
386 	NFTA_SET_GC_INTERVAL,
387 	NFTA_SET_USERDATA,
388 	NFTA_SET_PAD,
389 	NFTA_SET_OBJ_TYPE,
390 	NFTA_SET_HANDLE,
391 	NFTA_SET_EXPR,
392 	NFTA_SET_EXPRESSIONS,
393 	__NFTA_SET_MAX
394 };
395 #define NFTA_SET_MAX		(__NFTA_SET_MAX - 1)
396 
397 /**
398  * enum nft_set_elem_flags - nf_tables set element flags
399  *
400  * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval
401  * @NFT_SET_ELEM_CATCHALL: special catch-all element
402  */
403 enum nft_set_elem_flags {
404 	NFT_SET_ELEM_INTERVAL_END	= 0x1,
405 	NFT_SET_ELEM_CATCHALL		= 0x2,
406 };
407 
408 /**
409  * enum nft_set_elem_attributes - nf_tables set element netlink attributes
410  *
411  * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
412  * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
413  * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
414  * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64)
415  * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64)
416  * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY)
417  * @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes)
418  * @NFTA_SET_ELEM_OBJREF: stateful object reference (NLA_STRING)
419  * @NFTA_SET_ELEM_KEY_END: closing key value (NLA_NESTED: nft_data)
420  * @NFTA_SET_ELEM_EXPRESSIONS: list of expressions (NLA_NESTED: nft_list_attributes)
421  */
422 enum nft_set_elem_attributes {
423 	NFTA_SET_ELEM_UNSPEC,
424 	NFTA_SET_ELEM_KEY,
425 	NFTA_SET_ELEM_DATA,
426 	NFTA_SET_ELEM_FLAGS,
427 	NFTA_SET_ELEM_TIMEOUT,
428 	NFTA_SET_ELEM_EXPIRATION,
429 	NFTA_SET_ELEM_USERDATA,
430 	NFTA_SET_ELEM_EXPR,
431 	NFTA_SET_ELEM_PAD,
432 	NFTA_SET_ELEM_OBJREF,
433 	NFTA_SET_ELEM_KEY_END,
434 	NFTA_SET_ELEM_EXPRESSIONS,
435 	__NFTA_SET_ELEM_MAX
436 };
437 #define NFTA_SET_ELEM_MAX	(__NFTA_SET_ELEM_MAX - 1)
438 
439 /**
440  * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes
441  *
442  * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
443  * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
444  * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
445  * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
446  */
447 enum nft_set_elem_list_attributes {
448 	NFTA_SET_ELEM_LIST_UNSPEC,
449 	NFTA_SET_ELEM_LIST_TABLE,
450 	NFTA_SET_ELEM_LIST_SET,
451 	NFTA_SET_ELEM_LIST_ELEMENTS,
452 	NFTA_SET_ELEM_LIST_SET_ID,
453 	__NFTA_SET_ELEM_LIST_MAX
454 };
455 #define NFTA_SET_ELEM_LIST_MAX	(__NFTA_SET_ELEM_LIST_MAX - 1)
456 
457 /**
458  * enum nft_data_types - nf_tables data types
459  *
460  * @NFT_DATA_VALUE: generic data
461  * @NFT_DATA_VERDICT: netfilter verdict
462  *
463  * The type of data is usually determined by the kernel directly and is not
464  * explicitly specified by userspace. The only difference are sets, where
465  * userspace specifies the key and mapping data types.
466  *
467  * The values 0xffffff00-0xffffffff are reserved for internally used types.
468  * The remaining range can be freely used by userspace to encode types, all
469  * values are equivalent to NFT_DATA_VALUE.
470  */
471 enum nft_data_types {
472 	NFT_DATA_VALUE,
473 	NFT_DATA_VERDICT	= 0xffffff00U,
474 };
475 
476 #define NFT_DATA_RESERVED_MASK	0xffffff00U
477 
478 /**
479  * enum nft_data_attributes - nf_tables data netlink attributes
480  *
481  * @NFTA_DATA_VALUE: generic data (NLA_BINARY)
482  * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes)
483  */
484 enum nft_data_attributes {
485 	NFTA_DATA_UNSPEC,
486 	NFTA_DATA_VALUE,
487 	NFTA_DATA_VERDICT,
488 	__NFTA_DATA_MAX
489 };
490 #define NFTA_DATA_MAX		(__NFTA_DATA_MAX - 1)
491 
492 /* Maximum length of a value */
493 #define NFT_DATA_VALUE_MAXLEN	64
494 
495 /**
496  * enum nft_verdict_attributes - nf_tables verdict netlink attributes
497  *
498  * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts)
499  * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING)
500  * @NFTA_VERDICT_CHAIN_ID: jump target chain ID (NLA_U32)
501  */
502 enum nft_verdict_attributes {
503 	NFTA_VERDICT_UNSPEC,
504 	NFTA_VERDICT_CODE,
505 	NFTA_VERDICT_CHAIN,
506 	NFTA_VERDICT_CHAIN_ID,
507 	__NFTA_VERDICT_MAX
508 };
509 #define NFTA_VERDICT_MAX	(__NFTA_VERDICT_MAX - 1)
510 
511 /**
512  * enum nft_expr_attributes - nf_tables expression netlink attributes
513  *
514  * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING)
515  * @NFTA_EXPR_DATA: type specific data (NLA_NESTED)
516  */
517 enum nft_expr_attributes {
518 	NFTA_EXPR_UNSPEC,
519 	NFTA_EXPR_NAME,
520 	NFTA_EXPR_DATA,
521 	__NFTA_EXPR_MAX
522 };
523 #define NFTA_EXPR_MAX		(__NFTA_EXPR_MAX - 1)
524 
525 /**
526  * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes
527  *
528  * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32)
529  * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes)
530  */
531 enum nft_immediate_attributes {
532 	NFTA_IMMEDIATE_UNSPEC,
533 	NFTA_IMMEDIATE_DREG,
534 	NFTA_IMMEDIATE_DATA,
535 	__NFTA_IMMEDIATE_MAX
536 };
537 #define NFTA_IMMEDIATE_MAX	(__NFTA_IMMEDIATE_MAX - 1)
538 
539 /**
540  * enum nft_bitwise_ops - nf_tables bitwise operations
541  *
542  * @NFT_BITWISE_BOOL: mask-and-xor operation used to implement NOT, AND, OR and
543  *                    XOR boolean operations
544  * @NFT_BITWISE_LSHIFT: left-shift operation
545  * @NFT_BITWISE_RSHIFT: right-shift operation
546  */
547 enum nft_bitwise_ops {
548 	NFT_BITWISE_BOOL,
549 	NFT_BITWISE_LSHIFT,
550 	NFT_BITWISE_RSHIFT,
551 };
552 
553 /**
554  * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes
555  *
556  * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers)
557  * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers)
558  * @NFTA_BITWISE_LEN: length of operands (NLA_U32)
559  * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes)
560  * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes)
561  * @NFTA_BITWISE_OP: type of operation (NLA_U32: nft_bitwise_ops)
562  * @NFTA_BITWISE_DATA: argument for non-boolean operations
563  *                     (NLA_NESTED: nft_data_attributes)
564  *
565  * The bitwise expression supports boolean and shift operations.  It implements
566  * the boolean operations by performing the following operation:
567  *
568  * dreg = (sreg & mask) ^ xor
569  *
570  * with these mask and xor values:
571  *
572  * 		mask	xor
573  * NOT:		1	1
574  * OR:		~x	x
575  * XOR:		1	x
576  * AND:		x	0
577  */
578 enum nft_bitwise_attributes {
579 	NFTA_BITWISE_UNSPEC,
580 	NFTA_BITWISE_SREG,
581 	NFTA_BITWISE_DREG,
582 	NFTA_BITWISE_LEN,
583 	NFTA_BITWISE_MASK,
584 	NFTA_BITWISE_XOR,
585 	NFTA_BITWISE_OP,
586 	NFTA_BITWISE_DATA,
587 	__NFTA_BITWISE_MAX
588 };
589 #define NFTA_BITWISE_MAX	(__NFTA_BITWISE_MAX - 1)
590 
591 /**
592  * enum nft_byteorder_ops - nf_tables byteorder operators
593  *
594  * @NFT_BYTEORDER_NTOH: network to host operator
595  * @NFT_BYTEORDER_HTON: host to network operator
596  */
597 enum nft_byteorder_ops {
598 	NFT_BYTEORDER_NTOH,
599 	NFT_BYTEORDER_HTON,
600 };
601 
602 /**
603  * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes
604  *
605  * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers)
606  * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers)
607  * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops)
608  * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32)
609  * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4)
610  */
611 enum nft_byteorder_attributes {
612 	NFTA_BYTEORDER_UNSPEC,
613 	NFTA_BYTEORDER_SREG,
614 	NFTA_BYTEORDER_DREG,
615 	NFTA_BYTEORDER_OP,
616 	NFTA_BYTEORDER_LEN,
617 	NFTA_BYTEORDER_SIZE,
618 	__NFTA_BYTEORDER_MAX
619 };
620 #define NFTA_BYTEORDER_MAX	(__NFTA_BYTEORDER_MAX - 1)
621 
622 /**
623  * enum nft_cmp_ops - nf_tables relational operator
624  *
625  * @NFT_CMP_EQ: equal
626  * @NFT_CMP_NEQ: not equal
627  * @NFT_CMP_LT: less than
628  * @NFT_CMP_LTE: less than or equal to
629  * @NFT_CMP_GT: greater than
630  * @NFT_CMP_GTE: greater than or equal to
631  */
632 enum nft_cmp_ops {
633 	NFT_CMP_EQ,
634 	NFT_CMP_NEQ,
635 	NFT_CMP_LT,
636 	NFT_CMP_LTE,
637 	NFT_CMP_GT,
638 	NFT_CMP_GTE,
639 };
640 
641 /**
642  * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes
643  *
644  * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers)
645  * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops)
646  * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes)
647  */
648 enum nft_cmp_attributes {
649 	NFTA_CMP_UNSPEC,
650 	NFTA_CMP_SREG,
651 	NFTA_CMP_OP,
652 	NFTA_CMP_DATA,
653 	__NFTA_CMP_MAX
654 };
655 #define NFTA_CMP_MAX		(__NFTA_CMP_MAX - 1)
656 
657 /**
658  * enum nft_range_ops - nf_tables range operator
659  *
660  * @NFT_RANGE_EQ: equal
661  * @NFT_RANGE_NEQ: not equal
662  */
663 enum nft_range_ops {
664 	NFT_RANGE_EQ,
665 	NFT_RANGE_NEQ,
666 };
667 
668 /**
669  * enum nft_range_attributes - nf_tables range expression netlink attributes
670  *
671  * @NFTA_RANGE_SREG: source register of data to compare (NLA_U32: nft_registers)
672  * @NFTA_RANGE_OP: cmp operation (NLA_U32: nft_cmp_ops)
673  * @NFTA_RANGE_FROM_DATA: data range from (NLA_NESTED: nft_data_attributes)
674  * @NFTA_RANGE_TO_DATA: data range to (NLA_NESTED: nft_data_attributes)
675  */
676 enum nft_range_attributes {
677 	NFTA_RANGE_UNSPEC,
678 	NFTA_RANGE_SREG,
679 	NFTA_RANGE_OP,
680 	NFTA_RANGE_FROM_DATA,
681 	NFTA_RANGE_TO_DATA,
682 	__NFTA_RANGE_MAX
683 };
684 #define NFTA_RANGE_MAX		(__NFTA_RANGE_MAX - 1)
685 
686 enum nft_lookup_flags {
687 	NFT_LOOKUP_F_INV = (1 << 0),
688 };
689 
690 /**
691  * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes
692  *
693  * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
694  * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
695  * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
696  * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
697  * @NFTA_LOOKUP_FLAGS: flags (NLA_U32: enum nft_lookup_flags)
698  */
699 enum nft_lookup_attributes {
700 	NFTA_LOOKUP_UNSPEC,
701 	NFTA_LOOKUP_SET,
702 	NFTA_LOOKUP_SREG,
703 	NFTA_LOOKUP_DREG,
704 	NFTA_LOOKUP_SET_ID,
705 	NFTA_LOOKUP_FLAGS,
706 	__NFTA_LOOKUP_MAX
707 };
708 #define NFTA_LOOKUP_MAX		(__NFTA_LOOKUP_MAX - 1)
709 
710 enum nft_dynset_ops {
711 	NFT_DYNSET_OP_ADD,
712 	NFT_DYNSET_OP_UPDATE,
713 	NFT_DYNSET_OP_DELETE,
714 };
715 
716 enum nft_dynset_flags {
717 	NFT_DYNSET_F_INV	= (1 << 0),
718 	NFT_DYNSET_F_EXPR	= (1 << 1),
719 };
720 
721 /**
722  * enum nft_dynset_attributes - dynset expression attributes
723  *
724  * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING)
725  * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32)
726  * @NFTA_DYNSET_OP: operation (NLA_U32)
727  * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32)
728  * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32)
729  * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64)
730  * @NFTA_DYNSET_EXPR: expression (NLA_NESTED: nft_expr_attributes)
731  * @NFTA_DYNSET_FLAGS: flags (NLA_U32)
732  * @NFTA_DYNSET_EXPRESSIONS: list of expressions (NLA_NESTED: nft_list_attributes)
733  */
734 enum nft_dynset_attributes {
735 	NFTA_DYNSET_UNSPEC,
736 	NFTA_DYNSET_SET_NAME,
737 	NFTA_DYNSET_SET_ID,
738 	NFTA_DYNSET_OP,
739 	NFTA_DYNSET_SREG_KEY,
740 	NFTA_DYNSET_SREG_DATA,
741 	NFTA_DYNSET_TIMEOUT,
742 	NFTA_DYNSET_EXPR,
743 	NFTA_DYNSET_PAD,
744 	NFTA_DYNSET_FLAGS,
745 	NFTA_DYNSET_EXPRESSIONS,
746 	__NFTA_DYNSET_MAX,
747 };
748 #define NFTA_DYNSET_MAX		(__NFTA_DYNSET_MAX - 1)
749 
750 /**
751  * enum nft_payload_bases - nf_tables payload expression offset bases
752  *
753  * @NFT_PAYLOAD_LL_HEADER: link layer header
754  * @NFT_PAYLOAD_NETWORK_HEADER: network header
755  * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header
756  * @NFT_PAYLOAD_INNER_HEADER: inner header / payload
757  */
758 enum nft_payload_bases {
759 	NFT_PAYLOAD_LL_HEADER,
760 	NFT_PAYLOAD_NETWORK_HEADER,
761 	NFT_PAYLOAD_TRANSPORT_HEADER,
762 	NFT_PAYLOAD_INNER_HEADER,
763 };
764 
765 /**
766  * enum nft_payload_csum_types - nf_tables payload expression checksum types
767  *
768  * @NFT_PAYLOAD_CSUM_NONE: no checksumming
769  * @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791)
770  * @NFT_PAYLOAD_CSUM_SCTP: CRC-32c, for use in SCTP header (RFC 3309)
771  */
772 enum nft_payload_csum_types {
773 	NFT_PAYLOAD_CSUM_NONE,
774 	NFT_PAYLOAD_CSUM_INET,
775 	NFT_PAYLOAD_CSUM_SCTP,
776 };
777 
778 enum nft_payload_csum_flags {
779 	NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0),
780 };
781 
782 /**
783  * enum nft_payload_attributes - nf_tables payload expression netlink attributes
784  *
785  * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
786  * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
787  * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
788  * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
789  * @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers)
790  * @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32)
791  * @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32)
792  * @NFTA_PAYLOAD_CSUM_FLAGS: checksum flags (NLA_U32)
793  */
794 enum nft_payload_attributes {
795 	NFTA_PAYLOAD_UNSPEC,
796 	NFTA_PAYLOAD_DREG,
797 	NFTA_PAYLOAD_BASE,
798 	NFTA_PAYLOAD_OFFSET,
799 	NFTA_PAYLOAD_LEN,
800 	NFTA_PAYLOAD_SREG,
801 	NFTA_PAYLOAD_CSUM_TYPE,
802 	NFTA_PAYLOAD_CSUM_OFFSET,
803 	NFTA_PAYLOAD_CSUM_FLAGS,
804 	__NFTA_PAYLOAD_MAX
805 };
806 #define NFTA_PAYLOAD_MAX	(__NFTA_PAYLOAD_MAX - 1)
807 
808 enum nft_exthdr_flags {
809 	NFT_EXTHDR_F_PRESENT = (1 << 0),
810 };
811 
812 /**
813  * enum nft_exthdr_op - nf_tables match options
814  *
815  * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers
816  * @NFT_EXTHDR_OP_TCP: match against tcp options
817  * @NFT_EXTHDR_OP_IPV4: match against ipv4 options
818  * @NFT_EXTHDR_OP_SCTP: match against sctp chunks
819  */
820 enum nft_exthdr_op {
821 	NFT_EXTHDR_OP_IPV6,
822 	NFT_EXTHDR_OP_TCPOPT,
823 	NFT_EXTHDR_OP_IPV4,
824 	NFT_EXTHDR_OP_SCTP,
825 	__NFT_EXTHDR_OP_MAX
826 };
827 #define NFT_EXTHDR_OP_MAX	(__NFT_EXTHDR_OP_MAX - 1)
828 
829 /**
830  * enum nft_exthdr_attributes - nf_tables extension header expression netlink attributes
831  *
832  * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers)
833  * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8)
834  * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32)
835  * @NFTA_EXTHDR_LEN: extension header length (NLA_U32)
836  * @NFTA_EXTHDR_FLAGS: extension header flags (NLA_U32)
837  * @NFTA_EXTHDR_OP: option match type (NLA_U32)
838  * @NFTA_EXTHDR_SREG: option match type (NLA_U32)
839  */
840 enum nft_exthdr_attributes {
841 	NFTA_EXTHDR_UNSPEC,
842 	NFTA_EXTHDR_DREG,
843 	NFTA_EXTHDR_TYPE,
844 	NFTA_EXTHDR_OFFSET,
845 	NFTA_EXTHDR_LEN,
846 	NFTA_EXTHDR_FLAGS,
847 	NFTA_EXTHDR_OP,
848 	NFTA_EXTHDR_SREG,
849 	__NFTA_EXTHDR_MAX
850 };
851 #define NFTA_EXTHDR_MAX		(__NFTA_EXTHDR_MAX - 1)
852 
853 /**
854  * enum nft_meta_keys - nf_tables meta expression keys
855  *
856  * @NFT_META_LEN: packet length (skb->len)
857  * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT
858  * @NFT_META_PRIORITY: packet priority (skb->priority)
859  * @NFT_META_MARK: packet mark (skb->mark)
860  * @NFT_META_IIF: packet input interface index (dev->ifindex)
861  * @NFT_META_OIF: packet output interface index (dev->ifindex)
862  * @NFT_META_IIFNAME: packet input interface name (dev->name)
863  * @NFT_META_OIFNAME: packet output interface name (dev->name)
864  * @NFT_META_IIFTYPE: packet input interface type (dev->type)
865  * @NFT_META_OIFTYPE: packet output interface type (dev->type)
866  * @NFT_META_SKUID: originating socket UID (fsuid)
867  * @NFT_META_SKGID: originating socket GID (fsgid)
868  * @NFT_META_NFTRACE: packet nftrace bit
869  * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid)
870  * @NFT_META_SECMARK: packet secmark (skb->secmark)
871  * @NFT_META_NFPROTO: netfilter protocol
872  * @NFT_META_L4PROTO: layer 4 protocol number
873  * @NFT_META_BRI_IIFNAME: packet input bridge interface name
874  * @NFT_META_BRI_OIFNAME: packet output bridge interface name
875  * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
876  * @NFT_META_CPU: cpu id through smp_processor_id()
877  * @NFT_META_IIFGROUP: packet input interface group
878  * @NFT_META_OIFGROUP: packet output interface group
879  * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
880  * @NFT_META_PRANDOM: a 32bit pseudo-random number
881  * @NFT_META_SECPATH: boolean, secpath_exists (!!skb->sp)
882  * @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind)
883  * @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind)
884  * @NFT_META_BRI_IIFPVID: packet input bridge port pvid
885  * @NFT_META_BRI_IIFVPROTO: packet input bridge vlan proto
886  * @NFT_META_TIME_NS: time since epoch (in nanoseconds)
887  * @NFT_META_TIME_DAY: day of week (from 0 = Sunday to 6 = Saturday)
888  * @NFT_META_TIME_HOUR: hour of day (in seconds)
889  * @NFT_META_SDIF: slave device interface index
890  * @NFT_META_SDIFNAME: slave device interface name
891  */
892 enum nft_meta_keys {
893 	NFT_META_LEN,
894 	NFT_META_PROTOCOL,
895 	NFT_META_PRIORITY,
896 	NFT_META_MARK,
897 	NFT_META_IIF,
898 	NFT_META_OIF,
899 	NFT_META_IIFNAME,
900 	NFT_META_OIFNAME,
901 	NFT_META_IFTYPE,
902 #define NFT_META_IIFTYPE	NFT_META_IFTYPE
903 	NFT_META_OIFTYPE,
904 	NFT_META_SKUID,
905 	NFT_META_SKGID,
906 	NFT_META_NFTRACE,
907 	NFT_META_RTCLASSID,
908 	NFT_META_SECMARK,
909 	NFT_META_NFPROTO,
910 	NFT_META_L4PROTO,
911 	NFT_META_BRI_IIFNAME,
912 	NFT_META_BRI_OIFNAME,
913 	NFT_META_PKTTYPE,
914 	NFT_META_CPU,
915 	NFT_META_IIFGROUP,
916 	NFT_META_OIFGROUP,
917 	NFT_META_CGROUP,
918 	NFT_META_PRANDOM,
919 	NFT_META_SECPATH,
920 	NFT_META_IIFKIND,
921 	NFT_META_OIFKIND,
922 	NFT_META_BRI_IIFPVID,
923 	NFT_META_BRI_IIFVPROTO,
924 	NFT_META_TIME_NS,
925 	NFT_META_TIME_DAY,
926 	NFT_META_TIME_HOUR,
927 	NFT_META_SDIF,
928 	NFT_META_SDIFNAME,
929 	__NFT_META_IIFTYPE,
930 };
931 
932 /**
933  * enum nft_rt_keys - nf_tables routing expression keys
934  *
935  * @NFT_RT_CLASSID: realm value of packet's route (skb->dst->tclassid)
936  * @NFT_RT_NEXTHOP4: routing nexthop for IPv4
937  * @NFT_RT_NEXTHOP6: routing nexthop for IPv6
938  * @NFT_RT_TCPMSS: fetch current path tcp mss
939  * @NFT_RT_XFRM: boolean, skb->dst->xfrm != NULL
940  */
941 enum nft_rt_keys {
942 	NFT_RT_CLASSID,
943 	NFT_RT_NEXTHOP4,
944 	NFT_RT_NEXTHOP6,
945 	NFT_RT_TCPMSS,
946 	NFT_RT_XFRM,
947 	__NFT_RT_MAX
948 };
949 #define NFT_RT_MAX		(__NFT_RT_MAX - 1)
950 
951 /**
952  * enum nft_hash_types - nf_tables hash expression types
953  *
954  * @NFT_HASH_JENKINS: Jenkins Hash
955  * @NFT_HASH_SYM: Symmetric Hash
956  */
957 enum nft_hash_types {
958 	NFT_HASH_JENKINS,
959 	NFT_HASH_SYM,
960 };
961 
962 /**
963  * enum nft_hash_attributes - nf_tables hash expression netlink attributes
964  *
965  * @NFTA_HASH_SREG: source register (NLA_U32)
966  * @NFTA_HASH_DREG: destination register (NLA_U32)
967  * @NFTA_HASH_LEN: source data length (NLA_U32)
968  * @NFTA_HASH_MODULUS: modulus value (NLA_U32)
969  * @NFTA_HASH_SEED: seed value (NLA_U32)
970  * @NFTA_HASH_OFFSET: add this offset value to hash result (NLA_U32)
971  * @NFTA_HASH_TYPE: hash operation (NLA_U32: nft_hash_types)
972  * @NFTA_HASH_SET_NAME: name of the map to lookup (NLA_STRING)
973  * @NFTA_HASH_SET_ID: id of the map (NLA_U32)
974  */
975 enum nft_hash_attributes {
976 	NFTA_HASH_UNSPEC,
977 	NFTA_HASH_SREG,
978 	NFTA_HASH_DREG,
979 	NFTA_HASH_LEN,
980 	NFTA_HASH_MODULUS,
981 	NFTA_HASH_SEED,
982 	NFTA_HASH_OFFSET,
983 	NFTA_HASH_TYPE,
984 	NFTA_HASH_SET_NAME,	/* deprecated */
985 	NFTA_HASH_SET_ID,	/* deprecated */
986 	__NFTA_HASH_MAX,
987 };
988 #define NFTA_HASH_MAX	(__NFTA_HASH_MAX - 1)
989 
990 /**
991  * enum nft_meta_attributes - nf_tables meta expression netlink attributes
992  *
993  * @NFTA_META_DREG: destination register (NLA_U32)
994  * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys)
995  * @NFTA_META_SREG: source register (NLA_U32)
996  */
997 enum nft_meta_attributes {
998 	NFTA_META_UNSPEC,
999 	NFTA_META_DREG,
1000 	NFTA_META_KEY,
1001 	NFTA_META_SREG,
1002 	__NFTA_META_MAX
1003 };
1004 #define NFTA_META_MAX		(__NFTA_META_MAX - 1)
1005 
1006 /**
1007  * enum nft_rt_attributes - nf_tables routing expression netlink attributes
1008  *
1009  * @NFTA_RT_DREG: destination register (NLA_U32)
1010  * @NFTA_RT_KEY: routing data item to load (NLA_U32: nft_rt_keys)
1011  */
1012 enum nft_rt_attributes {
1013 	NFTA_RT_UNSPEC,
1014 	NFTA_RT_DREG,
1015 	NFTA_RT_KEY,
1016 	__NFTA_RT_MAX
1017 };
1018 #define NFTA_RT_MAX		(__NFTA_RT_MAX - 1)
1019 
1020 /**
1021  * enum nft_socket_attributes - nf_tables socket expression netlink attributes
1022  *
1023  * @NFTA_SOCKET_KEY: socket key to match
1024  * @NFTA_SOCKET_DREG: destination register
1025  * @NFTA_SOCKET_LEVEL: cgroups2 ancestor level (only for cgroupsv2)
1026  */
1027 enum nft_socket_attributes {
1028 	NFTA_SOCKET_UNSPEC,
1029 	NFTA_SOCKET_KEY,
1030 	NFTA_SOCKET_DREG,
1031 	NFTA_SOCKET_LEVEL,
1032 	__NFTA_SOCKET_MAX
1033 };
1034 #define NFTA_SOCKET_MAX		(__NFTA_SOCKET_MAX - 1)
1035 
1036 /*
1037  * enum nft_socket_keys - nf_tables socket expression keys
1038  *
1039  * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option
1040  * @NFT_SOCKET_MARK: Value of the socket mark
1041  * @NFT_SOCKET_WILDCARD: Whether the socket is zero-bound (e.g. 0.0.0.0 or ::0)
1042  * @NFT_SOCKET_CGROUPV2: Match on cgroups version 2
1043  */
1044 enum nft_socket_keys {
1045 	NFT_SOCKET_TRANSPARENT,
1046 	NFT_SOCKET_MARK,
1047 	NFT_SOCKET_WILDCARD,
1048 	NFT_SOCKET_CGROUPV2,
1049 	__NFT_SOCKET_MAX
1050 };
1051 #define NFT_SOCKET_MAX	(__NFT_SOCKET_MAX - 1)
1052 
1053 /**
1054  * enum nft_ct_keys - nf_tables ct expression keys
1055  *
1056  * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
1057  * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir)
1058  * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status)
1059  * @NFT_CT_MARK: conntrack mark value
1060  * @NFT_CT_SECMARK: conntrack secmark value
1061  * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
1062  * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
1063  * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
1064  * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address, deprecated)
1065  * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address, deprecated)
1066  * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
1067  * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
1068  * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
1069  * @NFT_CT_LABELS: conntrack labels
1070  * @NFT_CT_PKTS: conntrack packets
1071  * @NFT_CT_BYTES: conntrack bytes
1072  * @NFT_CT_AVGPKT: conntrack average bytes per packet
1073  * @NFT_CT_ZONE: conntrack zone
1074  * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack
1075  * @NFT_CT_SRC_IP: conntrack layer 3 protocol source (IPv4 address)
1076  * @NFT_CT_DST_IP: conntrack layer 3 protocol destination (IPv4 address)
1077  * @NFT_CT_SRC_IP6: conntrack layer 3 protocol source (IPv6 address)
1078  * @NFT_CT_DST_IP6: conntrack layer 3 protocol destination (IPv6 address)
1079  * @NFT_CT_ID: conntrack id
1080  */
1081 enum nft_ct_keys {
1082 	NFT_CT_STATE,
1083 	NFT_CT_DIRECTION,
1084 	NFT_CT_STATUS,
1085 	NFT_CT_MARK,
1086 	NFT_CT_SECMARK,
1087 	NFT_CT_EXPIRATION,
1088 	NFT_CT_HELPER,
1089 	NFT_CT_L3PROTOCOL,
1090 	NFT_CT_SRC,
1091 	NFT_CT_DST,
1092 	NFT_CT_PROTOCOL,
1093 	NFT_CT_PROTO_SRC,
1094 	NFT_CT_PROTO_DST,
1095 	NFT_CT_LABELS,
1096 	NFT_CT_PKTS,
1097 	NFT_CT_BYTES,
1098 	NFT_CT_AVGPKT,
1099 	NFT_CT_ZONE,
1100 	NFT_CT_EVENTMASK,
1101 	NFT_CT_SRC_IP,
1102 	NFT_CT_DST_IP,
1103 	NFT_CT_SRC_IP6,
1104 	NFT_CT_DST_IP6,
1105 	NFT_CT_ID,
1106 	__NFT_CT_MAX
1107 };
1108 #define NFT_CT_MAX		(__NFT_CT_MAX - 1)
1109 
1110 /**
1111  * enum nft_ct_attributes - nf_tables ct expression netlink attributes
1112  *
1113  * @NFTA_CT_DREG: destination register (NLA_U32)
1114  * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys)
1115  * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8)
1116  * @NFTA_CT_SREG: source register (NLA_U32)
1117  */
1118 enum nft_ct_attributes {
1119 	NFTA_CT_UNSPEC,
1120 	NFTA_CT_DREG,
1121 	NFTA_CT_KEY,
1122 	NFTA_CT_DIRECTION,
1123 	NFTA_CT_SREG,
1124 	__NFTA_CT_MAX
1125 };
1126 #define NFTA_CT_MAX		(__NFTA_CT_MAX - 1)
1127 
1128 /**
1129  * enum nft_flow_attributes - ct offload expression attributes
1130  * @NFTA_FLOW_TABLE_NAME: flow table name (NLA_STRING)
1131  */
1132 enum nft_offload_attributes {
1133 	NFTA_FLOW_UNSPEC,
1134 	NFTA_FLOW_TABLE_NAME,
1135 	__NFTA_FLOW_MAX,
1136 };
1137 #define NFTA_FLOW_MAX		(__NFTA_FLOW_MAX - 1)
1138 
1139 enum nft_limit_type {
1140 	NFT_LIMIT_PKTS,
1141 	NFT_LIMIT_PKT_BYTES
1142 };
1143 
1144 enum nft_limit_flags {
1145 	NFT_LIMIT_F_INV	= (1 << 0),
1146 };
1147 
1148 /**
1149  * enum nft_limit_attributes - nf_tables limit expression netlink attributes
1150  *
1151  * @NFTA_LIMIT_RATE: refill rate (NLA_U64)
1152  * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
1153  * @NFTA_LIMIT_BURST: burst (NLA_U32)
1154  * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type)
1155  * @NFTA_LIMIT_FLAGS: flags (NLA_U32: enum nft_limit_flags)
1156  */
1157 enum nft_limit_attributes {
1158 	NFTA_LIMIT_UNSPEC,
1159 	NFTA_LIMIT_RATE,
1160 	NFTA_LIMIT_UNIT,
1161 	NFTA_LIMIT_BURST,
1162 	NFTA_LIMIT_TYPE,
1163 	NFTA_LIMIT_FLAGS,
1164 	NFTA_LIMIT_PAD,
1165 	__NFTA_LIMIT_MAX
1166 };
1167 #define NFTA_LIMIT_MAX		(__NFTA_LIMIT_MAX - 1)
1168 
1169 enum nft_connlimit_flags {
1170 	NFT_CONNLIMIT_F_INV	= (1 << 0),
1171 };
1172 
1173 /**
1174  * enum nft_connlimit_attributes - nf_tables connlimit expression netlink attributes
1175  *
1176  * @NFTA_CONNLIMIT_COUNT: number of connections (NLA_U32)
1177  * @NFTA_CONNLIMIT_FLAGS: flags (NLA_U32: enum nft_connlimit_flags)
1178  */
1179 enum nft_connlimit_attributes {
1180 	NFTA_CONNLIMIT_UNSPEC,
1181 	NFTA_CONNLIMIT_COUNT,
1182 	NFTA_CONNLIMIT_FLAGS,
1183 	__NFTA_CONNLIMIT_MAX
1184 };
1185 #define NFTA_CONNLIMIT_MAX	(__NFTA_CONNLIMIT_MAX - 1)
1186 
1187 /**
1188  * enum nft_counter_attributes - nf_tables counter expression netlink attributes
1189  *
1190  * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64)
1191  * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64)
1192  */
1193 enum nft_counter_attributes {
1194 	NFTA_COUNTER_UNSPEC,
1195 	NFTA_COUNTER_BYTES,
1196 	NFTA_COUNTER_PACKETS,
1197 	NFTA_COUNTER_PAD,
1198 	__NFTA_COUNTER_MAX
1199 };
1200 #define NFTA_COUNTER_MAX	(__NFTA_COUNTER_MAX - 1)
1201 
1202 /**
1203  * enum nft_last_attributes - nf_tables last expression netlink attributes
1204  *
1205  * @NFTA_LAST_SET: last update has been set, zero means never updated (NLA_U32)
1206  * @NFTA_LAST_MSECS: milliseconds since last update (NLA_U64)
1207  */
1208 enum nft_last_attributes {
1209 	NFTA_LAST_UNSPEC,
1210 	NFTA_LAST_SET,
1211 	NFTA_LAST_MSECS,
1212 	NFTA_LAST_PAD,
1213 	__NFTA_LAST_MAX
1214 };
1215 #define NFTA_LAST_MAX	(__NFTA_LAST_MAX - 1)
1216 
1217 /**
1218  * enum nft_log_attributes - nf_tables log expression netlink attributes
1219  *
1220  * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32)
1221  * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
1222  * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
1223  * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
1224  * @NFTA_LOG_LEVEL: log level (NLA_U32)
1225  * @NFTA_LOG_FLAGS: logging flags (NLA_U32)
1226  */
1227 enum nft_log_attributes {
1228 	NFTA_LOG_UNSPEC,
1229 	NFTA_LOG_GROUP,
1230 	NFTA_LOG_PREFIX,
1231 	NFTA_LOG_SNAPLEN,
1232 	NFTA_LOG_QTHRESHOLD,
1233 	NFTA_LOG_LEVEL,
1234 	NFTA_LOG_FLAGS,
1235 	__NFTA_LOG_MAX
1236 };
1237 #define NFTA_LOG_MAX		(__NFTA_LOG_MAX - 1)
1238 
1239 /**
1240  * enum nft_log_level - nf_tables log levels
1241  *
1242  * @NFT_LOGLEVEL_EMERG: system is unusable
1243  * @NFT_LOGLEVEL_ALERT: action must be taken immediately
1244  * @NFT_LOGLEVEL_CRIT: critical conditions
1245  * @NFT_LOGLEVEL_ERR: error conditions
1246  * @NFT_LOGLEVEL_WARNING: warning conditions
1247  * @NFT_LOGLEVEL_NOTICE: normal but significant condition
1248  * @NFT_LOGLEVEL_INFO: informational
1249  * @NFT_LOGLEVEL_DEBUG: debug-level messages
1250  * @NFT_LOGLEVEL_AUDIT: enabling audit logging
1251  */
1252 enum nft_log_level {
1253 	NFT_LOGLEVEL_EMERG,
1254 	NFT_LOGLEVEL_ALERT,
1255 	NFT_LOGLEVEL_CRIT,
1256 	NFT_LOGLEVEL_ERR,
1257 	NFT_LOGLEVEL_WARNING,
1258 	NFT_LOGLEVEL_NOTICE,
1259 	NFT_LOGLEVEL_INFO,
1260 	NFT_LOGLEVEL_DEBUG,
1261 	NFT_LOGLEVEL_AUDIT,
1262 	__NFT_LOGLEVEL_MAX
1263 };
1264 #define NFT_LOGLEVEL_MAX	(__NFT_LOGLEVEL_MAX - 1)
1265 
1266 /**
1267  * enum nft_queue_attributes - nf_tables queue expression netlink attributes
1268  *
1269  * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16)
1270  * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16)
1271  * @NFTA_QUEUE_FLAGS: various flags (NLA_U16)
1272  * @NFTA_QUEUE_SREG_QNUM: source register of queue number (NLA_U32: nft_registers)
1273  */
1274 enum nft_queue_attributes {
1275 	NFTA_QUEUE_UNSPEC,
1276 	NFTA_QUEUE_NUM,
1277 	NFTA_QUEUE_TOTAL,
1278 	NFTA_QUEUE_FLAGS,
1279 	NFTA_QUEUE_SREG_QNUM,
1280 	__NFTA_QUEUE_MAX
1281 };
1282 #define NFTA_QUEUE_MAX		(__NFTA_QUEUE_MAX - 1)
1283 
1284 #define NFT_QUEUE_FLAG_BYPASS		0x01 /* for compatibility with v2 */
1285 #define NFT_QUEUE_FLAG_CPU_FANOUT	0x02 /* use current CPU (no hashing) */
1286 #define NFT_QUEUE_FLAG_MASK		0x03
1287 
1288 enum nft_quota_flags {
1289 	NFT_QUOTA_F_INV		= (1 << 0),
1290 	NFT_QUOTA_F_DEPLETED	= (1 << 1),
1291 };
1292 
1293 /**
1294  * enum nft_quota_attributes - nf_tables quota expression netlink attributes
1295  *
1296  * @NFTA_QUOTA_BYTES: quota in bytes (NLA_U16)
1297  * @NFTA_QUOTA_FLAGS: flags (NLA_U32)
1298  * @NFTA_QUOTA_CONSUMED: quota already consumed in bytes (NLA_U64)
1299  */
1300 enum nft_quota_attributes {
1301 	NFTA_QUOTA_UNSPEC,
1302 	NFTA_QUOTA_BYTES,
1303 	NFTA_QUOTA_FLAGS,
1304 	NFTA_QUOTA_PAD,
1305 	NFTA_QUOTA_CONSUMED,
1306 	__NFTA_QUOTA_MAX
1307 };
1308 #define NFTA_QUOTA_MAX		(__NFTA_QUOTA_MAX - 1)
1309 
1310 /**
1311  * enum nft_secmark_attributes - nf_tables secmark object netlink attributes
1312  *
1313  * @NFTA_SECMARK_CTX: security context (NLA_STRING)
1314  */
1315 enum nft_secmark_attributes {
1316 	NFTA_SECMARK_UNSPEC,
1317 	NFTA_SECMARK_CTX,
1318 	__NFTA_SECMARK_MAX,
1319 };
1320 #define NFTA_SECMARK_MAX	(__NFTA_SECMARK_MAX - 1)
1321 
1322 /* Max security context length */
1323 #define NFT_SECMARK_CTX_MAXLEN		256
1324 
1325 /**
1326  * enum nft_reject_types - nf_tables reject expression reject types
1327  *
1328  * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
1329  * @NFT_REJECT_TCP_RST: reject using TCP RST
1330  * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet
1331  */
1332 enum nft_reject_types {
1333 	NFT_REJECT_ICMP_UNREACH,
1334 	NFT_REJECT_TCP_RST,
1335 	NFT_REJECT_ICMPX_UNREACH,
1336 };
1337 
1338 /**
1339  * enum nft_reject_code - Generic reject codes for IPv4/IPv6
1340  *
1341  * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable
1342  * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable
1343  * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable
1344  * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited
1345  *
1346  * These codes are mapped to real ICMP and ICMPv6 codes.
1347  */
1348 enum nft_reject_inet_code {
1349 	NFT_REJECT_ICMPX_NO_ROUTE	= 0,
1350 	NFT_REJECT_ICMPX_PORT_UNREACH,
1351 	NFT_REJECT_ICMPX_HOST_UNREACH,
1352 	NFT_REJECT_ICMPX_ADMIN_PROHIBITED,
1353 	__NFT_REJECT_ICMPX_MAX
1354 };
1355 #define NFT_REJECT_ICMPX_MAX	(__NFT_REJECT_ICMPX_MAX - 1)
1356 
1357 /**
1358  * enum nft_reject_attributes - nf_tables reject expression netlink attributes
1359  *
1360  * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
1361  * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8)
1362  */
1363 enum nft_reject_attributes {
1364 	NFTA_REJECT_UNSPEC,
1365 	NFTA_REJECT_TYPE,
1366 	NFTA_REJECT_ICMP_CODE,
1367 	__NFTA_REJECT_MAX
1368 };
1369 #define NFTA_REJECT_MAX		(__NFTA_REJECT_MAX - 1)
1370 
1371 /**
1372  * enum nft_nat_types - nf_tables nat expression NAT types
1373  *
1374  * @NFT_NAT_SNAT: source NAT
1375  * @NFT_NAT_DNAT: destination NAT
1376  */
1377 enum nft_nat_types {
1378 	NFT_NAT_SNAT,
1379 	NFT_NAT_DNAT,
1380 };
1381 
1382 /**
1383  * enum nft_nat_attributes - nf_tables nat expression netlink attributes
1384  *
1385  * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types)
1386  * @NFTA_NAT_FAMILY: NAT family (NLA_U32)
1387  * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers)
1388  * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
1389  * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
1390  * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
1391  * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
1392  */
1393 enum nft_nat_attributes {
1394 	NFTA_NAT_UNSPEC,
1395 	NFTA_NAT_TYPE,
1396 	NFTA_NAT_FAMILY,
1397 	NFTA_NAT_REG_ADDR_MIN,
1398 	NFTA_NAT_REG_ADDR_MAX,
1399 	NFTA_NAT_REG_PROTO_MIN,
1400 	NFTA_NAT_REG_PROTO_MAX,
1401 	NFTA_NAT_FLAGS,
1402 	__NFTA_NAT_MAX
1403 };
1404 #define NFTA_NAT_MAX		(__NFTA_NAT_MAX - 1)
1405 
1406 /**
1407  * enum nft_tproxy_attributes - nf_tables tproxy expression netlink attributes
1408  *
1409  * NFTA_TPROXY_FAMILY: Target address family (NLA_U32: nft_registers)
1410  * NFTA_TPROXY_REG_ADDR: Target address register (NLA_U32: nft_registers)
1411  * NFTA_TPROXY_REG_PORT: Target port register (NLA_U32: nft_registers)
1412  */
1413 enum nft_tproxy_attributes {
1414 	NFTA_TPROXY_UNSPEC,
1415 	NFTA_TPROXY_FAMILY,
1416 	NFTA_TPROXY_REG_ADDR,
1417 	NFTA_TPROXY_REG_PORT,
1418 	__NFTA_TPROXY_MAX
1419 };
1420 #define NFTA_TPROXY_MAX		(__NFTA_TPROXY_MAX - 1)
1421 
1422 /**
1423  * enum nft_masq_attributes - nf_tables masquerade expression attributes
1424  *
1425  * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
1426  * @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
1427  * @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
1428  */
1429 enum nft_masq_attributes {
1430 	NFTA_MASQ_UNSPEC,
1431 	NFTA_MASQ_FLAGS,
1432 	NFTA_MASQ_REG_PROTO_MIN,
1433 	NFTA_MASQ_REG_PROTO_MAX,
1434 	__NFTA_MASQ_MAX
1435 };
1436 #define NFTA_MASQ_MAX		(__NFTA_MASQ_MAX - 1)
1437 
1438 /**
1439  * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
1440  *
1441  * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
1442  * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
1443  * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
1444  */
1445 enum nft_redir_attributes {
1446 	NFTA_REDIR_UNSPEC,
1447 	NFTA_REDIR_REG_PROTO_MIN,
1448 	NFTA_REDIR_REG_PROTO_MAX,
1449 	NFTA_REDIR_FLAGS,
1450 	__NFTA_REDIR_MAX
1451 };
1452 #define NFTA_REDIR_MAX		(__NFTA_REDIR_MAX - 1)
1453 
1454 /**
1455  * enum nft_dup_attributes - nf_tables dup expression netlink attributes
1456  *
1457  * @NFTA_DUP_SREG_ADDR: source register of address (NLA_U32: nft_registers)
1458  * @NFTA_DUP_SREG_DEV: source register of output interface (NLA_U32: nft_register)
1459  */
1460 enum nft_dup_attributes {
1461 	NFTA_DUP_UNSPEC,
1462 	NFTA_DUP_SREG_ADDR,
1463 	NFTA_DUP_SREG_DEV,
1464 	__NFTA_DUP_MAX
1465 };
1466 #define NFTA_DUP_MAX		(__NFTA_DUP_MAX - 1)
1467 
1468 /**
1469  * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes
1470  *
1471  * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register)
1472  * @NFTA_FWD_SREG_ADDR: source register of destination address (NLA_U32: nft_register)
1473  * @NFTA_FWD_NFPROTO: layer 3 family of source register address (NLA_U32: enum nfproto)
1474  */
1475 enum nft_fwd_attributes {
1476 	NFTA_FWD_UNSPEC,
1477 	NFTA_FWD_SREG_DEV,
1478 	NFTA_FWD_SREG_ADDR,
1479 	NFTA_FWD_NFPROTO,
1480 	__NFTA_FWD_MAX
1481 };
1482 #define NFTA_FWD_MAX	(__NFTA_FWD_MAX - 1)
1483 
1484 /**
1485  * enum nft_objref_attributes - nf_tables stateful object expression netlink attributes
1486  *
1487  * @NFTA_OBJREF_IMM_TYPE: object type for immediate reference (NLA_U32: nft_register)
1488  * @NFTA_OBJREF_IMM_NAME: object name for immediate reference (NLA_STRING)
1489  * @NFTA_OBJREF_SET_SREG: source register of the data to look for (NLA_U32: nft_registers)
1490  * @NFTA_OBJREF_SET_NAME: name of the set where to look for (NLA_STRING)
1491  * @NFTA_OBJREF_SET_ID: id of the set where to look for in this transaction (NLA_U32)
1492  */
1493 enum nft_objref_attributes {
1494 	NFTA_OBJREF_UNSPEC,
1495 	NFTA_OBJREF_IMM_TYPE,
1496 	NFTA_OBJREF_IMM_NAME,
1497 	NFTA_OBJREF_SET_SREG,
1498 	NFTA_OBJREF_SET_NAME,
1499 	NFTA_OBJREF_SET_ID,
1500 	__NFTA_OBJREF_MAX
1501 };
1502 #define NFTA_OBJREF_MAX	(__NFTA_OBJREF_MAX - 1)
1503 
1504 /**
1505  * enum nft_gen_attributes - nf_tables ruleset generation attributes
1506  *
1507  * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
1508  */
1509 enum nft_gen_attributes {
1510 	NFTA_GEN_UNSPEC,
1511 	NFTA_GEN_ID,
1512 	NFTA_GEN_PROC_PID,
1513 	NFTA_GEN_PROC_NAME,
1514 	__NFTA_GEN_MAX
1515 };
1516 #define NFTA_GEN_MAX		(__NFTA_GEN_MAX - 1)
1517 
1518 /*
1519  * enum nft_fib_attributes - nf_tables fib expression netlink attributes
1520  *
1521  * @NFTA_FIB_DREG: destination register (NLA_U32)
1522  * @NFTA_FIB_RESULT: desired result (NLA_U32)
1523  * @NFTA_FIB_FLAGS: flowi fields to initialize when querying the FIB (NLA_U32)
1524  *
1525  * The FIB expression performs a route lookup according
1526  * to the packet data.
1527  */
1528 enum nft_fib_attributes {
1529 	NFTA_FIB_UNSPEC,
1530 	NFTA_FIB_DREG,
1531 	NFTA_FIB_RESULT,
1532 	NFTA_FIB_FLAGS,
1533 	__NFTA_FIB_MAX
1534 };
1535 #define NFTA_FIB_MAX (__NFTA_FIB_MAX - 1)
1536 
1537 enum nft_fib_result {
1538 	NFT_FIB_RESULT_UNSPEC,
1539 	NFT_FIB_RESULT_OIF,
1540 	NFT_FIB_RESULT_OIFNAME,
1541 	NFT_FIB_RESULT_ADDRTYPE,
1542 	__NFT_FIB_RESULT_MAX
1543 };
1544 #define NFT_FIB_RESULT_MAX	(__NFT_FIB_RESULT_MAX - 1)
1545 
1546 enum nft_fib_flags {
1547 	NFTA_FIB_F_SADDR	= 1 << 0,	/* look up src */
1548 	NFTA_FIB_F_DADDR	= 1 << 1,	/* look up dst */
1549 	NFTA_FIB_F_MARK		= 1 << 2,	/* use skb->mark */
1550 	NFTA_FIB_F_IIF		= 1 << 3,	/* restrict to iif */
1551 	NFTA_FIB_F_OIF		= 1 << 4,	/* restrict to oif */
1552 	NFTA_FIB_F_PRESENT	= 1 << 5,	/* check existence only */
1553 };
1554 
1555 enum nft_ct_helper_attributes {
1556 	NFTA_CT_HELPER_UNSPEC,
1557 	NFTA_CT_HELPER_NAME,
1558 	NFTA_CT_HELPER_L3PROTO,
1559 	NFTA_CT_HELPER_L4PROTO,
1560 	__NFTA_CT_HELPER_MAX,
1561 };
1562 #define NFTA_CT_HELPER_MAX	(__NFTA_CT_HELPER_MAX - 1)
1563 
1564 enum nft_ct_timeout_timeout_attributes {
1565 	NFTA_CT_TIMEOUT_UNSPEC,
1566 	NFTA_CT_TIMEOUT_L3PROTO,
1567 	NFTA_CT_TIMEOUT_L4PROTO,
1568 	NFTA_CT_TIMEOUT_DATA,
1569 	__NFTA_CT_TIMEOUT_MAX,
1570 };
1571 #define NFTA_CT_TIMEOUT_MAX	(__NFTA_CT_TIMEOUT_MAX - 1)
1572 
1573 enum nft_ct_expectation_attributes {
1574 	NFTA_CT_EXPECT_UNSPEC,
1575 	NFTA_CT_EXPECT_L3PROTO,
1576 	NFTA_CT_EXPECT_L4PROTO,
1577 	NFTA_CT_EXPECT_DPORT,
1578 	NFTA_CT_EXPECT_TIMEOUT,
1579 	NFTA_CT_EXPECT_SIZE,
1580 	__NFTA_CT_EXPECT_MAX,
1581 };
1582 #define NFTA_CT_EXPECT_MAX	(__NFTA_CT_EXPECT_MAX - 1)
1583 
1584 #define NFT_OBJECT_UNSPEC	0
1585 #define NFT_OBJECT_COUNTER	1
1586 #define NFT_OBJECT_QUOTA	2
1587 #define NFT_OBJECT_CT_HELPER	3
1588 #define NFT_OBJECT_LIMIT	4
1589 #define NFT_OBJECT_CONNLIMIT	5
1590 #define NFT_OBJECT_TUNNEL	6
1591 #define NFT_OBJECT_CT_TIMEOUT	7
1592 #define NFT_OBJECT_SECMARK	8
1593 #define NFT_OBJECT_CT_EXPECT	9
1594 #define NFT_OBJECT_SYNPROXY	10
1595 #define __NFT_OBJECT_MAX	11
1596 #define NFT_OBJECT_MAX		(__NFT_OBJECT_MAX - 1)
1597 
1598 /**
1599  * enum nft_object_attributes - nf_tables stateful object netlink attributes
1600  *
1601  * @NFTA_OBJ_TABLE: name of the table containing the expression (NLA_STRING)
1602  * @NFTA_OBJ_NAME: name of this expression type (NLA_STRING)
1603  * @NFTA_OBJ_TYPE: stateful object type (NLA_U32)
1604  * @NFTA_OBJ_DATA: stateful object data (NLA_NESTED)
1605  * @NFTA_OBJ_USE: number of references to this expression (NLA_U32)
1606  * @NFTA_OBJ_HANDLE: object handle (NLA_U64)
1607  * @NFTA_OBJ_USERDATA: user data (NLA_BINARY)
1608  */
1609 enum nft_object_attributes {
1610 	NFTA_OBJ_UNSPEC,
1611 	NFTA_OBJ_TABLE,
1612 	NFTA_OBJ_NAME,
1613 	NFTA_OBJ_TYPE,
1614 	NFTA_OBJ_DATA,
1615 	NFTA_OBJ_USE,
1616 	NFTA_OBJ_HANDLE,
1617 	NFTA_OBJ_PAD,
1618 	NFTA_OBJ_USERDATA,
1619 	__NFTA_OBJ_MAX
1620 };
1621 #define NFTA_OBJ_MAX		(__NFTA_OBJ_MAX - 1)
1622 
1623 /**
1624  * enum nft_flowtable_flags - nf_tables flowtable flags
1625  *
1626  * @NFT_FLOWTABLE_HW_OFFLOAD: flowtable hardware offload is enabled
1627  * @NFT_FLOWTABLE_COUNTER: enable flow counters
1628  */
1629 enum nft_flowtable_flags {
1630 	NFT_FLOWTABLE_HW_OFFLOAD	= 0x1,
1631 	NFT_FLOWTABLE_COUNTER		= 0x2,
1632 	NFT_FLOWTABLE_MASK		= (NFT_FLOWTABLE_HW_OFFLOAD |
1633 					   NFT_FLOWTABLE_COUNTER)
1634 };
1635 
1636 /**
1637  * enum nft_flowtable_attributes - nf_tables flow table netlink attributes
1638  *
1639  * @NFTA_FLOWTABLE_TABLE: name of the table containing the expression (NLA_STRING)
1640  * @NFTA_FLOWTABLE_NAME: name of this flow table (NLA_STRING)
1641  * @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32)
1642  * @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32)
1643  * @NFTA_FLOWTABLE_HANDLE: object handle (NLA_U64)
1644  * @NFTA_FLOWTABLE_FLAGS: flags (NLA_U32)
1645  */
1646 enum nft_flowtable_attributes {
1647 	NFTA_FLOWTABLE_UNSPEC,
1648 	NFTA_FLOWTABLE_TABLE,
1649 	NFTA_FLOWTABLE_NAME,
1650 	NFTA_FLOWTABLE_HOOK,
1651 	NFTA_FLOWTABLE_USE,
1652 	NFTA_FLOWTABLE_HANDLE,
1653 	NFTA_FLOWTABLE_PAD,
1654 	NFTA_FLOWTABLE_FLAGS,
1655 	__NFTA_FLOWTABLE_MAX
1656 };
1657 #define NFTA_FLOWTABLE_MAX	(__NFTA_FLOWTABLE_MAX - 1)
1658 
1659 /**
1660  * enum nft_flowtable_hook_attributes - nf_tables flow table hook netlink attributes
1661  *
1662  * @NFTA_FLOWTABLE_HOOK_NUM: netfilter hook number (NLA_U32)
1663  * @NFTA_FLOWTABLE_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
1664  * @NFTA_FLOWTABLE_HOOK_DEVS: input devices this flow table is bound to (NLA_NESTED)
1665  */
1666 enum nft_flowtable_hook_attributes {
1667 	NFTA_FLOWTABLE_HOOK_UNSPEC,
1668 	NFTA_FLOWTABLE_HOOK_NUM,
1669 	NFTA_FLOWTABLE_HOOK_PRIORITY,
1670 	NFTA_FLOWTABLE_HOOK_DEVS,
1671 	__NFTA_FLOWTABLE_HOOK_MAX
1672 };
1673 #define NFTA_FLOWTABLE_HOOK_MAX	(__NFTA_FLOWTABLE_HOOK_MAX - 1)
1674 
1675 /**
1676  * enum nft_osf_attributes - nftables osf expression netlink attributes
1677  *
1678  * @NFTA_OSF_DREG: destination register (NLA_U32: nft_registers)
1679  * @NFTA_OSF_TTL: Value of the TTL osf option (NLA_U8)
1680  * @NFTA_OSF_FLAGS: flags (NLA_U32)
1681  */
1682 enum nft_osf_attributes {
1683 	NFTA_OSF_UNSPEC,
1684 	NFTA_OSF_DREG,
1685 	NFTA_OSF_TTL,
1686 	NFTA_OSF_FLAGS,
1687 	__NFTA_OSF_MAX,
1688 };
1689 #define NFTA_OSF_MAX (__NFTA_OSF_MAX - 1)
1690 
1691 enum nft_osf_flags {
1692 	NFT_OSF_F_VERSION = (1 << 0),
1693 };
1694 
1695 /**
1696  * enum nft_synproxy_attributes - nf_tables synproxy expression netlink attributes
1697  *
1698  * @NFTA_SYNPROXY_MSS: mss value sent to the backend (NLA_U16)
1699  * @NFTA_SYNPROXY_WSCALE: wscale value sent to the backend (NLA_U8)
1700  * @NFTA_SYNPROXY_FLAGS: flags (NLA_U32)
1701  */
1702 enum nft_synproxy_attributes {
1703 	NFTA_SYNPROXY_UNSPEC,
1704 	NFTA_SYNPROXY_MSS,
1705 	NFTA_SYNPROXY_WSCALE,
1706 	NFTA_SYNPROXY_FLAGS,
1707 	__NFTA_SYNPROXY_MAX,
1708 };
1709 #define NFTA_SYNPROXY_MAX (__NFTA_SYNPROXY_MAX - 1)
1710 
1711 /**
1712  * enum nft_device_attributes - nf_tables device netlink attributes
1713  *
1714  * @NFTA_DEVICE_NAME: name of this device (NLA_STRING)
1715  */
1716 enum nft_devices_attributes {
1717 	NFTA_DEVICE_UNSPEC,
1718 	NFTA_DEVICE_NAME,
1719 	__NFTA_DEVICE_MAX
1720 };
1721 #define NFTA_DEVICE_MAX		(__NFTA_DEVICE_MAX - 1)
1722 
1723 /*
1724  * enum nft_xfrm_attributes - nf_tables xfrm expr netlink attributes
1725  *
1726  * @NFTA_XFRM_DREG: destination register (NLA_U32)
1727  * @NFTA_XFRM_KEY: enum nft_xfrm_keys (NLA_U32)
1728  * @NFTA_XFRM_DIR: direction (NLA_U8)
1729  * @NFTA_XFRM_SPNUM: index in secpath array (NLA_U32)
1730  */
1731 enum nft_xfrm_attributes {
1732 	NFTA_XFRM_UNSPEC,
1733 	NFTA_XFRM_DREG,
1734 	NFTA_XFRM_KEY,
1735 	NFTA_XFRM_DIR,
1736 	NFTA_XFRM_SPNUM,
1737 	__NFTA_XFRM_MAX
1738 };
1739 #define NFTA_XFRM_MAX (__NFTA_XFRM_MAX - 1)
1740 
1741 enum nft_xfrm_keys {
1742 	NFT_XFRM_KEY_UNSPEC,
1743 	NFT_XFRM_KEY_DADDR_IP4,
1744 	NFT_XFRM_KEY_DADDR_IP6,
1745 	NFT_XFRM_KEY_SADDR_IP4,
1746 	NFT_XFRM_KEY_SADDR_IP6,
1747 	NFT_XFRM_KEY_REQID,
1748 	NFT_XFRM_KEY_SPI,
1749 	__NFT_XFRM_KEY_MAX,
1750 };
1751 #define NFT_XFRM_KEY_MAX (__NFT_XFRM_KEY_MAX - 1)
1752 
1753 /**
1754  * enum nft_trace_attributes - nf_tables trace netlink attributes
1755  *
1756  * @NFTA_TRACE_TABLE: name of the table (NLA_STRING)
1757  * @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING)
1758  * @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64)
1759  * @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types)
1760  * @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts)
1761  * @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32)
1762  * @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY)
1763  * @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY)
1764  * @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY)
1765  * @NFTA_TRACE_IIF: indev ifindex (NLA_U32)
1766  * @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16)
1767  * @NFTA_TRACE_OIF: outdev ifindex (NLA_U32)
1768  * @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16)
1769  * @NFTA_TRACE_MARK: nfmark (NLA_U32)
1770  * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32)
1771  * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32)
1772  */
1773 enum nft_trace_attributes {
1774 	NFTA_TRACE_UNSPEC,
1775 	NFTA_TRACE_TABLE,
1776 	NFTA_TRACE_CHAIN,
1777 	NFTA_TRACE_RULE_HANDLE,
1778 	NFTA_TRACE_TYPE,
1779 	NFTA_TRACE_VERDICT,
1780 	NFTA_TRACE_ID,
1781 	NFTA_TRACE_LL_HEADER,
1782 	NFTA_TRACE_NETWORK_HEADER,
1783 	NFTA_TRACE_TRANSPORT_HEADER,
1784 	NFTA_TRACE_IIF,
1785 	NFTA_TRACE_IIFTYPE,
1786 	NFTA_TRACE_OIF,
1787 	NFTA_TRACE_OIFTYPE,
1788 	NFTA_TRACE_MARK,
1789 	NFTA_TRACE_NFPROTO,
1790 	NFTA_TRACE_POLICY,
1791 	NFTA_TRACE_PAD,
1792 	__NFTA_TRACE_MAX
1793 };
1794 #define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)
1795 
1796 enum nft_trace_types {
1797 	NFT_TRACETYPE_UNSPEC,
1798 	NFT_TRACETYPE_POLICY,
1799 	NFT_TRACETYPE_RETURN,
1800 	NFT_TRACETYPE_RULE,
1801 	__NFT_TRACETYPE_MAX
1802 };
1803 #define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1)
1804 
1805 /**
1806  * enum nft_ng_attributes - nf_tables number generator expression netlink attributes
1807  *
1808  * @NFTA_NG_DREG: destination register (NLA_U32)
1809  * @NFTA_NG_MODULUS: maximum counter value (NLA_U32)
1810  * @NFTA_NG_TYPE: operation type (NLA_U32)
1811  * @NFTA_NG_OFFSET: offset to be added to the counter (NLA_U32)
1812  * @NFTA_NG_SET_NAME: name of the map to lookup (NLA_STRING)
1813  * @NFTA_NG_SET_ID: id of the map (NLA_U32)
1814  */
1815 enum nft_ng_attributes {
1816 	NFTA_NG_UNSPEC,
1817 	NFTA_NG_DREG,
1818 	NFTA_NG_MODULUS,
1819 	NFTA_NG_TYPE,
1820 	NFTA_NG_OFFSET,
1821 	NFTA_NG_SET_NAME,	/* deprecated */
1822 	NFTA_NG_SET_ID,		/* deprecated */
1823 	__NFTA_NG_MAX
1824 };
1825 #define NFTA_NG_MAX	(__NFTA_NG_MAX - 1)
1826 
1827 enum nft_ng_types {
1828 	NFT_NG_INCREMENTAL,
1829 	NFT_NG_RANDOM,
1830 	__NFT_NG_MAX
1831 };
1832 #define NFT_NG_MAX	(__NFT_NG_MAX - 1)
1833 
1834 enum nft_tunnel_key_ip_attributes {
1835 	NFTA_TUNNEL_KEY_IP_UNSPEC,
1836 	NFTA_TUNNEL_KEY_IP_SRC,
1837 	NFTA_TUNNEL_KEY_IP_DST,
1838 	__NFTA_TUNNEL_KEY_IP_MAX
1839 };
1840 #define NFTA_TUNNEL_KEY_IP_MAX	(__NFTA_TUNNEL_KEY_IP_MAX - 1)
1841 
1842 enum nft_tunnel_ip6_attributes {
1843 	NFTA_TUNNEL_KEY_IP6_UNSPEC,
1844 	NFTA_TUNNEL_KEY_IP6_SRC,
1845 	NFTA_TUNNEL_KEY_IP6_DST,
1846 	NFTA_TUNNEL_KEY_IP6_FLOWLABEL,
1847 	__NFTA_TUNNEL_KEY_IP6_MAX
1848 };
1849 #define NFTA_TUNNEL_KEY_IP6_MAX	(__NFTA_TUNNEL_KEY_IP6_MAX - 1)
1850 
1851 enum nft_tunnel_opts_attributes {
1852 	NFTA_TUNNEL_KEY_OPTS_UNSPEC,
1853 	NFTA_TUNNEL_KEY_OPTS_VXLAN,
1854 	NFTA_TUNNEL_KEY_OPTS_ERSPAN,
1855 	NFTA_TUNNEL_KEY_OPTS_GENEVE,
1856 	__NFTA_TUNNEL_KEY_OPTS_MAX
1857 };
1858 #define NFTA_TUNNEL_KEY_OPTS_MAX	(__NFTA_TUNNEL_KEY_OPTS_MAX - 1)
1859 
1860 enum nft_tunnel_opts_vxlan_attributes {
1861 	NFTA_TUNNEL_KEY_VXLAN_UNSPEC,
1862 	NFTA_TUNNEL_KEY_VXLAN_GBP,
1863 	__NFTA_TUNNEL_KEY_VXLAN_MAX
1864 };
1865 #define NFTA_TUNNEL_KEY_VXLAN_MAX	(__NFTA_TUNNEL_KEY_VXLAN_MAX - 1)
1866 
1867 enum nft_tunnel_opts_erspan_attributes {
1868 	NFTA_TUNNEL_KEY_ERSPAN_UNSPEC,
1869 	NFTA_TUNNEL_KEY_ERSPAN_VERSION,
1870 	NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX,
1871 	NFTA_TUNNEL_KEY_ERSPAN_V2_HWID,
1872 	NFTA_TUNNEL_KEY_ERSPAN_V2_DIR,
1873 	__NFTA_TUNNEL_KEY_ERSPAN_MAX
1874 };
1875 #define NFTA_TUNNEL_KEY_ERSPAN_MAX	(__NFTA_TUNNEL_KEY_ERSPAN_MAX - 1)
1876 
1877 enum nft_tunnel_opts_geneve_attributes {
1878 	NFTA_TUNNEL_KEY_GENEVE_UNSPEC,
1879 	NFTA_TUNNEL_KEY_GENEVE_CLASS,
1880 	NFTA_TUNNEL_KEY_GENEVE_TYPE,
1881 	NFTA_TUNNEL_KEY_GENEVE_DATA,
1882 	__NFTA_TUNNEL_KEY_GENEVE_MAX
1883 };
1884 #define NFTA_TUNNEL_KEY_GENEVE_MAX	(__NFTA_TUNNEL_KEY_GENEVE_MAX - 1)
1885 
1886 enum nft_tunnel_flags {
1887 	NFT_TUNNEL_F_ZERO_CSUM_TX	= (1 << 0),
1888 	NFT_TUNNEL_F_DONT_FRAGMENT	= (1 << 1),
1889 	NFT_TUNNEL_F_SEQ_NUMBER		= (1 << 2),
1890 };
1891 #define NFT_TUNNEL_F_MASK	(NFT_TUNNEL_F_ZERO_CSUM_TX | \
1892 				 NFT_TUNNEL_F_DONT_FRAGMENT | \
1893 				 NFT_TUNNEL_F_SEQ_NUMBER)
1894 
1895 enum nft_tunnel_key_attributes {
1896 	NFTA_TUNNEL_KEY_UNSPEC,
1897 	NFTA_TUNNEL_KEY_ID,
1898 	NFTA_TUNNEL_KEY_IP,
1899 	NFTA_TUNNEL_KEY_IP6,
1900 	NFTA_TUNNEL_KEY_FLAGS,
1901 	NFTA_TUNNEL_KEY_TOS,
1902 	NFTA_TUNNEL_KEY_TTL,
1903 	NFTA_TUNNEL_KEY_SPORT,
1904 	NFTA_TUNNEL_KEY_DPORT,
1905 	NFTA_TUNNEL_KEY_OPTS,
1906 	__NFTA_TUNNEL_KEY_MAX
1907 };
1908 #define NFTA_TUNNEL_KEY_MAX	(__NFTA_TUNNEL_KEY_MAX - 1)
1909 
1910 enum nft_tunnel_keys {
1911 	NFT_TUNNEL_PATH,
1912 	NFT_TUNNEL_ID,
1913 	__NFT_TUNNEL_MAX
1914 };
1915 #define NFT_TUNNEL_MAX	(__NFT_TUNNEL_MAX - 1)
1916 
1917 enum nft_tunnel_mode {
1918 	NFT_TUNNEL_MODE_NONE,
1919 	NFT_TUNNEL_MODE_RX,
1920 	NFT_TUNNEL_MODE_TX,
1921 	__NFT_TUNNEL_MODE_MAX
1922 };
1923 #define NFT_TUNNEL_MODE_MAX	(__NFT_TUNNEL_MODE_MAX - 1)
1924 
1925 enum nft_tunnel_attributes {
1926 	NFTA_TUNNEL_UNSPEC,
1927 	NFTA_TUNNEL_KEY,
1928 	NFTA_TUNNEL_DREG,
1929 	NFTA_TUNNEL_MODE,
1930 	__NFTA_TUNNEL_MAX
1931 };
1932 #define NFTA_TUNNEL_MAX	(__NFTA_TUNNEL_MAX - 1)
1933 
1934 #endif /* _LINUX_NF_TABLES_H */
1935