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