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