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