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