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