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  */
757 enum nft_payload_bases {
758 	NFT_PAYLOAD_LL_HEADER,
759 	NFT_PAYLOAD_NETWORK_HEADER,
760 	NFT_PAYLOAD_TRANSPORT_HEADER,
761 };
762 
763 /**
764  * enum nft_payload_csum_types - nf_tables payload expression checksum types
765  *
766  * @NFT_PAYLOAD_CSUM_NONE: no checksumming
767  * @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791)
768  * @NFT_PAYLOAD_CSUM_SCTP: CRC-32c, for use in SCTP header (RFC 3309)
769  */
770 enum nft_payload_csum_types {
771 	NFT_PAYLOAD_CSUM_NONE,
772 	NFT_PAYLOAD_CSUM_INET,
773 	NFT_PAYLOAD_CSUM_SCTP,
774 };
775 
776 enum nft_payload_csum_flags {
777 	NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0),
778 };
779 
780 /**
781  * enum nft_payload_attributes - nf_tables payload expression netlink attributes
782  *
783  * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
784  * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
785  * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
786  * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
787  * @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers)
788  * @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32)
789  * @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32)
790  * @NFTA_PAYLOAD_CSUM_FLAGS: checksum flags (NLA_U32)
791  */
792 enum nft_payload_attributes {
793 	NFTA_PAYLOAD_UNSPEC,
794 	NFTA_PAYLOAD_DREG,
795 	NFTA_PAYLOAD_BASE,
796 	NFTA_PAYLOAD_OFFSET,
797 	NFTA_PAYLOAD_LEN,
798 	NFTA_PAYLOAD_SREG,
799 	NFTA_PAYLOAD_CSUM_TYPE,
800 	NFTA_PAYLOAD_CSUM_OFFSET,
801 	NFTA_PAYLOAD_CSUM_FLAGS,
802 	__NFTA_PAYLOAD_MAX
803 };
804 #define NFTA_PAYLOAD_MAX	(__NFTA_PAYLOAD_MAX - 1)
805 
806 enum nft_exthdr_flags {
807 	NFT_EXTHDR_F_PRESENT = (1 << 0),
808 };
809 
810 /**
811  * enum nft_exthdr_op - nf_tables match options
812  *
813  * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers
814  * @NFT_EXTHDR_OP_TCP: match against tcp options
815  * @NFT_EXTHDR_OP_IPV4: match against ipv4 options
816  * @NFT_EXTHDR_OP_SCTP: match against sctp chunks
817  */
818 enum nft_exthdr_op {
819 	NFT_EXTHDR_OP_IPV6,
820 	NFT_EXTHDR_OP_TCPOPT,
821 	NFT_EXTHDR_OP_IPV4,
822 	NFT_EXTHDR_OP_SCTP,
823 	__NFT_EXTHDR_OP_MAX
824 };
825 #define NFT_EXTHDR_OP_MAX	(__NFT_EXTHDR_OP_MAX - 1)
826 
827 /**
828  * enum nft_exthdr_attributes - nf_tables extension header expression netlink attributes
829  *
830  * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers)
831  * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8)
832  * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32)
833  * @NFTA_EXTHDR_LEN: extension header length (NLA_U32)
834  * @NFTA_EXTHDR_FLAGS: extension header flags (NLA_U32)
835  * @NFTA_EXTHDR_OP: option match type (NLA_U32)
836  * @NFTA_EXTHDR_SREG: option match type (NLA_U32)
837  */
838 enum nft_exthdr_attributes {
839 	NFTA_EXTHDR_UNSPEC,
840 	NFTA_EXTHDR_DREG,
841 	NFTA_EXTHDR_TYPE,
842 	NFTA_EXTHDR_OFFSET,
843 	NFTA_EXTHDR_LEN,
844 	NFTA_EXTHDR_FLAGS,
845 	NFTA_EXTHDR_OP,
846 	NFTA_EXTHDR_SREG,
847 	__NFTA_EXTHDR_MAX
848 };
849 #define NFTA_EXTHDR_MAX		(__NFTA_EXTHDR_MAX - 1)
850 
851 /**
852  * enum nft_meta_keys - nf_tables meta expression keys
853  *
854  * @NFT_META_LEN: packet length (skb->len)
855  * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT
856  * @NFT_META_PRIORITY: packet priority (skb->priority)
857  * @NFT_META_MARK: packet mark (skb->mark)
858  * @NFT_META_IIF: packet input interface index (dev->ifindex)
859  * @NFT_META_OIF: packet output interface index (dev->ifindex)
860  * @NFT_META_IIFNAME: packet input interface name (dev->name)
861  * @NFT_META_OIFNAME: packet output interface name (dev->name)
862  * @NFT_META_IIFTYPE: packet input interface type (dev->type)
863  * @NFT_META_OIFTYPE: packet output interface type (dev->type)
864  * @NFT_META_SKUID: originating socket UID (fsuid)
865  * @NFT_META_SKGID: originating socket GID (fsgid)
866  * @NFT_META_NFTRACE: packet nftrace bit
867  * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid)
868  * @NFT_META_SECMARK: packet secmark (skb->secmark)
869  * @NFT_META_NFPROTO: netfilter protocol
870  * @NFT_META_L4PROTO: layer 4 protocol number
871  * @NFT_META_BRI_IIFNAME: packet input bridge interface name
872  * @NFT_META_BRI_OIFNAME: packet output bridge interface name
873  * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
874  * @NFT_META_CPU: cpu id through smp_processor_id()
875  * @NFT_META_IIFGROUP: packet input interface group
876  * @NFT_META_OIFGROUP: packet output interface group
877  * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
878  * @NFT_META_PRANDOM: a 32bit pseudo-random number
879  * @NFT_META_SECPATH: boolean, secpath_exists (!!skb->sp)
880  * @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind)
881  * @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind)
882  * @NFT_META_BRI_IIFPVID: packet input bridge port pvid
883  * @NFT_META_BRI_IIFVPROTO: packet input bridge vlan proto
884  * @NFT_META_TIME_NS: time since epoch (in nanoseconds)
885  * @NFT_META_TIME_DAY: day of week (from 0 = Sunday to 6 = Saturday)
886  * @NFT_META_TIME_HOUR: hour of day (in seconds)
887  * @NFT_META_SDIF: slave device interface index
888  * @NFT_META_SDIFNAME: slave device interface name
889  */
890 enum nft_meta_keys {
891 	NFT_META_LEN,
892 	NFT_META_PROTOCOL,
893 	NFT_META_PRIORITY,
894 	NFT_META_MARK,
895 	NFT_META_IIF,
896 	NFT_META_OIF,
897 	NFT_META_IIFNAME,
898 	NFT_META_OIFNAME,
899 	NFT_META_IIFTYPE,
900 	NFT_META_OIFTYPE,
901 	NFT_META_SKUID,
902 	NFT_META_SKGID,
903 	NFT_META_NFTRACE,
904 	NFT_META_RTCLASSID,
905 	NFT_META_SECMARK,
906 	NFT_META_NFPROTO,
907 	NFT_META_L4PROTO,
908 	NFT_META_BRI_IIFNAME,
909 	NFT_META_BRI_OIFNAME,
910 	NFT_META_PKTTYPE,
911 	NFT_META_CPU,
912 	NFT_META_IIFGROUP,
913 	NFT_META_OIFGROUP,
914 	NFT_META_CGROUP,
915 	NFT_META_PRANDOM,
916 	NFT_META_SECPATH,
917 	NFT_META_IIFKIND,
918 	NFT_META_OIFKIND,
919 	NFT_META_BRI_IIFPVID,
920 	NFT_META_BRI_IIFVPROTO,
921 	NFT_META_TIME_NS,
922 	NFT_META_TIME_DAY,
923 	NFT_META_TIME_HOUR,
924 	NFT_META_SDIF,
925 	NFT_META_SDIFNAME,
926 };
927 
928 /**
929  * enum nft_rt_keys - nf_tables routing expression keys
930  *
931  * @NFT_RT_CLASSID: realm value of packet's route (skb->dst->tclassid)
932  * @NFT_RT_NEXTHOP4: routing nexthop for IPv4
933  * @NFT_RT_NEXTHOP6: routing nexthop for IPv6
934  * @NFT_RT_TCPMSS: fetch current path tcp mss
935  * @NFT_RT_XFRM: boolean, skb->dst->xfrm != NULL
936  */
937 enum nft_rt_keys {
938 	NFT_RT_CLASSID,
939 	NFT_RT_NEXTHOP4,
940 	NFT_RT_NEXTHOP6,
941 	NFT_RT_TCPMSS,
942 	NFT_RT_XFRM,
943 	__NFT_RT_MAX
944 };
945 #define NFT_RT_MAX		(__NFT_RT_MAX - 1)
946 
947 /**
948  * enum nft_hash_types - nf_tables hash expression types
949  *
950  * @NFT_HASH_JENKINS: Jenkins Hash
951  * @NFT_HASH_SYM: Symmetric Hash
952  */
953 enum nft_hash_types {
954 	NFT_HASH_JENKINS,
955 	NFT_HASH_SYM,
956 };
957 
958 /**
959  * enum nft_hash_attributes - nf_tables hash expression netlink attributes
960  *
961  * @NFTA_HASH_SREG: source register (NLA_U32)
962  * @NFTA_HASH_DREG: destination register (NLA_U32)
963  * @NFTA_HASH_LEN: source data length (NLA_U32)
964  * @NFTA_HASH_MODULUS: modulus value (NLA_U32)
965  * @NFTA_HASH_SEED: seed value (NLA_U32)
966  * @NFTA_HASH_OFFSET: add this offset value to hash result (NLA_U32)
967  * @NFTA_HASH_TYPE: hash operation (NLA_U32: nft_hash_types)
968  * @NFTA_HASH_SET_NAME: name of the map to lookup (NLA_STRING)
969  * @NFTA_HASH_SET_ID: id of the map (NLA_U32)
970  */
971 enum nft_hash_attributes {
972 	NFTA_HASH_UNSPEC,
973 	NFTA_HASH_SREG,
974 	NFTA_HASH_DREG,
975 	NFTA_HASH_LEN,
976 	NFTA_HASH_MODULUS,
977 	NFTA_HASH_SEED,
978 	NFTA_HASH_OFFSET,
979 	NFTA_HASH_TYPE,
980 	NFTA_HASH_SET_NAME,	/* deprecated */
981 	NFTA_HASH_SET_ID,	/* deprecated */
982 	__NFTA_HASH_MAX,
983 };
984 #define NFTA_HASH_MAX	(__NFTA_HASH_MAX - 1)
985 
986 /**
987  * enum nft_meta_attributes - nf_tables meta expression netlink attributes
988  *
989  * @NFTA_META_DREG: destination register (NLA_U32)
990  * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys)
991  * @NFTA_META_SREG: source register (NLA_U32)
992  */
993 enum nft_meta_attributes {
994 	NFTA_META_UNSPEC,
995 	NFTA_META_DREG,
996 	NFTA_META_KEY,
997 	NFTA_META_SREG,
998 	__NFTA_META_MAX
999 };
1000 #define NFTA_META_MAX		(__NFTA_META_MAX - 1)
1001 
1002 /**
1003  * enum nft_rt_attributes - nf_tables routing expression netlink attributes
1004  *
1005  * @NFTA_RT_DREG: destination register (NLA_U32)
1006  * @NFTA_RT_KEY: routing data item to load (NLA_U32: nft_rt_keys)
1007  */
1008 enum nft_rt_attributes {
1009 	NFTA_RT_UNSPEC,
1010 	NFTA_RT_DREG,
1011 	NFTA_RT_KEY,
1012 	__NFTA_RT_MAX
1013 };
1014 #define NFTA_RT_MAX		(__NFTA_RT_MAX - 1)
1015 
1016 /**
1017  * enum nft_socket_attributes - nf_tables socket expression netlink attributes
1018  *
1019  * @NFTA_SOCKET_KEY: socket key to match
1020  * @NFTA_SOCKET_DREG: destination register
1021  * @NFTA_SOCKET_LEVEL: cgroups2 ancestor level (only for cgroupsv2)
1022  */
1023 enum nft_socket_attributes {
1024 	NFTA_SOCKET_UNSPEC,
1025 	NFTA_SOCKET_KEY,
1026 	NFTA_SOCKET_DREG,
1027 	NFTA_SOCKET_LEVEL,
1028 	__NFTA_SOCKET_MAX
1029 };
1030 #define NFTA_SOCKET_MAX		(__NFTA_SOCKET_MAX - 1)
1031 
1032 /*
1033  * enum nft_socket_keys - nf_tables socket expression keys
1034  *
1035  * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option
1036  * @NFT_SOCKET_MARK: Value of the socket mark
1037  * @NFT_SOCKET_WILDCARD: Whether the socket is zero-bound (e.g. 0.0.0.0 or ::0)
1038  * @NFT_SOCKET_CGROUPV2: Match on cgroups version 2
1039  */
1040 enum nft_socket_keys {
1041 	NFT_SOCKET_TRANSPARENT,
1042 	NFT_SOCKET_MARK,
1043 	NFT_SOCKET_WILDCARD,
1044 	NFT_SOCKET_CGROUPV2,
1045 	__NFT_SOCKET_MAX
1046 };
1047 #define NFT_SOCKET_MAX	(__NFT_SOCKET_MAX - 1)
1048 
1049 /**
1050  * enum nft_ct_keys - nf_tables ct expression keys
1051  *
1052  * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
1053  * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir)
1054  * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status)
1055  * @NFT_CT_MARK: conntrack mark value
1056  * @NFT_CT_SECMARK: conntrack secmark value
1057  * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
1058  * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
1059  * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
1060  * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address, deprecated)
1061  * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address, deprecated)
1062  * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
1063  * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
1064  * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
1065  * @NFT_CT_LABELS: conntrack labels
1066  * @NFT_CT_PKTS: conntrack packets
1067  * @NFT_CT_BYTES: conntrack bytes
1068  * @NFT_CT_AVGPKT: conntrack average bytes per packet
1069  * @NFT_CT_ZONE: conntrack zone
1070  * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack
1071  * @NFT_CT_SRC_IP: conntrack layer 3 protocol source (IPv4 address)
1072  * @NFT_CT_DST_IP: conntrack layer 3 protocol destination (IPv4 address)
1073  * @NFT_CT_SRC_IP6: conntrack layer 3 protocol source (IPv6 address)
1074  * @NFT_CT_DST_IP6: conntrack layer 3 protocol destination (IPv6 address)
1075  * @NFT_CT_ID: conntrack id
1076  */
1077 enum nft_ct_keys {
1078 	NFT_CT_STATE,
1079 	NFT_CT_DIRECTION,
1080 	NFT_CT_STATUS,
1081 	NFT_CT_MARK,
1082 	NFT_CT_SECMARK,
1083 	NFT_CT_EXPIRATION,
1084 	NFT_CT_HELPER,
1085 	NFT_CT_L3PROTOCOL,
1086 	NFT_CT_SRC,
1087 	NFT_CT_DST,
1088 	NFT_CT_PROTOCOL,
1089 	NFT_CT_PROTO_SRC,
1090 	NFT_CT_PROTO_DST,
1091 	NFT_CT_LABELS,
1092 	NFT_CT_PKTS,
1093 	NFT_CT_BYTES,
1094 	NFT_CT_AVGPKT,
1095 	NFT_CT_ZONE,
1096 	NFT_CT_EVENTMASK,
1097 	NFT_CT_SRC_IP,
1098 	NFT_CT_DST_IP,
1099 	NFT_CT_SRC_IP6,
1100 	NFT_CT_DST_IP6,
1101 	NFT_CT_ID,
1102 	__NFT_CT_MAX
1103 };
1104 #define NFT_CT_MAX		(__NFT_CT_MAX - 1)
1105 
1106 /**
1107  * enum nft_ct_attributes - nf_tables ct expression netlink attributes
1108  *
1109  * @NFTA_CT_DREG: destination register (NLA_U32)
1110  * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys)
1111  * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8)
1112  * @NFTA_CT_SREG: source register (NLA_U32)
1113  */
1114 enum nft_ct_attributes {
1115 	NFTA_CT_UNSPEC,
1116 	NFTA_CT_DREG,
1117 	NFTA_CT_KEY,
1118 	NFTA_CT_DIRECTION,
1119 	NFTA_CT_SREG,
1120 	__NFTA_CT_MAX
1121 };
1122 #define NFTA_CT_MAX		(__NFTA_CT_MAX - 1)
1123 
1124 /**
1125  * enum nft_flow_attributes - ct offload expression attributes
1126  * @NFTA_FLOW_TABLE_NAME: flow table name (NLA_STRING)
1127  */
1128 enum nft_offload_attributes {
1129 	NFTA_FLOW_UNSPEC,
1130 	NFTA_FLOW_TABLE_NAME,
1131 	__NFTA_FLOW_MAX,
1132 };
1133 #define NFTA_FLOW_MAX		(__NFTA_FLOW_MAX - 1)
1134 
1135 enum nft_limit_type {
1136 	NFT_LIMIT_PKTS,
1137 	NFT_LIMIT_PKT_BYTES
1138 };
1139 
1140 enum nft_limit_flags {
1141 	NFT_LIMIT_F_INV	= (1 << 0),
1142 };
1143 
1144 /**
1145  * enum nft_limit_attributes - nf_tables limit expression netlink attributes
1146  *
1147  * @NFTA_LIMIT_RATE: refill rate (NLA_U64)
1148  * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
1149  * @NFTA_LIMIT_BURST: burst (NLA_U32)
1150  * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type)
1151  * @NFTA_LIMIT_FLAGS: flags (NLA_U32: enum nft_limit_flags)
1152  */
1153 enum nft_limit_attributes {
1154 	NFTA_LIMIT_UNSPEC,
1155 	NFTA_LIMIT_RATE,
1156 	NFTA_LIMIT_UNIT,
1157 	NFTA_LIMIT_BURST,
1158 	NFTA_LIMIT_TYPE,
1159 	NFTA_LIMIT_FLAGS,
1160 	NFTA_LIMIT_PAD,
1161 	__NFTA_LIMIT_MAX
1162 };
1163 #define NFTA_LIMIT_MAX		(__NFTA_LIMIT_MAX - 1)
1164 
1165 enum nft_connlimit_flags {
1166 	NFT_CONNLIMIT_F_INV	= (1 << 0),
1167 };
1168 
1169 /**
1170  * enum nft_connlimit_attributes - nf_tables connlimit expression netlink attributes
1171  *
1172  * @NFTA_CONNLIMIT_COUNT: number of connections (NLA_U32)
1173  * @NFTA_CONNLIMIT_FLAGS: flags (NLA_U32: enum nft_connlimit_flags)
1174  */
1175 enum nft_connlimit_attributes {
1176 	NFTA_CONNLIMIT_UNSPEC,
1177 	NFTA_CONNLIMIT_COUNT,
1178 	NFTA_CONNLIMIT_FLAGS,
1179 	__NFTA_CONNLIMIT_MAX
1180 };
1181 #define NFTA_CONNLIMIT_MAX	(__NFTA_CONNLIMIT_MAX - 1)
1182 
1183 /**
1184  * enum nft_counter_attributes - nf_tables counter expression netlink attributes
1185  *
1186  * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64)
1187  * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64)
1188  */
1189 enum nft_counter_attributes {
1190 	NFTA_COUNTER_UNSPEC,
1191 	NFTA_COUNTER_BYTES,
1192 	NFTA_COUNTER_PACKETS,
1193 	NFTA_COUNTER_PAD,
1194 	__NFTA_COUNTER_MAX
1195 };
1196 #define NFTA_COUNTER_MAX	(__NFTA_COUNTER_MAX - 1)
1197 
1198 /**
1199  * enum nft_last_attributes - nf_tables last expression netlink attributes
1200  *
1201  * @NFTA_LAST_SET: last update has been set, zero means never updated (NLA_U32)
1202  * @NFTA_LAST_MSECS: milliseconds since last update (NLA_U64)
1203  */
1204 enum nft_last_attributes {
1205 	NFTA_LAST_UNSPEC,
1206 	NFTA_LAST_SET,
1207 	NFTA_LAST_MSECS,
1208 	NFTA_LAST_PAD,
1209 	__NFTA_LAST_MAX
1210 };
1211 #define NFTA_LAST_MAX	(__NFTA_LAST_MAX - 1)
1212 
1213 /**
1214  * enum nft_log_attributes - nf_tables log expression netlink attributes
1215  *
1216  * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32)
1217  * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
1218  * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
1219  * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
1220  * @NFTA_LOG_LEVEL: log level (NLA_U32)
1221  * @NFTA_LOG_FLAGS: logging flags (NLA_U32)
1222  */
1223 enum nft_log_attributes {
1224 	NFTA_LOG_UNSPEC,
1225 	NFTA_LOG_GROUP,
1226 	NFTA_LOG_PREFIX,
1227 	NFTA_LOG_SNAPLEN,
1228 	NFTA_LOG_QTHRESHOLD,
1229 	NFTA_LOG_LEVEL,
1230 	NFTA_LOG_FLAGS,
1231 	__NFTA_LOG_MAX
1232 };
1233 #define NFTA_LOG_MAX		(__NFTA_LOG_MAX - 1)
1234 
1235 /**
1236  * enum nft_log_level - nf_tables log levels
1237  *
1238  * @NFT_LOGLEVEL_EMERG: system is unusable
1239  * @NFT_LOGLEVEL_ALERT: action must be taken immediately
1240  * @NFT_LOGLEVEL_CRIT: critical conditions
1241  * @NFT_LOGLEVEL_ERR: error conditions
1242  * @NFT_LOGLEVEL_WARNING: warning conditions
1243  * @NFT_LOGLEVEL_NOTICE: normal but significant condition
1244  * @NFT_LOGLEVEL_INFO: informational
1245  * @NFT_LOGLEVEL_DEBUG: debug-level messages
1246  * @NFT_LOGLEVEL_AUDIT: enabling audit logging
1247  */
1248 enum nft_log_level {
1249 	NFT_LOGLEVEL_EMERG,
1250 	NFT_LOGLEVEL_ALERT,
1251 	NFT_LOGLEVEL_CRIT,
1252 	NFT_LOGLEVEL_ERR,
1253 	NFT_LOGLEVEL_WARNING,
1254 	NFT_LOGLEVEL_NOTICE,
1255 	NFT_LOGLEVEL_INFO,
1256 	NFT_LOGLEVEL_DEBUG,
1257 	NFT_LOGLEVEL_AUDIT,
1258 	__NFT_LOGLEVEL_MAX
1259 };
1260 #define NFT_LOGLEVEL_MAX	(__NFT_LOGLEVEL_MAX - 1)
1261 
1262 /**
1263  * enum nft_queue_attributes - nf_tables queue expression netlink attributes
1264  *
1265  * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16)
1266  * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16)
1267  * @NFTA_QUEUE_FLAGS: various flags (NLA_U16)
1268  * @NFTA_QUEUE_SREG_QNUM: source register of queue number (NLA_U32: nft_registers)
1269  */
1270 enum nft_queue_attributes {
1271 	NFTA_QUEUE_UNSPEC,
1272 	NFTA_QUEUE_NUM,
1273 	NFTA_QUEUE_TOTAL,
1274 	NFTA_QUEUE_FLAGS,
1275 	NFTA_QUEUE_SREG_QNUM,
1276 	__NFTA_QUEUE_MAX
1277 };
1278 #define NFTA_QUEUE_MAX		(__NFTA_QUEUE_MAX - 1)
1279 
1280 #define NFT_QUEUE_FLAG_BYPASS		0x01 /* for compatibility with v2 */
1281 #define NFT_QUEUE_FLAG_CPU_FANOUT	0x02 /* use current CPU (no hashing) */
1282 #define NFT_QUEUE_FLAG_MASK		0x03
1283 
1284 enum nft_quota_flags {
1285 	NFT_QUOTA_F_INV		= (1 << 0),
1286 	NFT_QUOTA_F_DEPLETED	= (1 << 1),
1287 };
1288 
1289 /**
1290  * enum nft_quota_attributes - nf_tables quota expression netlink attributes
1291  *
1292  * @NFTA_QUOTA_BYTES: quota in bytes (NLA_U16)
1293  * @NFTA_QUOTA_FLAGS: flags (NLA_U32)
1294  * @NFTA_QUOTA_CONSUMED: quota already consumed in bytes (NLA_U64)
1295  */
1296 enum nft_quota_attributes {
1297 	NFTA_QUOTA_UNSPEC,
1298 	NFTA_QUOTA_BYTES,
1299 	NFTA_QUOTA_FLAGS,
1300 	NFTA_QUOTA_PAD,
1301 	NFTA_QUOTA_CONSUMED,
1302 	__NFTA_QUOTA_MAX
1303 };
1304 #define NFTA_QUOTA_MAX		(__NFTA_QUOTA_MAX - 1)
1305 
1306 /**
1307  * enum nft_secmark_attributes - nf_tables secmark object netlink attributes
1308  *
1309  * @NFTA_SECMARK_CTX: security context (NLA_STRING)
1310  */
1311 enum nft_secmark_attributes {
1312 	NFTA_SECMARK_UNSPEC,
1313 	NFTA_SECMARK_CTX,
1314 	__NFTA_SECMARK_MAX,
1315 };
1316 #define NFTA_SECMARK_MAX	(__NFTA_SECMARK_MAX - 1)
1317 
1318 /* Max security context length */
1319 #define NFT_SECMARK_CTX_MAXLEN		256
1320 
1321 /**
1322  * enum nft_reject_types - nf_tables reject expression reject types
1323  *
1324  * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
1325  * @NFT_REJECT_TCP_RST: reject using TCP RST
1326  * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet
1327  */
1328 enum nft_reject_types {
1329 	NFT_REJECT_ICMP_UNREACH,
1330 	NFT_REJECT_TCP_RST,
1331 	NFT_REJECT_ICMPX_UNREACH,
1332 };
1333 
1334 /**
1335  * enum nft_reject_code - Generic reject codes for IPv4/IPv6
1336  *
1337  * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable
1338  * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable
1339  * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable
1340  * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited
1341  *
1342  * These codes are mapped to real ICMP and ICMPv6 codes.
1343  */
1344 enum nft_reject_inet_code {
1345 	NFT_REJECT_ICMPX_NO_ROUTE	= 0,
1346 	NFT_REJECT_ICMPX_PORT_UNREACH,
1347 	NFT_REJECT_ICMPX_HOST_UNREACH,
1348 	NFT_REJECT_ICMPX_ADMIN_PROHIBITED,
1349 	__NFT_REJECT_ICMPX_MAX
1350 };
1351 #define NFT_REJECT_ICMPX_MAX	(__NFT_REJECT_ICMPX_MAX - 1)
1352 
1353 /**
1354  * enum nft_reject_attributes - nf_tables reject expression netlink attributes
1355  *
1356  * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
1357  * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8)
1358  */
1359 enum nft_reject_attributes {
1360 	NFTA_REJECT_UNSPEC,
1361 	NFTA_REJECT_TYPE,
1362 	NFTA_REJECT_ICMP_CODE,
1363 	__NFTA_REJECT_MAX
1364 };
1365 #define NFTA_REJECT_MAX		(__NFTA_REJECT_MAX - 1)
1366 
1367 /**
1368  * enum nft_nat_types - nf_tables nat expression NAT types
1369  *
1370  * @NFT_NAT_SNAT: source NAT
1371  * @NFT_NAT_DNAT: destination NAT
1372  */
1373 enum nft_nat_types {
1374 	NFT_NAT_SNAT,
1375 	NFT_NAT_DNAT,
1376 };
1377 
1378 /**
1379  * enum nft_nat_attributes - nf_tables nat expression netlink attributes
1380  *
1381  * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types)
1382  * @NFTA_NAT_FAMILY: NAT family (NLA_U32)
1383  * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers)
1384  * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
1385  * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
1386  * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
1387  * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
1388  */
1389 enum nft_nat_attributes {
1390 	NFTA_NAT_UNSPEC,
1391 	NFTA_NAT_TYPE,
1392 	NFTA_NAT_FAMILY,
1393 	NFTA_NAT_REG_ADDR_MIN,
1394 	NFTA_NAT_REG_ADDR_MAX,
1395 	NFTA_NAT_REG_PROTO_MIN,
1396 	NFTA_NAT_REG_PROTO_MAX,
1397 	NFTA_NAT_FLAGS,
1398 	__NFTA_NAT_MAX
1399 };
1400 #define NFTA_NAT_MAX		(__NFTA_NAT_MAX - 1)
1401 
1402 /**
1403  * enum nft_tproxy_attributes - nf_tables tproxy expression netlink attributes
1404  *
1405  * NFTA_TPROXY_FAMILY: Target address family (NLA_U32: nft_registers)
1406  * NFTA_TPROXY_REG_ADDR: Target address register (NLA_U32: nft_registers)
1407  * NFTA_TPROXY_REG_PORT: Target port register (NLA_U32: nft_registers)
1408  */
1409 enum nft_tproxy_attributes {
1410 	NFTA_TPROXY_UNSPEC,
1411 	NFTA_TPROXY_FAMILY,
1412 	NFTA_TPROXY_REG_ADDR,
1413 	NFTA_TPROXY_REG_PORT,
1414 	__NFTA_TPROXY_MAX
1415 };
1416 #define NFTA_TPROXY_MAX		(__NFTA_TPROXY_MAX - 1)
1417 
1418 /**
1419  * enum nft_masq_attributes - nf_tables masquerade expression attributes
1420  *
1421  * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
1422  * @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
1423  * @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
1424  */
1425 enum nft_masq_attributes {
1426 	NFTA_MASQ_UNSPEC,
1427 	NFTA_MASQ_FLAGS,
1428 	NFTA_MASQ_REG_PROTO_MIN,
1429 	NFTA_MASQ_REG_PROTO_MAX,
1430 	__NFTA_MASQ_MAX
1431 };
1432 #define NFTA_MASQ_MAX		(__NFTA_MASQ_MAX - 1)
1433 
1434 /**
1435  * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
1436  *
1437  * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
1438  * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
1439  * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
1440  */
1441 enum nft_redir_attributes {
1442 	NFTA_REDIR_UNSPEC,
1443 	NFTA_REDIR_REG_PROTO_MIN,
1444 	NFTA_REDIR_REG_PROTO_MAX,
1445 	NFTA_REDIR_FLAGS,
1446 	__NFTA_REDIR_MAX
1447 };
1448 #define NFTA_REDIR_MAX		(__NFTA_REDIR_MAX - 1)
1449 
1450 /**
1451  * enum nft_dup_attributes - nf_tables dup expression netlink attributes
1452  *
1453  * @NFTA_DUP_SREG_ADDR: source register of address (NLA_U32: nft_registers)
1454  * @NFTA_DUP_SREG_DEV: source register of output interface (NLA_U32: nft_register)
1455  */
1456 enum nft_dup_attributes {
1457 	NFTA_DUP_UNSPEC,
1458 	NFTA_DUP_SREG_ADDR,
1459 	NFTA_DUP_SREG_DEV,
1460 	__NFTA_DUP_MAX
1461 };
1462 #define NFTA_DUP_MAX		(__NFTA_DUP_MAX - 1)
1463 
1464 /**
1465  * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes
1466  *
1467  * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register)
1468  * @NFTA_FWD_SREG_ADDR: source register of destination address (NLA_U32: nft_register)
1469  * @NFTA_FWD_NFPROTO: layer 3 family of source register address (NLA_U32: enum nfproto)
1470  */
1471 enum nft_fwd_attributes {
1472 	NFTA_FWD_UNSPEC,
1473 	NFTA_FWD_SREG_DEV,
1474 	NFTA_FWD_SREG_ADDR,
1475 	NFTA_FWD_NFPROTO,
1476 	__NFTA_FWD_MAX
1477 };
1478 #define NFTA_FWD_MAX	(__NFTA_FWD_MAX - 1)
1479 
1480 /**
1481  * enum nft_objref_attributes - nf_tables stateful object expression netlink attributes
1482  *
1483  * @NFTA_OBJREF_IMM_TYPE: object type for immediate reference (NLA_U32: nft_register)
1484  * @NFTA_OBJREF_IMM_NAME: object name for immediate reference (NLA_STRING)
1485  * @NFTA_OBJREF_SET_SREG: source register of the data to look for (NLA_U32: nft_registers)
1486  * @NFTA_OBJREF_SET_NAME: name of the set where to look for (NLA_STRING)
1487  * @NFTA_OBJREF_SET_ID: id of the set where to look for in this transaction (NLA_U32)
1488  */
1489 enum nft_objref_attributes {
1490 	NFTA_OBJREF_UNSPEC,
1491 	NFTA_OBJREF_IMM_TYPE,
1492 	NFTA_OBJREF_IMM_NAME,
1493 	NFTA_OBJREF_SET_SREG,
1494 	NFTA_OBJREF_SET_NAME,
1495 	NFTA_OBJREF_SET_ID,
1496 	__NFTA_OBJREF_MAX
1497 };
1498 #define NFTA_OBJREF_MAX	(__NFTA_OBJREF_MAX - 1)
1499 
1500 /**
1501  * enum nft_gen_attributes - nf_tables ruleset generation attributes
1502  *
1503  * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
1504  */
1505 enum nft_gen_attributes {
1506 	NFTA_GEN_UNSPEC,
1507 	NFTA_GEN_ID,
1508 	NFTA_GEN_PROC_PID,
1509 	NFTA_GEN_PROC_NAME,
1510 	__NFTA_GEN_MAX
1511 };
1512 #define NFTA_GEN_MAX		(__NFTA_GEN_MAX - 1)
1513 
1514 /*
1515  * enum nft_fib_attributes - nf_tables fib expression netlink attributes
1516  *
1517  * @NFTA_FIB_DREG: destination register (NLA_U32)
1518  * @NFTA_FIB_RESULT: desired result (NLA_U32)
1519  * @NFTA_FIB_FLAGS: flowi fields to initialize when querying the FIB (NLA_U32)
1520  *
1521  * The FIB expression performs a route lookup according
1522  * to the packet data.
1523  */
1524 enum nft_fib_attributes {
1525 	NFTA_FIB_UNSPEC,
1526 	NFTA_FIB_DREG,
1527 	NFTA_FIB_RESULT,
1528 	NFTA_FIB_FLAGS,
1529 	__NFTA_FIB_MAX
1530 };
1531 #define NFTA_FIB_MAX (__NFTA_FIB_MAX - 1)
1532 
1533 enum nft_fib_result {
1534 	NFT_FIB_RESULT_UNSPEC,
1535 	NFT_FIB_RESULT_OIF,
1536 	NFT_FIB_RESULT_OIFNAME,
1537 	NFT_FIB_RESULT_ADDRTYPE,
1538 	__NFT_FIB_RESULT_MAX
1539 };
1540 #define NFT_FIB_RESULT_MAX	(__NFT_FIB_RESULT_MAX - 1)
1541 
1542 enum nft_fib_flags {
1543 	NFTA_FIB_F_SADDR	= 1 << 0,	/* look up src */
1544 	NFTA_FIB_F_DADDR	= 1 << 1,	/* look up dst */
1545 	NFTA_FIB_F_MARK		= 1 << 2,	/* use skb->mark */
1546 	NFTA_FIB_F_IIF		= 1 << 3,	/* restrict to iif */
1547 	NFTA_FIB_F_OIF		= 1 << 4,	/* restrict to oif */
1548 	NFTA_FIB_F_PRESENT	= 1 << 5,	/* check existence only */
1549 };
1550 
1551 enum nft_ct_helper_attributes {
1552 	NFTA_CT_HELPER_UNSPEC,
1553 	NFTA_CT_HELPER_NAME,
1554 	NFTA_CT_HELPER_L3PROTO,
1555 	NFTA_CT_HELPER_L4PROTO,
1556 	__NFTA_CT_HELPER_MAX,
1557 };
1558 #define NFTA_CT_HELPER_MAX	(__NFTA_CT_HELPER_MAX - 1)
1559 
1560 enum nft_ct_timeout_timeout_attributes {
1561 	NFTA_CT_TIMEOUT_UNSPEC,
1562 	NFTA_CT_TIMEOUT_L3PROTO,
1563 	NFTA_CT_TIMEOUT_L4PROTO,
1564 	NFTA_CT_TIMEOUT_DATA,
1565 	__NFTA_CT_TIMEOUT_MAX,
1566 };
1567 #define NFTA_CT_TIMEOUT_MAX	(__NFTA_CT_TIMEOUT_MAX - 1)
1568 
1569 enum nft_ct_expectation_attributes {
1570 	NFTA_CT_EXPECT_UNSPEC,
1571 	NFTA_CT_EXPECT_L3PROTO,
1572 	NFTA_CT_EXPECT_L4PROTO,
1573 	NFTA_CT_EXPECT_DPORT,
1574 	NFTA_CT_EXPECT_TIMEOUT,
1575 	NFTA_CT_EXPECT_SIZE,
1576 	__NFTA_CT_EXPECT_MAX,
1577 };
1578 #define NFTA_CT_EXPECT_MAX	(__NFTA_CT_EXPECT_MAX - 1)
1579 
1580 #define NFT_OBJECT_UNSPEC	0
1581 #define NFT_OBJECT_COUNTER	1
1582 #define NFT_OBJECT_QUOTA	2
1583 #define NFT_OBJECT_CT_HELPER	3
1584 #define NFT_OBJECT_LIMIT	4
1585 #define NFT_OBJECT_CONNLIMIT	5
1586 #define NFT_OBJECT_TUNNEL	6
1587 #define NFT_OBJECT_CT_TIMEOUT	7
1588 #define NFT_OBJECT_SECMARK	8
1589 #define NFT_OBJECT_CT_EXPECT	9
1590 #define NFT_OBJECT_SYNPROXY	10
1591 #define __NFT_OBJECT_MAX	11
1592 #define NFT_OBJECT_MAX		(__NFT_OBJECT_MAX - 1)
1593 
1594 /**
1595  * enum nft_object_attributes - nf_tables stateful object netlink attributes
1596  *
1597  * @NFTA_OBJ_TABLE: name of the table containing the expression (NLA_STRING)
1598  * @NFTA_OBJ_NAME: name of this expression type (NLA_STRING)
1599  * @NFTA_OBJ_TYPE: stateful object type (NLA_U32)
1600  * @NFTA_OBJ_DATA: stateful object data (NLA_NESTED)
1601  * @NFTA_OBJ_USE: number of references to this expression (NLA_U32)
1602  * @NFTA_OBJ_HANDLE: object handle (NLA_U64)
1603  * @NFTA_OBJ_USERDATA: user data (NLA_BINARY)
1604  */
1605 enum nft_object_attributes {
1606 	NFTA_OBJ_UNSPEC,
1607 	NFTA_OBJ_TABLE,
1608 	NFTA_OBJ_NAME,
1609 	NFTA_OBJ_TYPE,
1610 	NFTA_OBJ_DATA,
1611 	NFTA_OBJ_USE,
1612 	NFTA_OBJ_HANDLE,
1613 	NFTA_OBJ_PAD,
1614 	NFTA_OBJ_USERDATA,
1615 	__NFTA_OBJ_MAX
1616 };
1617 #define NFTA_OBJ_MAX		(__NFTA_OBJ_MAX - 1)
1618 
1619 /**
1620  * enum nft_flowtable_flags - nf_tables flowtable flags
1621  *
1622  * @NFT_FLOWTABLE_HW_OFFLOAD: flowtable hardware offload is enabled
1623  * @NFT_FLOWTABLE_COUNTER: enable flow counters
1624  */
1625 enum nft_flowtable_flags {
1626 	NFT_FLOWTABLE_HW_OFFLOAD	= 0x1,
1627 	NFT_FLOWTABLE_COUNTER		= 0x2,
1628 	NFT_FLOWTABLE_MASK		= (NFT_FLOWTABLE_HW_OFFLOAD |
1629 					   NFT_FLOWTABLE_COUNTER)
1630 };
1631 
1632 /**
1633  * enum nft_flowtable_attributes - nf_tables flow table netlink attributes
1634  *
1635  * @NFTA_FLOWTABLE_TABLE: name of the table containing the expression (NLA_STRING)
1636  * @NFTA_FLOWTABLE_NAME: name of this flow table (NLA_STRING)
1637  * @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32)
1638  * @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32)
1639  * @NFTA_FLOWTABLE_HANDLE: object handle (NLA_U64)
1640  * @NFTA_FLOWTABLE_FLAGS: flags (NLA_U32)
1641  */
1642 enum nft_flowtable_attributes {
1643 	NFTA_FLOWTABLE_UNSPEC,
1644 	NFTA_FLOWTABLE_TABLE,
1645 	NFTA_FLOWTABLE_NAME,
1646 	NFTA_FLOWTABLE_HOOK,
1647 	NFTA_FLOWTABLE_USE,
1648 	NFTA_FLOWTABLE_HANDLE,
1649 	NFTA_FLOWTABLE_PAD,
1650 	NFTA_FLOWTABLE_FLAGS,
1651 	__NFTA_FLOWTABLE_MAX
1652 };
1653 #define NFTA_FLOWTABLE_MAX	(__NFTA_FLOWTABLE_MAX - 1)
1654 
1655 /**
1656  * enum nft_flowtable_hook_attributes - nf_tables flow table hook netlink attributes
1657  *
1658  * @NFTA_FLOWTABLE_HOOK_NUM: netfilter hook number (NLA_U32)
1659  * @NFTA_FLOWTABLE_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
1660  * @NFTA_FLOWTABLE_HOOK_DEVS: input devices this flow table is bound to (NLA_NESTED)
1661  */
1662 enum nft_flowtable_hook_attributes {
1663 	NFTA_FLOWTABLE_HOOK_UNSPEC,
1664 	NFTA_FLOWTABLE_HOOK_NUM,
1665 	NFTA_FLOWTABLE_HOOK_PRIORITY,
1666 	NFTA_FLOWTABLE_HOOK_DEVS,
1667 	__NFTA_FLOWTABLE_HOOK_MAX
1668 };
1669 #define NFTA_FLOWTABLE_HOOK_MAX	(__NFTA_FLOWTABLE_HOOK_MAX - 1)
1670 
1671 /**
1672  * enum nft_osf_attributes - nftables osf expression netlink attributes
1673  *
1674  * @NFTA_OSF_DREG: destination register (NLA_U32: nft_registers)
1675  * @NFTA_OSF_TTL: Value of the TTL osf option (NLA_U8)
1676  * @NFTA_OSF_FLAGS: flags (NLA_U32)
1677  */
1678 enum nft_osf_attributes {
1679 	NFTA_OSF_UNSPEC,
1680 	NFTA_OSF_DREG,
1681 	NFTA_OSF_TTL,
1682 	NFTA_OSF_FLAGS,
1683 	__NFTA_OSF_MAX,
1684 };
1685 #define NFTA_OSF_MAX (__NFTA_OSF_MAX - 1)
1686 
1687 enum nft_osf_flags {
1688 	NFT_OSF_F_VERSION = (1 << 0),
1689 };
1690 
1691 /**
1692  * enum nft_synproxy_attributes - nf_tables synproxy expression netlink attributes
1693  *
1694  * @NFTA_SYNPROXY_MSS: mss value sent to the backend (NLA_U16)
1695  * @NFTA_SYNPROXY_WSCALE: wscale value sent to the backend (NLA_U8)
1696  * @NFTA_SYNPROXY_FLAGS: flags (NLA_U32)
1697  */
1698 enum nft_synproxy_attributes {
1699 	NFTA_SYNPROXY_UNSPEC,
1700 	NFTA_SYNPROXY_MSS,
1701 	NFTA_SYNPROXY_WSCALE,
1702 	NFTA_SYNPROXY_FLAGS,
1703 	__NFTA_SYNPROXY_MAX,
1704 };
1705 #define NFTA_SYNPROXY_MAX (__NFTA_SYNPROXY_MAX - 1)
1706 
1707 /**
1708  * enum nft_device_attributes - nf_tables device netlink attributes
1709  *
1710  * @NFTA_DEVICE_NAME: name of this device (NLA_STRING)
1711  */
1712 enum nft_devices_attributes {
1713 	NFTA_DEVICE_UNSPEC,
1714 	NFTA_DEVICE_NAME,
1715 	__NFTA_DEVICE_MAX
1716 };
1717 #define NFTA_DEVICE_MAX		(__NFTA_DEVICE_MAX - 1)
1718 
1719 /*
1720  * enum nft_xfrm_attributes - nf_tables xfrm expr netlink attributes
1721  *
1722  * @NFTA_XFRM_DREG: destination register (NLA_U32)
1723  * @NFTA_XFRM_KEY: enum nft_xfrm_keys (NLA_U32)
1724  * @NFTA_XFRM_DIR: direction (NLA_U8)
1725  * @NFTA_XFRM_SPNUM: index in secpath array (NLA_U32)
1726  */
1727 enum nft_xfrm_attributes {
1728 	NFTA_XFRM_UNSPEC,
1729 	NFTA_XFRM_DREG,
1730 	NFTA_XFRM_KEY,
1731 	NFTA_XFRM_DIR,
1732 	NFTA_XFRM_SPNUM,
1733 	__NFTA_XFRM_MAX
1734 };
1735 #define NFTA_XFRM_MAX (__NFTA_XFRM_MAX - 1)
1736 
1737 enum nft_xfrm_keys {
1738 	NFT_XFRM_KEY_UNSPEC,
1739 	NFT_XFRM_KEY_DADDR_IP4,
1740 	NFT_XFRM_KEY_DADDR_IP6,
1741 	NFT_XFRM_KEY_SADDR_IP4,
1742 	NFT_XFRM_KEY_SADDR_IP6,
1743 	NFT_XFRM_KEY_REQID,
1744 	NFT_XFRM_KEY_SPI,
1745 	__NFT_XFRM_KEY_MAX,
1746 };
1747 #define NFT_XFRM_KEY_MAX (__NFT_XFRM_KEY_MAX - 1)
1748 
1749 /**
1750  * enum nft_trace_attributes - nf_tables trace netlink attributes
1751  *
1752  * @NFTA_TRACE_TABLE: name of the table (NLA_STRING)
1753  * @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING)
1754  * @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64)
1755  * @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types)
1756  * @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts)
1757  * @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32)
1758  * @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY)
1759  * @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY)
1760  * @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY)
1761  * @NFTA_TRACE_IIF: indev ifindex (NLA_U32)
1762  * @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16)
1763  * @NFTA_TRACE_OIF: outdev ifindex (NLA_U32)
1764  * @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16)
1765  * @NFTA_TRACE_MARK: nfmark (NLA_U32)
1766  * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32)
1767  * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32)
1768  */
1769 enum nft_trace_attributes {
1770 	NFTA_TRACE_UNSPEC,
1771 	NFTA_TRACE_TABLE,
1772 	NFTA_TRACE_CHAIN,
1773 	NFTA_TRACE_RULE_HANDLE,
1774 	NFTA_TRACE_TYPE,
1775 	NFTA_TRACE_VERDICT,
1776 	NFTA_TRACE_ID,
1777 	NFTA_TRACE_LL_HEADER,
1778 	NFTA_TRACE_NETWORK_HEADER,
1779 	NFTA_TRACE_TRANSPORT_HEADER,
1780 	NFTA_TRACE_IIF,
1781 	NFTA_TRACE_IIFTYPE,
1782 	NFTA_TRACE_OIF,
1783 	NFTA_TRACE_OIFTYPE,
1784 	NFTA_TRACE_MARK,
1785 	NFTA_TRACE_NFPROTO,
1786 	NFTA_TRACE_POLICY,
1787 	NFTA_TRACE_PAD,
1788 	__NFTA_TRACE_MAX
1789 };
1790 #define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)
1791 
1792 enum nft_trace_types {
1793 	NFT_TRACETYPE_UNSPEC,
1794 	NFT_TRACETYPE_POLICY,
1795 	NFT_TRACETYPE_RETURN,
1796 	NFT_TRACETYPE_RULE,
1797 	__NFT_TRACETYPE_MAX
1798 };
1799 #define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1)
1800 
1801 /**
1802  * enum nft_ng_attributes - nf_tables number generator expression netlink attributes
1803  *
1804  * @NFTA_NG_DREG: destination register (NLA_U32)
1805  * @NFTA_NG_MODULUS: maximum counter value (NLA_U32)
1806  * @NFTA_NG_TYPE: operation type (NLA_U32)
1807  * @NFTA_NG_OFFSET: offset to be added to the counter (NLA_U32)
1808  * @NFTA_NG_SET_NAME: name of the map to lookup (NLA_STRING)
1809  * @NFTA_NG_SET_ID: id of the map (NLA_U32)
1810  */
1811 enum nft_ng_attributes {
1812 	NFTA_NG_UNSPEC,
1813 	NFTA_NG_DREG,
1814 	NFTA_NG_MODULUS,
1815 	NFTA_NG_TYPE,
1816 	NFTA_NG_OFFSET,
1817 	NFTA_NG_SET_NAME,	/* deprecated */
1818 	NFTA_NG_SET_ID,		/* deprecated */
1819 	__NFTA_NG_MAX
1820 };
1821 #define NFTA_NG_MAX	(__NFTA_NG_MAX - 1)
1822 
1823 enum nft_ng_types {
1824 	NFT_NG_INCREMENTAL,
1825 	NFT_NG_RANDOM,
1826 	__NFT_NG_MAX
1827 };
1828 #define NFT_NG_MAX	(__NFT_NG_MAX - 1)
1829 
1830 enum nft_tunnel_key_ip_attributes {
1831 	NFTA_TUNNEL_KEY_IP_UNSPEC,
1832 	NFTA_TUNNEL_KEY_IP_SRC,
1833 	NFTA_TUNNEL_KEY_IP_DST,
1834 	__NFTA_TUNNEL_KEY_IP_MAX
1835 };
1836 #define NFTA_TUNNEL_KEY_IP_MAX	(__NFTA_TUNNEL_KEY_IP_MAX - 1)
1837 
1838 enum nft_tunnel_ip6_attributes {
1839 	NFTA_TUNNEL_KEY_IP6_UNSPEC,
1840 	NFTA_TUNNEL_KEY_IP6_SRC,
1841 	NFTA_TUNNEL_KEY_IP6_DST,
1842 	NFTA_TUNNEL_KEY_IP6_FLOWLABEL,
1843 	__NFTA_TUNNEL_KEY_IP6_MAX
1844 };
1845 #define NFTA_TUNNEL_KEY_IP6_MAX	(__NFTA_TUNNEL_KEY_IP6_MAX - 1)
1846 
1847 enum nft_tunnel_opts_attributes {
1848 	NFTA_TUNNEL_KEY_OPTS_UNSPEC,
1849 	NFTA_TUNNEL_KEY_OPTS_VXLAN,
1850 	NFTA_TUNNEL_KEY_OPTS_ERSPAN,
1851 	NFTA_TUNNEL_KEY_OPTS_GENEVE,
1852 	__NFTA_TUNNEL_KEY_OPTS_MAX
1853 };
1854 #define NFTA_TUNNEL_KEY_OPTS_MAX	(__NFTA_TUNNEL_KEY_OPTS_MAX - 1)
1855 
1856 enum nft_tunnel_opts_vxlan_attributes {
1857 	NFTA_TUNNEL_KEY_VXLAN_UNSPEC,
1858 	NFTA_TUNNEL_KEY_VXLAN_GBP,
1859 	__NFTA_TUNNEL_KEY_VXLAN_MAX
1860 };
1861 #define NFTA_TUNNEL_KEY_VXLAN_MAX	(__NFTA_TUNNEL_KEY_VXLAN_MAX - 1)
1862 
1863 enum nft_tunnel_opts_erspan_attributes {
1864 	NFTA_TUNNEL_KEY_ERSPAN_UNSPEC,
1865 	NFTA_TUNNEL_KEY_ERSPAN_VERSION,
1866 	NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX,
1867 	NFTA_TUNNEL_KEY_ERSPAN_V2_HWID,
1868 	NFTA_TUNNEL_KEY_ERSPAN_V2_DIR,
1869 	__NFTA_TUNNEL_KEY_ERSPAN_MAX
1870 };
1871 #define NFTA_TUNNEL_KEY_ERSPAN_MAX	(__NFTA_TUNNEL_KEY_ERSPAN_MAX - 1)
1872 
1873 enum nft_tunnel_opts_geneve_attributes {
1874 	NFTA_TUNNEL_KEY_GENEVE_UNSPEC,
1875 	NFTA_TUNNEL_KEY_GENEVE_CLASS,
1876 	NFTA_TUNNEL_KEY_GENEVE_TYPE,
1877 	NFTA_TUNNEL_KEY_GENEVE_DATA,
1878 	__NFTA_TUNNEL_KEY_GENEVE_MAX
1879 };
1880 #define NFTA_TUNNEL_KEY_GENEVE_MAX	(__NFTA_TUNNEL_KEY_GENEVE_MAX - 1)
1881 
1882 enum nft_tunnel_flags {
1883 	NFT_TUNNEL_F_ZERO_CSUM_TX	= (1 << 0),
1884 	NFT_TUNNEL_F_DONT_FRAGMENT	= (1 << 1),
1885 	NFT_TUNNEL_F_SEQ_NUMBER		= (1 << 2),
1886 };
1887 #define NFT_TUNNEL_F_MASK	(NFT_TUNNEL_F_ZERO_CSUM_TX | \
1888 				 NFT_TUNNEL_F_DONT_FRAGMENT | \
1889 				 NFT_TUNNEL_F_SEQ_NUMBER)
1890 
1891 enum nft_tunnel_key_attributes {
1892 	NFTA_TUNNEL_KEY_UNSPEC,
1893 	NFTA_TUNNEL_KEY_ID,
1894 	NFTA_TUNNEL_KEY_IP,
1895 	NFTA_TUNNEL_KEY_IP6,
1896 	NFTA_TUNNEL_KEY_FLAGS,
1897 	NFTA_TUNNEL_KEY_TOS,
1898 	NFTA_TUNNEL_KEY_TTL,
1899 	NFTA_TUNNEL_KEY_SPORT,
1900 	NFTA_TUNNEL_KEY_DPORT,
1901 	NFTA_TUNNEL_KEY_OPTS,
1902 	__NFTA_TUNNEL_KEY_MAX
1903 };
1904 #define NFTA_TUNNEL_KEY_MAX	(__NFTA_TUNNEL_KEY_MAX - 1)
1905 
1906 enum nft_tunnel_keys {
1907 	NFT_TUNNEL_PATH,
1908 	NFT_TUNNEL_ID,
1909 	__NFT_TUNNEL_MAX
1910 };
1911 #define NFT_TUNNEL_MAX	(__NFT_TUNNEL_MAX - 1)
1912 
1913 enum nft_tunnel_mode {
1914 	NFT_TUNNEL_MODE_NONE,
1915 	NFT_TUNNEL_MODE_RX,
1916 	NFT_TUNNEL_MODE_TX,
1917 	__NFT_TUNNEL_MODE_MAX
1918 };
1919 #define NFT_TUNNEL_MODE_MAX	(__NFT_TUNNEL_MODE_MAX - 1)
1920 
1921 enum nft_tunnel_attributes {
1922 	NFTA_TUNNEL_UNSPEC,
1923 	NFTA_TUNNEL_KEY,
1924 	NFTA_TUNNEL_DREG,
1925 	NFTA_TUNNEL_MODE,
1926 	__NFTA_TUNNEL_MAX
1927 };
1928 #define NFTA_TUNNEL_MAX	(__NFTA_TUNNEL_MAX - 1)
1929 
1930 #endif /* _LINUX_NF_TABLES_H */
1931