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_USERDATA_MAXLEN 256
9 * enum nft_registers - nf_tables registers
11 * nf_tables used to have five registers: a verdict register and four data
12 * registers of size 16. The data registers have been changed to 16 registers
13 * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still
14 * map to areas of size 16, the 4 byte registers are addressed using
15 * NFT_REG32_00 - NFT_REG32_15.
42 #define NFT_REG_MAX (__NFT_REG_MAX - 1)
44 #define NFT_REG_SIZE 16
45 #define NFT_REG32_SIZE 4
48 * enum nft_verdicts - nf_tables internal verdicts
50 * @NFT_CONTINUE: continue evaluation of the current rule
51 * @NFT_BREAK: terminate evaluation of the current rule
52 * @NFT_JUMP: push the current chain on the jump stack and jump to a chain
53 * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack
54 * @NFT_RETURN: return to the topmost chain on the jump stack
56 * The nf_tables verdicts share their numeric space with the netfilter verdicts.
67 * enum nf_tables_msg_types - nf_tables netlink message types
69 * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes)
70 * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes)
71 * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes)
72 * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes)
73 * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes)
74 * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes)
75 * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes)
76 * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes)
77 * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes)
78 * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes)
79 * @NFT_MSG_GETSET: get a set (enum nft_set_attributes)
80 * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes)
81 * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes)
82 * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes)
83 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
84 * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes)
85 * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes)
87 enum nf_tables_msg_types {
109 * enum nft_list_attributes - nf_tables generic list netlink attributes
111 * @NFTA_LIST_ELEM: list element (NLA_NESTED)
113 enum nft_list_attributes {
118 #define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1)
121 * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes
123 * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32)
124 * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
126 enum nft_hook_attributes {
132 #define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1)
135 * enum nft_table_flags - nf_tables table flags
137 * @NFT_TABLE_F_DORMANT: this table is not active
139 enum nft_table_flags {
140 NFT_TABLE_F_DORMANT = 0x1,
144 * enum nft_table_attributes - nf_tables table netlink attributes
146 * @NFTA_TABLE_NAME: name of the table (NLA_STRING)
147 * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32)
148 * @NFTA_TABLE_USE: number of chains in this table (NLA_U32)
150 enum nft_table_attributes {
157 #define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1)
160 * enum nft_chain_attributes - nf_tables chain netlink attributes
162 * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING)
163 * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64)
164 * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING)
165 * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes)
166 * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32)
167 * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32)
168 * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING)
169 * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes)
171 enum nft_chain_attributes {
183 #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
186 * enum nft_rule_attributes - nf_tables rule netlink attributes
188 * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING)
189 * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING)
190 * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64)
191 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
192 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
193 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
194 * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN)
196 enum nft_rule_attributes {
201 NFTA_RULE_EXPRESSIONS,
207 #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
210 * enum nft_rule_compat_flags - nf_tables rule compat flags
212 * @NFT_RULE_COMPAT_F_INV: invert the check result
214 enum nft_rule_compat_flags {
215 NFT_RULE_COMPAT_F_INV = (1 << 1),
216 NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
220 * enum nft_rule_compat_attributes - nf_tables rule compat attributes
222 * @NFTA_RULE_COMPAT_PROTO: numerice value of handled protocol (NLA_U32)
223 * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32)
225 enum nft_rule_compat_attributes {
226 NFTA_RULE_COMPAT_UNSPEC,
227 NFTA_RULE_COMPAT_PROTO,
228 NFTA_RULE_COMPAT_FLAGS,
229 __NFTA_RULE_COMPAT_MAX
231 #define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1)
234 * enum nft_set_flags - nf_tables set flags
236 * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink
237 * @NFT_SET_CONSTANT: set contents may not change while bound
238 * @NFT_SET_INTERVAL: set contains intervals
239 * @NFT_SET_MAP: set is used as a dictionary
240 * @NFT_SET_TIMEOUT: set uses timeouts
243 NFT_SET_ANONYMOUS = 0x1,
244 NFT_SET_CONSTANT = 0x2,
245 NFT_SET_INTERVAL = 0x4,
247 NFT_SET_TIMEOUT = 0x10,
251 * enum nft_set_policies - set selection policy
253 * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use
254 * @NFT_SET_POL_MEMORY: prefer low memory use over high performance
256 enum nft_set_policies {
257 NFT_SET_POL_PERFORMANCE,
262 * enum nft_set_desc_attributes - set element description
264 * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32)
266 enum nft_set_desc_attributes {
267 NFTA_SET_DESC_UNSPEC,
271 #define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1)
274 * enum nft_set_attributes - nf_tables set netlink attributes
276 * @NFTA_SET_TABLE: table name (NLA_STRING)
277 * @NFTA_SET_NAME: set name (NLA_STRING)
278 * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32)
279 * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32)
280 * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
281 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
282 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
283 * @NFTA_SET_POLICY: selection policy (NLA_U32)
284 * @NFTA_SET_DESC: set description (NLA_NESTED)
285 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
286 * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64)
287 * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32)
289 enum nft_set_attributes {
302 NFTA_SET_GC_INTERVAL,
305 #define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
308 * enum nft_set_elem_flags - nf_tables set element flags
310 * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval
312 enum nft_set_elem_flags {
313 NFT_SET_ELEM_INTERVAL_END = 0x1,
317 * enum nft_set_elem_attributes - nf_tables set element netlink attributes
319 * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
320 * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
321 * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
322 * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64)
323 * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64)
324 * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY)
326 enum nft_set_elem_attributes {
327 NFTA_SET_ELEM_UNSPEC,
331 NFTA_SET_ELEM_TIMEOUT,
332 NFTA_SET_ELEM_EXPIRATION,
333 NFTA_SET_ELEM_USERDATA,
336 #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
339 * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes
341 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
342 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
343 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
344 * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
346 enum nft_set_elem_list_attributes {
347 NFTA_SET_ELEM_LIST_UNSPEC,
348 NFTA_SET_ELEM_LIST_TABLE,
349 NFTA_SET_ELEM_LIST_SET,
350 NFTA_SET_ELEM_LIST_ELEMENTS,
351 NFTA_SET_ELEM_LIST_SET_ID,
352 __NFTA_SET_ELEM_LIST_MAX
354 #define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
357 * enum nft_data_types - nf_tables data types
359 * @NFT_DATA_VALUE: generic data
360 * @NFT_DATA_VERDICT: netfilter verdict
362 * The type of data is usually determined by the kernel directly and is not
363 * explicitly specified by userspace. The only difference are sets, where
364 * userspace specifies the key and mapping data types.
366 * The values 0xffffff00-0xffffffff are reserved for internally used types.
367 * The remaining range can be freely used by userspace to encode types, all
368 * values are equivalent to NFT_DATA_VALUE.
370 enum nft_data_types {
372 NFT_DATA_VERDICT = 0xffffff00U,
375 #define NFT_DATA_RESERVED_MASK 0xffffff00U
378 * enum nft_data_attributes - nf_tables data netlink attributes
380 * @NFTA_DATA_VALUE: generic data (NLA_BINARY)
381 * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes)
383 enum nft_data_attributes {
389 #define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1)
391 /* Maximum length of a value */
392 #define NFT_DATA_VALUE_MAXLEN 64
395 * enum nft_verdict_attributes - nf_tables verdict netlink attributes
397 * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts)
398 * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING)
400 enum nft_verdict_attributes {
406 #define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1)
409 * enum nft_expr_attributes - nf_tables expression netlink attributes
411 * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING)
412 * @NFTA_EXPR_DATA: type specific data (NLA_NESTED)
414 enum nft_expr_attributes {
420 #define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1)
423 * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes
425 * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32)
426 * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes)
428 enum nft_immediate_attributes {
429 NFTA_IMMEDIATE_UNSPEC,
434 #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1)
437 * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes
439 * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers)
440 * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers)
441 * @NFTA_BITWISE_LEN: length of operands (NLA_U32)
442 * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes)
443 * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes)
445 * The bitwise expression performs the following operation:
447 * dreg = (sreg & mask) ^ xor
449 * which allow to express all bitwise operations:
457 enum nft_bitwise_attributes {
466 #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
469 * enum nft_byteorder_ops - nf_tables byteorder operators
471 * @NFT_BYTEORDER_NTOH: network to host operator
472 * @NFT_BYTEORDER_HTON: host to network opertaor
474 enum nft_byteorder_ops {
480 * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes
482 * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers)
483 * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers)
484 * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops)
485 * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32)
486 * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4)
488 enum nft_byteorder_attributes {
489 NFTA_BYTEORDER_UNSPEC,
497 #define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1)
500 * enum nft_cmp_ops - nf_tables relational operator
503 * @NFT_CMP_NEQ: not equal
504 * @NFT_CMP_LT: less than
505 * @NFT_CMP_LTE: less than or equal to
506 * @NFT_CMP_GT: greater than
507 * @NFT_CMP_GTE: greater than or equal to
519 * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes
521 * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers)
522 * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops)
523 * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes)
525 enum nft_cmp_attributes {
532 #define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1)
535 * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes
537 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
538 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
539 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
540 * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
542 enum nft_lookup_attributes {
550 #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
552 enum nft_dynset_ops {
554 NFT_DYNSET_OP_UPDATE,
558 * enum nft_dynset_attributes - dynset expression attributes
560 * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING)
561 * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32)
562 * @NFTA_DYNSET_OP: operation (NLA_U32)
563 * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32)
564 * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32)
565 * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64)
567 enum nft_dynset_attributes {
569 NFTA_DYNSET_SET_NAME,
572 NFTA_DYNSET_SREG_KEY,
573 NFTA_DYNSET_SREG_DATA,
577 #define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1)
580 * enum nft_payload_bases - nf_tables payload expression offset bases
582 * @NFT_PAYLOAD_LL_HEADER: link layer header
583 * @NFT_PAYLOAD_NETWORK_HEADER: network header
584 * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header
586 enum nft_payload_bases {
587 NFT_PAYLOAD_LL_HEADER,
588 NFT_PAYLOAD_NETWORK_HEADER,
589 NFT_PAYLOAD_TRANSPORT_HEADER,
593 * enum nft_payload_attributes - nf_tables payload expression netlink attributes
595 * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
596 * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
597 * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
598 * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
600 enum nft_payload_attributes {
608 #define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1)
611 * enum nft_exthdr_attributes - nf_tables IPv6 extension header expression netlink attributes
613 * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers)
614 * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8)
615 * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32)
616 * @NFTA_EXTHDR_LEN: extension header length (NLA_U32)
618 enum nft_exthdr_attributes {
626 #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1)
629 * enum nft_meta_keys - nf_tables meta expression keys
631 * @NFT_META_LEN: packet length (skb->len)
632 * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT
633 * @NFT_META_PRIORITY: packet priority (skb->priority)
634 * @NFT_META_MARK: packet mark (skb->mark)
635 * @NFT_META_IIF: packet input interface index (dev->ifindex)
636 * @NFT_META_OIF: packet output interface index (dev->ifindex)
637 * @NFT_META_IIFNAME: packet input interface name (dev->name)
638 * @NFT_META_OIFNAME: packet output interface name (dev->name)
639 * @NFT_META_IIFTYPE: packet input interface type (dev->type)
640 * @NFT_META_OIFTYPE: packet output interface type (dev->type)
641 * @NFT_META_SKUID: originating socket UID (fsuid)
642 * @NFT_META_SKGID: originating socket GID (fsgid)
643 * @NFT_META_NFTRACE: packet nftrace bit
644 * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid)
645 * @NFT_META_SECMARK: packet secmark (skb->secmark)
646 * @NFT_META_NFPROTO: netfilter protocol
647 * @NFT_META_L4PROTO: layer 4 protocol number
648 * @NFT_META_BRI_IIFNAME: packet input bridge interface name
649 * @NFT_META_BRI_OIFNAME: packet output bridge interface name
650 * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
651 * @NFT_META_CPU: cpu id through smp_processor_id()
652 * @NFT_META_IIFGROUP: packet input interface group
653 * @NFT_META_OIFGROUP: packet output interface group
654 * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
674 NFT_META_BRI_IIFNAME,
675 NFT_META_BRI_OIFNAME,
684 * enum nft_meta_attributes - nf_tables meta expression netlink attributes
686 * @NFTA_META_DREG: destination register (NLA_U32)
687 * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys)
688 * @NFTA_META_SREG: source register (NLA_U32)
690 enum nft_meta_attributes {
697 #define NFTA_META_MAX (__NFTA_META_MAX - 1)
700 * enum nft_ct_keys - nf_tables ct expression keys
702 * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
703 * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir)
704 * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status)
705 * @NFT_CT_MARK: conntrack mark value
706 * @NFT_CT_SECMARK: conntrack secmark value
707 * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
708 * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
709 * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
710 * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address)
711 * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address)
712 * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
713 * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
714 * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
734 * enum nft_ct_attributes - nf_tables ct expression netlink attributes
736 * @NFTA_CT_DREG: destination register (NLA_U32)
737 * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys)
738 * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8)
739 * @NFTA_CT_SREG: source register (NLA_U32)
741 enum nft_ct_attributes {
749 #define NFTA_CT_MAX (__NFTA_CT_MAX - 1)
752 * enum nft_limit_attributes - nf_tables limit expression netlink attributes
754 * @NFTA_LIMIT_RATE: refill rate (NLA_U64)
755 * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
757 enum nft_limit_attributes {
763 #define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
766 * enum nft_counter_attributes - nf_tables counter expression netlink attributes
768 * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64)
769 * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64)
771 enum nft_counter_attributes {
774 NFTA_COUNTER_PACKETS,
777 #define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1)
780 * enum nft_log_attributes - nf_tables log expression netlink attributes
782 * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32)
783 * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
784 * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
785 * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
786 * @NFTA_LOG_LEVEL: log level (NLA_U32)
787 * @NFTA_LOG_FLAGS: logging flags (NLA_U32)
789 enum nft_log_attributes {
799 #define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
802 * enum nft_queue_attributes - nf_tables queue expression netlink attributes
804 * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16)
805 * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16)
806 * @NFTA_QUEUE_FLAGS: various flags (NLA_U16)
808 enum nft_queue_attributes {
815 #define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1)
817 #define NFT_QUEUE_FLAG_BYPASS 0x01 /* for compatibility with v2 */
818 #define NFT_QUEUE_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */
819 #define NFT_QUEUE_FLAG_MASK 0x03
822 * enum nft_reject_types - nf_tables reject expression reject types
824 * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
825 * @NFT_REJECT_TCP_RST: reject using TCP RST
826 * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet
828 enum nft_reject_types {
829 NFT_REJECT_ICMP_UNREACH,
831 NFT_REJECT_ICMPX_UNREACH,
835 * enum nft_reject_code - Generic reject codes for IPv4/IPv6
837 * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable
838 * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable
839 * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable
840 * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited
842 * These codes are mapped to real ICMP and ICMPv6 codes.
844 enum nft_reject_inet_code {
845 NFT_REJECT_ICMPX_NO_ROUTE = 0,
846 NFT_REJECT_ICMPX_PORT_UNREACH,
847 NFT_REJECT_ICMPX_HOST_UNREACH,
848 NFT_REJECT_ICMPX_ADMIN_PROHIBITED,
849 __NFT_REJECT_ICMPX_MAX
851 #define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1)
854 * enum nft_reject_attributes - nf_tables reject expression netlink attributes
856 * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
857 * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8)
859 enum nft_reject_attributes {
862 NFTA_REJECT_ICMP_CODE,
865 #define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1)
868 * enum nft_nat_types - nf_tables nat expression NAT types
870 * @NFT_NAT_SNAT: source NAT
871 * @NFT_NAT_DNAT: destination NAT
879 * enum nft_nat_attributes - nf_tables nat expression netlink attributes
881 * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types)
882 * @NFTA_NAT_FAMILY: NAT family (NLA_U32)
883 * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers)
884 * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
885 * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
886 * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
887 * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
889 enum nft_nat_attributes {
893 NFTA_NAT_REG_ADDR_MIN,
894 NFTA_NAT_REG_ADDR_MAX,
895 NFTA_NAT_REG_PROTO_MIN,
896 NFTA_NAT_REG_PROTO_MAX,
900 #define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1)
903 * enum nft_masq_attributes - nf_tables masquerade expression attributes
905 * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
907 enum nft_masq_attributes {
912 #define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
915 * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
917 * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
918 * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
919 * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
921 enum nft_redir_attributes {
923 NFTA_REDIR_REG_PROTO_MIN,
924 NFTA_REDIR_REG_PROTO_MAX,
928 #define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1)
931 * enum nft_gen_attributes - nf_tables ruleset generation attributes
933 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
935 enum nft_gen_attributes {
940 #define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1)
942 #endif /* _LINUX_NF_TABLES_H */