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