1 #ifndef _LINUX_NF_TABLES_H
2 #define _LINUX_NF_TABLES_H
4 #define NFT_TABLE_MAXNAMELEN 32
5 #define NFT_CHAIN_MAXNAMELEN 32
6 #define NFT_SET_MAXNAMELEN 32
7 #define NFT_USERDATA_MAXLEN 256
10 * enum nft_registers - nf_tables registers
12 * nf_tables used to have five registers: a verdict register and four data
13 * registers of size 16. The data registers have been changed to 16 registers
14 * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still
15 * map to areas of size 16, the 4 byte registers are addressed using
16 * NFT_REG32_00 - NFT_REG32_15.
43 #define NFT_REG_MAX (__NFT_REG_MAX - 1)
45 #define NFT_REG_SIZE 16
46 #define NFT_REG32_SIZE 4
49 * enum nft_verdicts - nf_tables internal verdicts
51 * @NFT_CONTINUE: continue evaluation of the current rule
52 * @NFT_BREAK: terminate evaluation of the current rule
53 * @NFT_JUMP: push the current chain on the jump stack and jump to a chain
54 * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack
55 * @NFT_RETURN: return to the topmost chain on the jump stack
57 * The nf_tables verdicts share their numeric space with the netfilter verdicts.
68 * enum nf_tables_msg_types - nf_tables netlink message types
70 * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes)
71 * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes)
72 * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes)
73 * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes)
74 * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes)
75 * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes)
76 * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes)
77 * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes)
78 * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes)
79 * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes)
80 * @NFT_MSG_GETSET: get a set (enum nft_set_attributes)
81 * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes)
82 * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes)
83 * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes)
84 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
85 * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes)
86 * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes)
87 * @NFT_MSG_TRACE: trace event (enum nft_trace_attributes)
89 enum nf_tables_msg_types {
112 * enum nft_list_attributes - nf_tables generic list netlink attributes
114 * @NFTA_LIST_ELEM: list element (NLA_NESTED)
116 enum nft_list_attributes {
121 #define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1)
124 * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes
126 * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32)
127 * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
128 * @NFTA_HOOK_DEV: netdevice name (NLA_STRING)
130 enum nft_hook_attributes {
137 #define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1)
140 * enum nft_table_flags - nf_tables table flags
142 * @NFT_TABLE_F_DORMANT: this table is not active
144 enum nft_table_flags {
145 NFT_TABLE_F_DORMANT = 0x1,
149 * enum nft_table_attributes - nf_tables table netlink attributes
151 * @NFTA_TABLE_NAME: name of the table (NLA_STRING)
152 * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32)
153 * @NFTA_TABLE_USE: number of chains in this table (NLA_U32)
155 enum nft_table_attributes {
162 #define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1)
165 * enum nft_chain_attributes - nf_tables chain netlink attributes
167 * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING)
168 * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64)
169 * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING)
170 * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes)
171 * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32)
172 * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32)
173 * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING)
174 * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes)
176 enum nft_chain_attributes {
189 #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
192 * enum nft_rule_attributes - nf_tables rule netlink attributes
194 * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING)
195 * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING)
196 * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64)
197 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
198 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
199 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
200 * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN)
202 enum nft_rule_attributes {
207 NFTA_RULE_EXPRESSIONS,
214 #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
217 * enum nft_rule_compat_flags - nf_tables rule compat flags
219 * @NFT_RULE_COMPAT_F_INV: invert the check result
221 enum nft_rule_compat_flags {
222 NFT_RULE_COMPAT_F_INV = (1 << 1),
223 NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
227 * enum nft_rule_compat_attributes - nf_tables rule compat attributes
229 * @NFTA_RULE_COMPAT_PROTO: numerice value of handled protocol (NLA_U32)
230 * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32)
232 enum nft_rule_compat_attributes {
233 NFTA_RULE_COMPAT_UNSPEC,
234 NFTA_RULE_COMPAT_PROTO,
235 NFTA_RULE_COMPAT_FLAGS,
236 __NFTA_RULE_COMPAT_MAX
238 #define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1)
241 * enum nft_set_flags - nf_tables set flags
243 * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink
244 * @NFT_SET_CONSTANT: set contents may not change while bound
245 * @NFT_SET_INTERVAL: set contains intervals
246 * @NFT_SET_MAP: set is used as a dictionary
247 * @NFT_SET_TIMEOUT: set uses timeouts
248 * @NFT_SET_EVAL: set contains expressions for evaluation
251 NFT_SET_ANONYMOUS = 0x1,
252 NFT_SET_CONSTANT = 0x2,
253 NFT_SET_INTERVAL = 0x4,
255 NFT_SET_TIMEOUT = 0x10,
260 * enum nft_set_policies - set selection policy
262 * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use
263 * @NFT_SET_POL_MEMORY: prefer low memory use over high performance
265 enum nft_set_policies {
266 NFT_SET_POL_PERFORMANCE,
271 * enum nft_set_desc_attributes - set element description
273 * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32)
275 enum nft_set_desc_attributes {
276 NFTA_SET_DESC_UNSPEC,
280 #define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1)
283 * enum nft_set_attributes - nf_tables set netlink attributes
285 * @NFTA_SET_TABLE: table name (NLA_STRING)
286 * @NFTA_SET_NAME: set name (NLA_STRING)
287 * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32)
288 * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32)
289 * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
290 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
291 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
292 * @NFTA_SET_POLICY: selection policy (NLA_U32)
293 * @NFTA_SET_DESC: set description (NLA_NESTED)
294 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
295 * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64)
296 * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32)
297 * @NFTA_SET_USERDATA: user data (NLA_BINARY)
299 enum nft_set_attributes {
312 NFTA_SET_GC_INTERVAL,
317 #define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
320 * enum nft_set_elem_flags - nf_tables set element flags
322 * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval
324 enum nft_set_elem_flags {
325 NFT_SET_ELEM_INTERVAL_END = 0x1,
329 * enum nft_set_elem_attributes - nf_tables set element netlink attributes
331 * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
332 * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
333 * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
334 * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64)
335 * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64)
336 * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY)
337 * @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes)
339 enum nft_set_elem_attributes {
340 NFTA_SET_ELEM_UNSPEC,
344 NFTA_SET_ELEM_TIMEOUT,
345 NFTA_SET_ELEM_EXPIRATION,
346 NFTA_SET_ELEM_USERDATA,
351 #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
354 * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes
356 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
357 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
358 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
359 * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
361 enum nft_set_elem_list_attributes {
362 NFTA_SET_ELEM_LIST_UNSPEC,
363 NFTA_SET_ELEM_LIST_TABLE,
364 NFTA_SET_ELEM_LIST_SET,
365 NFTA_SET_ELEM_LIST_ELEMENTS,
366 NFTA_SET_ELEM_LIST_SET_ID,
367 __NFTA_SET_ELEM_LIST_MAX
369 #define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
372 * enum nft_data_types - nf_tables data types
374 * @NFT_DATA_VALUE: generic data
375 * @NFT_DATA_VERDICT: netfilter verdict
377 * The type of data is usually determined by the kernel directly and is not
378 * explicitly specified by userspace. The only difference are sets, where
379 * userspace specifies the key and mapping data types.
381 * The values 0xffffff00-0xffffffff are reserved for internally used types.
382 * The remaining range can be freely used by userspace to encode types, all
383 * values are equivalent to NFT_DATA_VALUE.
385 enum nft_data_types {
387 NFT_DATA_VERDICT = 0xffffff00U,
390 #define NFT_DATA_RESERVED_MASK 0xffffff00U
393 * enum nft_data_attributes - nf_tables data netlink attributes
395 * @NFTA_DATA_VALUE: generic data (NLA_BINARY)
396 * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes)
398 enum nft_data_attributes {
404 #define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1)
406 /* Maximum length of a value */
407 #define NFT_DATA_VALUE_MAXLEN 64
410 * enum nft_verdict_attributes - nf_tables verdict netlink attributes
412 * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts)
413 * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING)
415 enum nft_verdict_attributes {
421 #define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1)
424 * enum nft_expr_attributes - nf_tables expression netlink attributes
426 * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING)
427 * @NFTA_EXPR_DATA: type specific data (NLA_NESTED)
429 enum nft_expr_attributes {
435 #define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1)
438 * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes
440 * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32)
441 * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes)
443 enum nft_immediate_attributes {
444 NFTA_IMMEDIATE_UNSPEC,
449 #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1)
452 * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes
454 * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers)
455 * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers)
456 * @NFTA_BITWISE_LEN: length of operands (NLA_U32)
457 * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes)
458 * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes)
460 * The bitwise expression performs the following operation:
462 * dreg = (sreg & mask) ^ xor
464 * which allow to express all bitwise operations:
472 enum nft_bitwise_attributes {
481 #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
484 * enum nft_byteorder_ops - nf_tables byteorder operators
486 * @NFT_BYTEORDER_NTOH: network to host operator
487 * @NFT_BYTEORDER_HTON: host to network opertaor
489 enum nft_byteorder_ops {
495 * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes
497 * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers)
498 * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers)
499 * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops)
500 * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32)
501 * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4)
503 enum nft_byteorder_attributes {
504 NFTA_BYTEORDER_UNSPEC,
512 #define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1)
515 * enum nft_cmp_ops - nf_tables relational operator
518 * @NFT_CMP_NEQ: not equal
519 * @NFT_CMP_LT: less than
520 * @NFT_CMP_LTE: less than or equal to
521 * @NFT_CMP_GT: greater than
522 * @NFT_CMP_GTE: greater than or equal to
534 * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes
536 * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers)
537 * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops)
538 * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes)
540 enum nft_cmp_attributes {
547 #define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1)
550 * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes
552 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
553 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
554 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
555 * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
557 enum nft_lookup_attributes {
565 #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
567 enum nft_dynset_ops {
569 NFT_DYNSET_OP_UPDATE,
573 * enum nft_dynset_attributes - dynset expression attributes
575 * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING)
576 * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32)
577 * @NFTA_DYNSET_OP: operation (NLA_U32)
578 * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32)
579 * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32)
580 * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64)
581 * @NFTA_DYNSET_EXPR: expression (NLA_NESTED: nft_expr_attributes)
583 enum nft_dynset_attributes {
585 NFTA_DYNSET_SET_NAME,
588 NFTA_DYNSET_SREG_KEY,
589 NFTA_DYNSET_SREG_DATA,
595 #define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1)
598 * enum nft_payload_bases - nf_tables payload expression offset bases
600 * @NFT_PAYLOAD_LL_HEADER: link layer header
601 * @NFT_PAYLOAD_NETWORK_HEADER: network header
602 * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header
604 enum nft_payload_bases {
605 NFT_PAYLOAD_LL_HEADER,
606 NFT_PAYLOAD_NETWORK_HEADER,
607 NFT_PAYLOAD_TRANSPORT_HEADER,
611 * enum nft_payload_csum_types - nf_tables payload expression checksum types
613 * @NFT_PAYLOAD_CSUM_NONE: no checksumming
614 * @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791)
616 enum nft_payload_csum_types {
617 NFT_PAYLOAD_CSUM_NONE,
618 NFT_PAYLOAD_CSUM_INET,
622 * enum nft_payload_attributes - nf_tables payload expression netlink attributes
624 * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
625 * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
626 * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
627 * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
628 * @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers)
629 * @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32)
630 * @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32)
632 enum nft_payload_attributes {
639 NFTA_PAYLOAD_CSUM_TYPE,
640 NFTA_PAYLOAD_CSUM_OFFSET,
643 #define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1)
646 * enum nft_exthdr_attributes - nf_tables IPv6 extension header expression netlink attributes
648 * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers)
649 * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8)
650 * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32)
651 * @NFTA_EXTHDR_LEN: extension header length (NLA_U32)
653 enum nft_exthdr_attributes {
661 #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1)
664 * enum nft_meta_keys - nf_tables meta expression keys
666 * @NFT_META_LEN: packet length (skb->len)
667 * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT
668 * @NFT_META_PRIORITY: packet priority (skb->priority)
669 * @NFT_META_MARK: packet mark (skb->mark)
670 * @NFT_META_IIF: packet input interface index (dev->ifindex)
671 * @NFT_META_OIF: packet output interface index (dev->ifindex)
672 * @NFT_META_IIFNAME: packet input interface name (dev->name)
673 * @NFT_META_OIFNAME: packet output interface name (dev->name)
674 * @NFT_META_IIFTYPE: packet input interface type (dev->type)
675 * @NFT_META_OIFTYPE: packet output interface type (dev->type)
676 * @NFT_META_SKUID: originating socket UID (fsuid)
677 * @NFT_META_SKGID: originating socket GID (fsgid)
678 * @NFT_META_NFTRACE: packet nftrace bit
679 * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid)
680 * @NFT_META_SECMARK: packet secmark (skb->secmark)
681 * @NFT_META_NFPROTO: netfilter protocol
682 * @NFT_META_L4PROTO: layer 4 protocol number
683 * @NFT_META_BRI_IIFNAME: packet input bridge interface name
684 * @NFT_META_BRI_OIFNAME: packet output bridge interface name
685 * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
686 * @NFT_META_CPU: cpu id through smp_processor_id()
687 * @NFT_META_IIFGROUP: packet input interface group
688 * @NFT_META_OIFGROUP: packet output interface group
689 * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
690 * @NFT_META_PRANDOM: a 32bit pseudo-random number
710 NFT_META_BRI_IIFNAME,
711 NFT_META_BRI_OIFNAME,
721 * enum nft_meta_attributes - nf_tables meta expression netlink attributes
723 * @NFTA_META_DREG: destination register (NLA_U32)
724 * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys)
725 * @NFTA_META_SREG: source register (NLA_U32)
727 enum nft_meta_attributes {
734 #define NFTA_META_MAX (__NFTA_META_MAX - 1)
737 * enum nft_ct_keys - nf_tables ct expression keys
739 * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
740 * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir)
741 * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status)
742 * @NFT_CT_MARK: conntrack mark value
743 * @NFT_CT_SECMARK: conntrack secmark value
744 * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
745 * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
746 * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
747 * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address)
748 * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address)
749 * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
750 * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
751 * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
773 * enum nft_ct_attributes - nf_tables ct expression netlink attributes
775 * @NFTA_CT_DREG: destination register (NLA_U32)
776 * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys)
777 * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8)
778 * @NFTA_CT_SREG: source register (NLA_U32)
780 enum nft_ct_attributes {
788 #define NFTA_CT_MAX (__NFTA_CT_MAX - 1)
790 enum nft_limit_type {
795 enum nft_limit_flags {
796 NFT_LIMIT_F_INV = (1 << 0),
800 * enum nft_limit_attributes - nf_tables limit expression netlink attributes
802 * @NFTA_LIMIT_RATE: refill rate (NLA_U64)
803 * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
804 * @NFTA_LIMIT_BURST: burst (NLA_U32)
805 * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type)
806 * @NFTA_LIMIT_FLAGS: flags (NLA_U32: enum nft_limit_flags)
808 enum nft_limit_attributes {
818 #define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
821 * enum nft_counter_attributes - nf_tables counter expression netlink attributes
823 * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64)
824 * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64)
826 enum nft_counter_attributes {
829 NFTA_COUNTER_PACKETS,
833 #define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1)
836 * enum nft_log_attributes - nf_tables log expression netlink attributes
838 * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32)
839 * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
840 * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
841 * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
842 * @NFTA_LOG_LEVEL: log level (NLA_U32)
843 * @NFTA_LOG_FLAGS: logging flags (NLA_U32)
845 enum nft_log_attributes {
855 #define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
858 * enum nft_queue_attributes - nf_tables queue expression netlink attributes
860 * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16)
861 * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16)
862 * @NFTA_QUEUE_FLAGS: various flags (NLA_U16)
864 enum nft_queue_attributes {
871 #define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1)
873 #define NFT_QUEUE_FLAG_BYPASS 0x01 /* for compatibility with v2 */
874 #define NFT_QUEUE_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */
875 #define NFT_QUEUE_FLAG_MASK 0x03
878 * enum nft_reject_types - nf_tables reject expression reject types
880 * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
881 * @NFT_REJECT_TCP_RST: reject using TCP RST
882 * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet
884 enum nft_reject_types {
885 NFT_REJECT_ICMP_UNREACH,
887 NFT_REJECT_ICMPX_UNREACH,
891 * enum nft_reject_code - Generic reject codes for IPv4/IPv6
893 * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable
894 * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable
895 * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable
896 * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited
898 * These codes are mapped to real ICMP and ICMPv6 codes.
900 enum nft_reject_inet_code {
901 NFT_REJECT_ICMPX_NO_ROUTE = 0,
902 NFT_REJECT_ICMPX_PORT_UNREACH,
903 NFT_REJECT_ICMPX_HOST_UNREACH,
904 NFT_REJECT_ICMPX_ADMIN_PROHIBITED,
905 __NFT_REJECT_ICMPX_MAX
907 #define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1)
910 * enum nft_reject_attributes - nf_tables reject expression netlink attributes
912 * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
913 * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8)
915 enum nft_reject_attributes {
918 NFTA_REJECT_ICMP_CODE,
921 #define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1)
924 * enum nft_nat_types - nf_tables nat expression NAT types
926 * @NFT_NAT_SNAT: source NAT
927 * @NFT_NAT_DNAT: destination NAT
935 * enum nft_nat_attributes - nf_tables nat expression netlink attributes
937 * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types)
938 * @NFTA_NAT_FAMILY: NAT family (NLA_U32)
939 * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers)
940 * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
941 * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
942 * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
943 * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
945 enum nft_nat_attributes {
949 NFTA_NAT_REG_ADDR_MIN,
950 NFTA_NAT_REG_ADDR_MAX,
951 NFTA_NAT_REG_PROTO_MIN,
952 NFTA_NAT_REG_PROTO_MAX,
956 #define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1)
959 * enum nft_masq_attributes - nf_tables masquerade expression attributes
961 * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
962 * @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
963 * @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
965 enum nft_masq_attributes {
968 NFTA_MASQ_REG_PROTO_MIN,
969 NFTA_MASQ_REG_PROTO_MAX,
972 #define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
975 * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
977 * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
978 * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
979 * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
981 enum nft_redir_attributes {
983 NFTA_REDIR_REG_PROTO_MIN,
984 NFTA_REDIR_REG_PROTO_MAX,
988 #define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1)
991 * enum nft_dup_attributes - nf_tables dup expression netlink attributes
993 * @NFTA_DUP_SREG_ADDR: source register of address (NLA_U32: nft_registers)
994 * @NFTA_DUP_SREG_DEV: source register of output interface (NLA_U32: nft_register)
996 enum nft_dup_attributes {
1002 #define NFTA_DUP_MAX (__NFTA_DUP_MAX - 1)
1005 * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes
1007 * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register)
1009 enum nft_fwd_attributes {
1014 #define NFTA_FWD_MAX (__NFTA_FWD_MAX - 1)
1017 * enum nft_gen_attributes - nf_tables ruleset generation attributes
1019 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
1021 enum nft_gen_attributes {
1026 #define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1)
1029 * enum nft_trace_attributes - nf_tables trace netlink attributes
1031 * @NFTA_TRACE_TABLE: name of the table (NLA_STRING)
1032 * @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING)
1033 * @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64)
1034 * @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types)
1035 * @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts)
1036 * @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32)
1037 * @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY)
1038 * @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY)
1039 * @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY)
1040 * @NFTA_TRACE_IIF: indev ifindex (NLA_U32)
1041 * @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16)
1042 * @NFTA_TRACE_OIF: outdev ifindex (NLA_U32)
1043 * @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16)
1044 * @NFTA_TRACE_MARK: nfmark (NLA_U32)
1045 * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32)
1046 * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32)
1048 enum nft_trace_attibutes {
1052 NFTA_TRACE_RULE_HANDLE,
1056 NFTA_TRACE_LL_HEADER,
1057 NFTA_TRACE_NETWORK_HEADER,
1058 NFTA_TRACE_TRANSPORT_HEADER,
1069 #define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)
1071 enum nft_trace_types {
1072 NFT_TRACETYPE_UNSPEC,
1073 NFT_TRACETYPE_POLICY,
1074 NFT_TRACETYPE_RETURN,
1078 #define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1)
1079 #endif /* _LINUX_NF_TABLES_H */