Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_NF_TABLES_H |
| 2 | #define _LINUX_NF_TABLES_H |
| 3 | |
| 4 | #define NFT_CHAIN_MAXNAMELEN 32 |
| 5 | |
| 6 | enum nft_registers { |
| 7 | NFT_REG_VERDICT, |
| 8 | NFT_REG_1, |
| 9 | NFT_REG_2, |
| 10 | NFT_REG_3, |
| 11 | NFT_REG_4, |
| 12 | __NFT_REG_MAX |
| 13 | }; |
| 14 | #define NFT_REG_MAX (__NFT_REG_MAX - 1) |
| 15 | |
| 16 | /** |
| 17 | * enum nft_verdicts - nf_tables internal verdicts |
| 18 | * |
| 19 | * @NFT_CONTINUE: continue evaluation of the current rule |
| 20 | * @NFT_BREAK: terminate evaluation of the current rule |
| 21 | * @NFT_JUMP: push the current chain on the jump stack and jump to a chain |
| 22 | * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack |
| 23 | * @NFT_RETURN: return to the topmost chain on the jump stack |
| 24 | * |
| 25 | * The nf_tables verdicts share their numeric space with the netfilter verdicts. |
| 26 | */ |
| 27 | enum nft_verdicts { |
| 28 | NFT_CONTINUE = -1, |
| 29 | NFT_BREAK = -2, |
| 30 | NFT_JUMP = -3, |
| 31 | NFT_GOTO = -4, |
| 32 | NFT_RETURN = -5, |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * enum nf_tables_msg_types - nf_tables netlink message types |
| 37 | * |
| 38 | * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes) |
| 39 | * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes) |
| 40 | * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes) |
| 41 | * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes) |
| 42 | * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes) |
| 43 | * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes) |
| 44 | * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes) |
| 45 | * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes) |
| 46 | * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes) |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 47 | * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes) |
| 48 | * @NFT_MSG_GETSET: get a set (enum nft_set_attributes) |
| 49 | * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes) |
| 50 | * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes) |
| 51 | * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes) |
| 52 | * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 53 | */ |
| 54 | enum nf_tables_msg_types { |
| 55 | NFT_MSG_NEWTABLE, |
| 56 | NFT_MSG_GETTABLE, |
| 57 | NFT_MSG_DELTABLE, |
| 58 | NFT_MSG_NEWCHAIN, |
| 59 | NFT_MSG_GETCHAIN, |
| 60 | NFT_MSG_DELCHAIN, |
| 61 | NFT_MSG_NEWRULE, |
| 62 | NFT_MSG_GETRULE, |
| 63 | NFT_MSG_DELRULE, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 64 | NFT_MSG_NEWSET, |
| 65 | NFT_MSG_GETSET, |
| 66 | NFT_MSG_DELSET, |
| 67 | NFT_MSG_NEWSETELEM, |
| 68 | NFT_MSG_GETSETELEM, |
| 69 | NFT_MSG_DELSETELEM, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 70 | NFT_MSG_MAX, |
| 71 | }; |
| 72 | |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 73 | /** |
| 74 | * enum nft_list_attributes - nf_tables generic list netlink attributes |
| 75 | * |
| 76 | * @NFTA_LIST_ELEM: list element (NLA_NESTED) |
| 77 | */ |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 78 | enum nft_list_attributes { |
| 79 | NFTA_LIST_UNPEC, |
| 80 | NFTA_LIST_ELEM, |
| 81 | __NFTA_LIST_MAX |
| 82 | }; |
| 83 | #define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1) |
| 84 | |
| 85 | /** |
| 86 | * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes |
| 87 | * |
| 88 | * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32) |
| 89 | * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32) |
| 90 | */ |
| 91 | enum nft_hook_attributes { |
| 92 | NFTA_HOOK_UNSPEC, |
| 93 | NFTA_HOOK_HOOKNUM, |
| 94 | NFTA_HOOK_PRIORITY, |
| 95 | __NFTA_HOOK_MAX |
| 96 | }; |
| 97 | #define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1) |
| 98 | |
| 99 | /** |
Pablo Neira Ayuso | 9ddf632 | 2013-10-10 13:26:33 +0200 | [diff] [blame] | 100 | * enum nft_table_flags - nf_tables table flags |
| 101 | * |
| 102 | * @NFT_TABLE_F_DORMANT: this table is not active |
| 103 | */ |
| 104 | enum nft_table_flags { |
| 105 | NFT_TABLE_F_DORMANT = 0x1, |
| 106 | }; |
| 107 | |
| 108 | /** |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 109 | * enum nft_table_attributes - nf_tables table netlink attributes |
| 110 | * |
| 111 | * @NFTA_TABLE_NAME: name of the table (NLA_STRING) |
Pablo Neira Ayuso | 9ddf632 | 2013-10-10 13:26:33 +0200 | [diff] [blame] | 112 | * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 113 | */ |
| 114 | enum nft_table_attributes { |
| 115 | NFTA_TABLE_UNSPEC, |
| 116 | NFTA_TABLE_NAME, |
Pablo Neira Ayuso | 9ddf632 | 2013-10-10 13:26:33 +0200 | [diff] [blame] | 117 | NFTA_TABLE_FLAGS, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 118 | __NFTA_TABLE_MAX |
| 119 | }; |
| 120 | #define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1) |
| 121 | |
| 122 | /** |
| 123 | * enum nft_chain_attributes - nf_tables chain netlink attributes |
| 124 | * |
| 125 | * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING) |
| 126 | * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64) |
| 127 | * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING) |
| 128 | * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes) |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 129 | * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32) |
| 130 | * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32) |
Pablo Neira Ayuso | 9370761 | 2013-10-10 23:21:26 +0200 | [diff] [blame] | 131 | * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING) |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 132 | * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 133 | */ |
| 134 | enum nft_chain_attributes { |
| 135 | NFTA_CHAIN_UNSPEC, |
| 136 | NFTA_CHAIN_TABLE, |
| 137 | NFTA_CHAIN_HANDLE, |
| 138 | NFTA_CHAIN_NAME, |
| 139 | NFTA_CHAIN_HOOK, |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 140 | NFTA_CHAIN_POLICY, |
| 141 | NFTA_CHAIN_USE, |
Pablo Neira Ayuso | 9370761 | 2013-10-10 23:21:26 +0200 | [diff] [blame] | 142 | NFTA_CHAIN_TYPE, |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 143 | NFTA_CHAIN_COUNTERS, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 144 | __NFTA_CHAIN_MAX |
| 145 | }; |
| 146 | #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) |
| 147 | |
| 148 | /** |
| 149 | * enum nft_rule_attributes - nf_tables rule netlink attributes |
| 150 | * |
| 151 | * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING) |
| 152 | * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING) |
| 153 | * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64) |
| 154 | * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes) |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 155 | * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes) |
Eric Leblond | 5e94846 | 2013-10-10 13:41:44 +0200 | [diff] [blame] | 156 | * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 157 | */ |
| 158 | enum nft_rule_attributes { |
| 159 | NFTA_RULE_UNSPEC, |
| 160 | NFTA_RULE_TABLE, |
| 161 | NFTA_RULE_CHAIN, |
| 162 | NFTA_RULE_HANDLE, |
| 163 | NFTA_RULE_EXPRESSIONS, |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 164 | NFTA_RULE_COMPAT, |
Eric Leblond | 5e94846 | 2013-10-10 13:41:44 +0200 | [diff] [blame] | 165 | NFTA_RULE_POSITION, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 166 | __NFTA_RULE_MAX |
| 167 | }; |
| 168 | #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) |
| 169 | |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 170 | /** |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 171 | * enum nft_rule_compat_flags - nf_tables rule compat flags |
| 172 | * |
| 173 | * @NFT_RULE_COMPAT_F_INV: invert the check result |
| 174 | */ |
| 175 | enum nft_rule_compat_flags { |
| 176 | NFT_RULE_COMPAT_F_INV = (1 << 1), |
| 177 | NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV, |
| 178 | }; |
| 179 | |
| 180 | /** |
| 181 | * enum nft_rule_compat_attributes - nf_tables rule compat attributes |
| 182 | * |
| 183 | * @NFTA_RULE_COMPAT_PROTO: numerice value of handled protocol (NLA_U32) |
| 184 | * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32) |
| 185 | */ |
| 186 | enum nft_rule_compat_attributes { |
| 187 | NFTA_RULE_COMPAT_UNSPEC, |
| 188 | NFTA_RULE_COMPAT_PROTO, |
| 189 | NFTA_RULE_COMPAT_FLAGS, |
| 190 | __NFTA_RULE_COMPAT_MAX |
| 191 | }; |
| 192 | #define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1) |
| 193 | |
| 194 | /** |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 195 | * enum nft_set_flags - nf_tables set flags |
| 196 | * |
| 197 | * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink |
| 198 | * @NFT_SET_CONSTANT: set contents may not change while bound |
| 199 | * @NFT_SET_INTERVAL: set contains intervals |
| 200 | * @NFT_SET_MAP: set is used as a dictionary |
| 201 | */ |
| 202 | enum nft_set_flags { |
| 203 | NFT_SET_ANONYMOUS = 0x1, |
| 204 | NFT_SET_CONSTANT = 0x2, |
| 205 | NFT_SET_INTERVAL = 0x4, |
| 206 | NFT_SET_MAP = 0x8, |
| 207 | }; |
| 208 | |
| 209 | /** |
| 210 | * enum nft_set_attributes - nf_tables set netlink attributes |
| 211 | * |
| 212 | * @NFTA_SET_TABLE: table name (NLA_STRING) |
| 213 | * @NFTA_SET_NAME: set name (NLA_STRING) |
| 214 | * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32) |
| 215 | * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32) |
| 216 | * @NFTA_SET_KEY_LEN: key data length (NLA_U32) |
| 217 | * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32) |
| 218 | * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) |
| 219 | */ |
| 220 | enum nft_set_attributes { |
| 221 | NFTA_SET_UNSPEC, |
| 222 | NFTA_SET_TABLE, |
| 223 | NFTA_SET_NAME, |
| 224 | NFTA_SET_FLAGS, |
| 225 | NFTA_SET_KEY_TYPE, |
| 226 | NFTA_SET_KEY_LEN, |
| 227 | NFTA_SET_DATA_TYPE, |
| 228 | NFTA_SET_DATA_LEN, |
| 229 | __NFTA_SET_MAX |
| 230 | }; |
| 231 | #define NFTA_SET_MAX (__NFTA_SET_MAX - 1) |
| 232 | |
| 233 | /** |
| 234 | * enum nft_set_elem_flags - nf_tables set element flags |
| 235 | * |
| 236 | * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval |
| 237 | */ |
| 238 | enum nft_set_elem_flags { |
| 239 | NFT_SET_ELEM_INTERVAL_END = 0x1, |
| 240 | }; |
| 241 | |
| 242 | /** |
| 243 | * enum nft_set_elem_attributes - nf_tables set element netlink attributes |
| 244 | * |
| 245 | * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data) |
| 246 | * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes) |
| 247 | * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32) |
| 248 | */ |
| 249 | enum nft_set_elem_attributes { |
| 250 | NFTA_SET_ELEM_UNSPEC, |
| 251 | NFTA_SET_ELEM_KEY, |
| 252 | NFTA_SET_ELEM_DATA, |
| 253 | NFTA_SET_ELEM_FLAGS, |
| 254 | __NFTA_SET_ELEM_MAX |
| 255 | }; |
| 256 | #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1) |
| 257 | |
| 258 | /** |
| 259 | * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes |
| 260 | * |
| 261 | * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) |
| 262 | * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) |
| 263 | * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) |
| 264 | */ |
| 265 | enum nft_set_elem_list_attributes { |
| 266 | NFTA_SET_ELEM_LIST_UNSPEC, |
| 267 | NFTA_SET_ELEM_LIST_TABLE, |
| 268 | NFTA_SET_ELEM_LIST_SET, |
| 269 | NFTA_SET_ELEM_LIST_ELEMENTS, |
| 270 | __NFTA_SET_ELEM_LIST_MAX |
| 271 | }; |
| 272 | #define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) |
| 273 | |
| 274 | /** |
| 275 | * enum nft_data_types - nf_tables data types |
| 276 | * |
| 277 | * @NFT_DATA_VALUE: generic data |
| 278 | * @NFT_DATA_VERDICT: netfilter verdict |
| 279 | * |
| 280 | * The type of data is usually determined by the kernel directly and is not |
| 281 | * explicitly specified by userspace. The only difference are sets, where |
| 282 | * userspace specifies the key and mapping data types. |
| 283 | * |
| 284 | * The values 0xffffff00-0xffffffff are reserved for internally used types. |
| 285 | * The remaining range can be freely used by userspace to encode types, all |
| 286 | * values are equivalent to NFT_DATA_VALUE. |
| 287 | */ |
| 288 | enum nft_data_types { |
| 289 | NFT_DATA_VALUE, |
| 290 | NFT_DATA_VERDICT = 0xffffff00U, |
| 291 | }; |
| 292 | |
| 293 | #define NFT_DATA_RESERVED_MASK 0xffffff00U |
| 294 | |
| 295 | /** |
| 296 | * enum nft_data_attributes - nf_tables data netlink attributes |
| 297 | * |
| 298 | * @NFTA_DATA_VALUE: generic data (NLA_BINARY) |
| 299 | * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes) |
| 300 | */ |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 301 | enum nft_data_attributes { |
| 302 | NFTA_DATA_UNSPEC, |
| 303 | NFTA_DATA_VALUE, |
| 304 | NFTA_DATA_VERDICT, |
| 305 | __NFTA_DATA_MAX |
| 306 | }; |
| 307 | #define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1) |
| 308 | |
| 309 | /** |
| 310 | * enum nft_verdict_attributes - nf_tables verdict netlink attributes |
| 311 | * |
| 312 | * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts) |
| 313 | * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING) |
| 314 | */ |
| 315 | enum nft_verdict_attributes { |
| 316 | NFTA_VERDICT_UNSPEC, |
| 317 | NFTA_VERDICT_CODE, |
| 318 | NFTA_VERDICT_CHAIN, |
| 319 | __NFTA_VERDICT_MAX |
| 320 | }; |
| 321 | #define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1) |
| 322 | |
| 323 | /** |
| 324 | * enum nft_expr_attributes - nf_tables expression netlink attributes |
| 325 | * |
| 326 | * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING) |
| 327 | * @NFTA_EXPR_DATA: type specific data (NLA_NESTED) |
| 328 | */ |
| 329 | enum nft_expr_attributes { |
| 330 | NFTA_EXPR_UNSPEC, |
| 331 | NFTA_EXPR_NAME, |
| 332 | NFTA_EXPR_DATA, |
| 333 | __NFTA_EXPR_MAX |
| 334 | }; |
| 335 | #define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1) |
| 336 | |
| 337 | /** |
| 338 | * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes |
| 339 | * |
| 340 | * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32) |
| 341 | * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes) |
| 342 | */ |
| 343 | enum nft_immediate_attributes { |
| 344 | NFTA_IMMEDIATE_UNSPEC, |
| 345 | NFTA_IMMEDIATE_DREG, |
| 346 | NFTA_IMMEDIATE_DATA, |
| 347 | __NFTA_IMMEDIATE_MAX |
| 348 | }; |
| 349 | #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1) |
| 350 | |
| 351 | /** |
| 352 | * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes |
| 353 | * |
| 354 | * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers) |
| 355 | * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers) |
| 356 | * @NFTA_BITWISE_LEN: length of operands (NLA_U32) |
| 357 | * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes) |
| 358 | * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes) |
| 359 | * |
| 360 | * The bitwise expression performs the following operation: |
| 361 | * |
| 362 | * dreg = (sreg & mask) ^ xor |
| 363 | * |
| 364 | * which allow to express all bitwise operations: |
| 365 | * |
| 366 | * mask xor |
| 367 | * NOT: 1 1 |
| 368 | * OR: 0 x |
| 369 | * XOR: 1 x |
| 370 | * AND: x 0 |
| 371 | */ |
| 372 | enum nft_bitwise_attributes { |
| 373 | NFTA_BITWISE_UNSPEC, |
| 374 | NFTA_BITWISE_SREG, |
| 375 | NFTA_BITWISE_DREG, |
| 376 | NFTA_BITWISE_LEN, |
| 377 | NFTA_BITWISE_MASK, |
| 378 | NFTA_BITWISE_XOR, |
| 379 | __NFTA_BITWISE_MAX |
| 380 | }; |
| 381 | #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1) |
| 382 | |
| 383 | /** |
| 384 | * enum nft_byteorder_ops - nf_tables byteorder operators |
| 385 | * |
| 386 | * @NFT_BYTEORDER_NTOH: network to host operator |
| 387 | * @NFT_BYTEORDER_HTON: host to network opertaor |
| 388 | */ |
| 389 | enum nft_byteorder_ops { |
| 390 | NFT_BYTEORDER_NTOH, |
| 391 | NFT_BYTEORDER_HTON, |
| 392 | }; |
| 393 | |
| 394 | /** |
| 395 | * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes |
| 396 | * |
| 397 | * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers) |
| 398 | * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers) |
| 399 | * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops) |
| 400 | * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32) |
| 401 | * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4) |
| 402 | */ |
| 403 | enum nft_byteorder_attributes { |
| 404 | NFTA_BYTEORDER_UNSPEC, |
| 405 | NFTA_BYTEORDER_SREG, |
| 406 | NFTA_BYTEORDER_DREG, |
| 407 | NFTA_BYTEORDER_OP, |
| 408 | NFTA_BYTEORDER_LEN, |
| 409 | NFTA_BYTEORDER_SIZE, |
| 410 | __NFTA_BYTEORDER_MAX |
| 411 | }; |
| 412 | #define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1) |
| 413 | |
| 414 | /** |
| 415 | * enum nft_cmp_ops - nf_tables relational operator |
| 416 | * |
| 417 | * @NFT_CMP_EQ: equal |
| 418 | * @NFT_CMP_NEQ: not equal |
| 419 | * @NFT_CMP_LT: less than |
| 420 | * @NFT_CMP_LTE: less than or equal to |
| 421 | * @NFT_CMP_GT: greater than |
| 422 | * @NFT_CMP_GTE: greater than or equal to |
| 423 | */ |
| 424 | enum nft_cmp_ops { |
| 425 | NFT_CMP_EQ, |
| 426 | NFT_CMP_NEQ, |
| 427 | NFT_CMP_LT, |
| 428 | NFT_CMP_LTE, |
| 429 | NFT_CMP_GT, |
| 430 | NFT_CMP_GTE, |
| 431 | }; |
| 432 | |
| 433 | /** |
| 434 | * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes |
| 435 | * |
| 436 | * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers) |
| 437 | * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops) |
| 438 | * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes) |
| 439 | */ |
| 440 | enum nft_cmp_attributes { |
| 441 | NFTA_CMP_UNSPEC, |
| 442 | NFTA_CMP_SREG, |
| 443 | NFTA_CMP_OP, |
| 444 | NFTA_CMP_DATA, |
| 445 | __NFTA_CMP_MAX |
| 446 | }; |
| 447 | #define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1) |
| 448 | |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 449 | /** |
| 450 | * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes |
| 451 | * |
| 452 | * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) |
| 453 | * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) |
| 454 | * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) |
| 455 | */ |
| 456 | enum nft_lookup_attributes { |
| 457 | NFTA_LOOKUP_UNSPEC, |
| 458 | NFTA_LOOKUP_SET, |
| 459 | NFTA_LOOKUP_SREG, |
| 460 | NFTA_LOOKUP_DREG, |
| 461 | __NFTA_LOOKUP_MAX |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 462 | }; |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 463 | #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 464 | |
| 465 | /** |
| 466 | * enum nft_payload_bases - nf_tables payload expression offset bases |
| 467 | * |
| 468 | * @NFT_PAYLOAD_LL_HEADER: link layer header |
| 469 | * @NFT_PAYLOAD_NETWORK_HEADER: network header |
| 470 | * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header |
| 471 | */ |
| 472 | enum nft_payload_bases { |
| 473 | NFT_PAYLOAD_LL_HEADER, |
| 474 | NFT_PAYLOAD_NETWORK_HEADER, |
| 475 | NFT_PAYLOAD_TRANSPORT_HEADER, |
| 476 | }; |
| 477 | |
| 478 | /** |
| 479 | * enum nft_payload_attributes - nf_tables payload expression netlink attributes |
| 480 | * |
| 481 | * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers) |
| 482 | * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases) |
| 483 | * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32) |
| 484 | * @NFTA_PAYLOAD_LEN: payload length (NLA_U32) |
| 485 | */ |
| 486 | enum nft_payload_attributes { |
| 487 | NFTA_PAYLOAD_UNSPEC, |
| 488 | NFTA_PAYLOAD_DREG, |
| 489 | NFTA_PAYLOAD_BASE, |
| 490 | NFTA_PAYLOAD_OFFSET, |
| 491 | NFTA_PAYLOAD_LEN, |
| 492 | __NFTA_PAYLOAD_MAX |
| 493 | }; |
| 494 | #define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1) |
| 495 | |
| 496 | /** |
| 497 | * enum nft_exthdr_attributes - nf_tables IPv6 extension header expression netlink attributes |
| 498 | * |
| 499 | * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers) |
| 500 | * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8) |
| 501 | * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32) |
| 502 | * @NFTA_EXTHDR_LEN: extension header length (NLA_U32) |
| 503 | */ |
| 504 | enum nft_exthdr_attributes { |
| 505 | NFTA_EXTHDR_UNSPEC, |
| 506 | NFTA_EXTHDR_DREG, |
| 507 | NFTA_EXTHDR_TYPE, |
| 508 | NFTA_EXTHDR_OFFSET, |
| 509 | NFTA_EXTHDR_LEN, |
| 510 | __NFTA_EXTHDR_MAX |
| 511 | }; |
| 512 | #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1) |
| 513 | |
| 514 | /** |
| 515 | * enum nft_meta_keys - nf_tables meta expression keys |
| 516 | * |
| 517 | * @NFT_META_LEN: packet length (skb->len) |
| 518 | * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT |
| 519 | * @NFT_META_PRIORITY: packet priority (skb->priority) |
| 520 | * @NFT_META_MARK: packet mark (skb->mark) |
| 521 | * @NFT_META_IIF: packet input interface index (dev->ifindex) |
| 522 | * @NFT_META_OIF: packet output interface index (dev->ifindex) |
| 523 | * @NFT_META_IIFNAME: packet input interface name (dev->name) |
| 524 | * @NFT_META_OIFNAME: packet output interface name (dev->name) |
| 525 | * @NFT_META_IIFTYPE: packet input interface type (dev->type) |
| 526 | * @NFT_META_OIFTYPE: packet output interface type (dev->type) |
| 527 | * @NFT_META_SKUID: originating socket UID (fsuid) |
| 528 | * @NFT_META_SKGID: originating socket GID (fsgid) |
| 529 | * @NFT_META_NFTRACE: packet nftrace bit |
| 530 | * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid) |
| 531 | * @NFT_META_SECMARK: packet secmark (skb->secmark) |
| 532 | */ |
| 533 | enum nft_meta_keys { |
| 534 | NFT_META_LEN, |
| 535 | NFT_META_PROTOCOL, |
| 536 | NFT_META_PRIORITY, |
| 537 | NFT_META_MARK, |
| 538 | NFT_META_IIF, |
| 539 | NFT_META_OIF, |
| 540 | NFT_META_IIFNAME, |
| 541 | NFT_META_OIFNAME, |
| 542 | NFT_META_IIFTYPE, |
| 543 | NFT_META_OIFTYPE, |
| 544 | NFT_META_SKUID, |
| 545 | NFT_META_SKGID, |
| 546 | NFT_META_NFTRACE, |
| 547 | NFT_META_RTCLASSID, |
| 548 | NFT_META_SECMARK, |
| 549 | }; |
| 550 | |
| 551 | /** |
| 552 | * enum nft_meta_attributes - nf_tables meta expression netlink attributes |
| 553 | * |
| 554 | * @NFTA_META_DREG: destination register (NLA_U32) |
| 555 | * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys) |
| 556 | */ |
| 557 | enum nft_meta_attributes { |
| 558 | NFTA_META_UNSPEC, |
| 559 | NFTA_META_DREG, |
| 560 | NFTA_META_KEY, |
| 561 | __NFTA_META_MAX |
| 562 | }; |
| 563 | #define NFTA_META_MAX (__NFTA_META_MAX - 1) |
| 564 | |
| 565 | /** |
| 566 | * enum nft_ct_keys - nf_tables ct expression keys |
| 567 | * |
| 568 | * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info) |
| 569 | * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir) |
| 570 | * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status) |
| 571 | * @NFT_CT_MARK: conntrack mark value |
| 572 | * @NFT_CT_SECMARK: conntrack secmark value |
| 573 | * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms |
| 574 | * @NFT_CT_HELPER: connection tracking helper assigned to conntrack |
| 575 | * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol |
| 576 | * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address) |
| 577 | * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address) |
| 578 | * @NFT_CT_PROTOCOL: conntrack layer 4 protocol |
| 579 | * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source |
| 580 | * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination |
| 581 | */ |
| 582 | enum nft_ct_keys { |
| 583 | NFT_CT_STATE, |
| 584 | NFT_CT_DIRECTION, |
| 585 | NFT_CT_STATUS, |
| 586 | NFT_CT_MARK, |
| 587 | NFT_CT_SECMARK, |
| 588 | NFT_CT_EXPIRATION, |
| 589 | NFT_CT_HELPER, |
| 590 | NFT_CT_L3PROTOCOL, |
| 591 | NFT_CT_SRC, |
| 592 | NFT_CT_DST, |
| 593 | NFT_CT_PROTOCOL, |
| 594 | NFT_CT_PROTO_SRC, |
| 595 | NFT_CT_PROTO_DST, |
| 596 | }; |
| 597 | |
| 598 | /** |
| 599 | * enum nft_ct_attributes - nf_tables ct expression netlink attributes |
| 600 | * |
| 601 | * @NFTA_CT_DREG: destination register (NLA_U32) |
| 602 | * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys) |
| 603 | * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8) |
| 604 | */ |
| 605 | enum nft_ct_attributes { |
| 606 | NFTA_CT_UNSPEC, |
| 607 | NFTA_CT_DREG, |
| 608 | NFTA_CT_KEY, |
| 609 | NFTA_CT_DIRECTION, |
| 610 | __NFTA_CT_MAX |
| 611 | }; |
| 612 | #define NFTA_CT_MAX (__NFTA_CT_MAX - 1) |
| 613 | |
| 614 | /** |
| 615 | * enum nft_limit_attributes - nf_tables limit expression netlink attributes |
| 616 | * |
| 617 | * @NFTA_LIMIT_RATE: refill rate (NLA_U64) |
| 618 | * @NFTA_LIMIT_UNIT: refill unit (NLA_U64) |
| 619 | */ |
| 620 | enum nft_limit_attributes { |
| 621 | NFTA_LIMIT_UNSPEC, |
| 622 | NFTA_LIMIT_RATE, |
| 623 | NFTA_LIMIT_UNIT, |
| 624 | __NFTA_LIMIT_MAX |
| 625 | }; |
| 626 | #define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1) |
| 627 | |
| 628 | /** |
| 629 | * enum nft_counter_attributes - nf_tables counter expression netlink attributes |
| 630 | * |
| 631 | * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64) |
| 632 | * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64) |
| 633 | */ |
| 634 | enum nft_counter_attributes { |
| 635 | NFTA_COUNTER_UNSPEC, |
| 636 | NFTA_COUNTER_BYTES, |
| 637 | NFTA_COUNTER_PACKETS, |
| 638 | __NFTA_COUNTER_MAX |
| 639 | }; |
| 640 | #define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1) |
| 641 | |
| 642 | /** |
| 643 | * enum nft_log_attributes - nf_tables log expression netlink attributes |
| 644 | * |
| 645 | * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32) |
| 646 | * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING) |
| 647 | * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32) |
| 648 | * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32) |
| 649 | */ |
| 650 | enum nft_log_attributes { |
| 651 | NFTA_LOG_UNSPEC, |
| 652 | NFTA_LOG_GROUP, |
| 653 | NFTA_LOG_PREFIX, |
| 654 | NFTA_LOG_SNAPLEN, |
| 655 | NFTA_LOG_QTHRESHOLD, |
| 656 | __NFTA_LOG_MAX |
| 657 | }; |
| 658 | #define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1) |
| 659 | |
| 660 | /** |
Eric Leblond | 0aff078 | 2013-12-06 00:24:13 +0100 | [diff] [blame^] | 661 | * enum nft_queue_attributes - nf_tables queue expression netlink attributes |
| 662 | * |
| 663 | * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16) |
| 664 | * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16) |
| 665 | * @NFTA_QUEUE_FLAGS: various flags (NLA_U16) |
| 666 | */ |
| 667 | enum nft_queue_attributes { |
| 668 | NFTA_QUEUE_UNSPEC, |
| 669 | NFTA_QUEUE_NUM, |
| 670 | NFTA_QUEUE_TOTAL, |
| 671 | NFTA_QUEUE_FLAGS, |
| 672 | __NFTA_QUEUE_MAX |
| 673 | }; |
| 674 | #define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1) |
| 675 | |
| 676 | #define NFT_QUEUE_FLAG_BYPASS 0x01 /* for compatibility with v2 */ |
| 677 | #define NFT_QUEUE_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ |
| 678 | #define NFT_QUEUE_FLAG_MASK 0x03 |
| 679 | |
| 680 | /** |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 681 | * enum nft_reject_types - nf_tables reject expression reject types |
| 682 | * |
| 683 | * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable |
| 684 | * @NFT_REJECT_TCP_RST: reject using TCP RST |
| 685 | */ |
| 686 | enum nft_reject_types { |
| 687 | NFT_REJECT_ICMP_UNREACH, |
| 688 | NFT_REJECT_TCP_RST, |
| 689 | }; |
| 690 | |
| 691 | /** |
| 692 | * enum nft_reject_attributes - nf_tables reject expression netlink attributes |
| 693 | * |
| 694 | * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types) |
| 695 | * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8) |
| 696 | */ |
| 697 | enum nft_reject_attributes { |
| 698 | NFTA_REJECT_UNSPEC, |
| 699 | NFTA_REJECT_TYPE, |
| 700 | NFTA_REJECT_ICMP_CODE, |
| 701 | __NFTA_REJECT_MAX |
| 702 | }; |
| 703 | #define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1) |
| 704 | |
| 705 | /** |
| 706 | * enum nft_nat_types - nf_tables nat expression NAT types |
| 707 | * |
| 708 | * @NFT_NAT_SNAT: source NAT |
| 709 | * @NFT_NAT_DNAT: destination NAT |
| 710 | */ |
| 711 | enum nft_nat_types { |
| 712 | NFT_NAT_SNAT, |
| 713 | NFT_NAT_DNAT, |
| 714 | }; |
| 715 | |
| 716 | /** |
| 717 | * enum nft_nat_attributes - nf_tables nat expression netlink attributes |
| 718 | * |
| 719 | * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types) |
Tomasz Bursztyka | eb31628 | 2013-10-10 13:39:19 +0200 | [diff] [blame] | 720 | * @NFTA_NAT_FAMILY: NAT family (NLA_U32) |
| 721 | * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers) |
| 722 | * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers) |
| 723 | * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) |
| 724 | * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 725 | */ |
| 726 | enum nft_nat_attributes { |
| 727 | NFTA_NAT_UNSPEC, |
| 728 | NFTA_NAT_TYPE, |
Tomasz Bursztyka | eb31628 | 2013-10-10 13:39:19 +0200 | [diff] [blame] | 729 | NFTA_NAT_FAMILY, |
| 730 | NFTA_NAT_REG_ADDR_MIN, |
| 731 | NFTA_NAT_REG_ADDR_MAX, |
| 732 | NFTA_NAT_REG_PROTO_MIN, |
| 733 | NFTA_NAT_REG_PROTO_MAX, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 734 | __NFTA_NAT_MAX |
| 735 | }; |
| 736 | #define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1) |
| 737 | |
| 738 | #endif /* _LINUX_NF_TABLES_H */ |