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 | |
Pablo Neira Ayuso | 1cae565 | 2015-03-05 15:05:36 +0100 | [diff] [blame] | 4 | #define NFT_TABLE_MAXNAMELEN 32 |
Pablo Neira Ayuso | 0768b3b | 2014-02-19 17:27:06 +0100 | [diff] [blame] | 5 | #define NFT_CHAIN_MAXNAMELEN 32 |
| 6 | #define NFT_USERDATA_MAXLEN 256 |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 7 | |
Patrick McHardy | 49499c3 | 2015-04-11 02:27:37 +0100 | [diff] [blame] | 8 | /** |
| 9 | * enum nft_registers - nf_tables registers |
| 10 | * |
| 11 | * nf_tables used to have five registers: a verdict register and four data |
| 12 | * registers of size 16. The data registers have been changed to 16 registers |
| 13 | * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still |
| 14 | * map to areas of size 16, the 4 byte registers are addressed using |
| 15 | * NFT_REG32_00 - NFT_REG32_15. |
| 16 | */ |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 17 | enum nft_registers { |
| 18 | NFT_REG_VERDICT, |
| 19 | NFT_REG_1, |
| 20 | NFT_REG_2, |
| 21 | NFT_REG_3, |
| 22 | NFT_REG_4, |
Patrick McHardy | 49499c3 | 2015-04-11 02:27:37 +0100 | [diff] [blame] | 23 | __NFT_REG_MAX, |
| 24 | |
| 25 | NFT_REG32_00 = 8, |
| 26 | MFT_REG32_01, |
| 27 | NFT_REG32_02, |
| 28 | NFT_REG32_03, |
| 29 | NFT_REG32_04, |
| 30 | NFT_REG32_05, |
| 31 | NFT_REG32_06, |
| 32 | NFT_REG32_07, |
| 33 | NFT_REG32_08, |
| 34 | NFT_REG32_09, |
| 35 | NFT_REG32_10, |
| 36 | NFT_REG32_11, |
| 37 | NFT_REG32_12, |
| 38 | NFT_REG32_13, |
| 39 | NFT_REG32_14, |
| 40 | NFT_REG32_15, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 41 | }; |
| 42 | #define NFT_REG_MAX (__NFT_REG_MAX - 1) |
| 43 | |
Patrick McHardy | 49499c3 | 2015-04-11 02:27:37 +0100 | [diff] [blame] | 44 | #define NFT_REG_SIZE 16 |
| 45 | #define NFT_REG32_SIZE 4 |
| 46 | |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 47 | /** |
| 48 | * enum nft_verdicts - nf_tables internal verdicts |
| 49 | * |
| 50 | * @NFT_CONTINUE: continue evaluation of the current rule |
| 51 | * @NFT_BREAK: terminate evaluation of the current rule |
| 52 | * @NFT_JUMP: push the current chain on the jump stack and jump to a chain |
| 53 | * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack |
| 54 | * @NFT_RETURN: return to the topmost chain on the jump stack |
| 55 | * |
| 56 | * The nf_tables verdicts share their numeric space with the netfilter verdicts. |
| 57 | */ |
| 58 | enum nft_verdicts { |
| 59 | NFT_CONTINUE = -1, |
| 60 | NFT_BREAK = -2, |
| 61 | NFT_JUMP = -3, |
| 62 | NFT_GOTO = -4, |
| 63 | NFT_RETURN = -5, |
| 64 | }; |
| 65 | |
| 66 | /** |
| 67 | * enum nf_tables_msg_types - nf_tables netlink message types |
| 68 | * |
| 69 | * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes) |
| 70 | * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes) |
| 71 | * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes) |
| 72 | * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes) |
| 73 | * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes) |
| 74 | * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes) |
| 75 | * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes) |
| 76 | * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes) |
| 77 | * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes) |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 78 | * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes) |
| 79 | * @NFT_MSG_GETSET: get a set (enum nft_set_attributes) |
| 80 | * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes) |
| 81 | * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes) |
| 82 | * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes) |
| 83 | * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes) |
Pablo Neira Ayuso | 84d7fce | 2014-09-04 14:30:22 +0200 | [diff] [blame] | 84 | * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes) |
| 85 | * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 86 | */ |
| 87 | enum nf_tables_msg_types { |
| 88 | NFT_MSG_NEWTABLE, |
| 89 | NFT_MSG_GETTABLE, |
| 90 | NFT_MSG_DELTABLE, |
| 91 | NFT_MSG_NEWCHAIN, |
| 92 | NFT_MSG_GETCHAIN, |
| 93 | NFT_MSG_DELCHAIN, |
| 94 | NFT_MSG_NEWRULE, |
| 95 | NFT_MSG_GETRULE, |
| 96 | NFT_MSG_DELRULE, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 97 | NFT_MSG_NEWSET, |
| 98 | NFT_MSG_GETSET, |
| 99 | NFT_MSG_DELSET, |
| 100 | NFT_MSG_NEWSETELEM, |
| 101 | NFT_MSG_GETSETELEM, |
| 102 | NFT_MSG_DELSETELEM, |
Pablo Neira Ayuso | 84d7fce | 2014-09-04 14:30:22 +0200 | [diff] [blame] | 103 | NFT_MSG_NEWGEN, |
| 104 | NFT_MSG_GETGEN, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 105 | NFT_MSG_MAX, |
| 106 | }; |
| 107 | |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 108 | /** |
| 109 | * enum nft_list_attributes - nf_tables generic list netlink attributes |
| 110 | * |
| 111 | * @NFTA_LIST_ELEM: list element (NLA_NESTED) |
| 112 | */ |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 113 | enum nft_list_attributes { |
| 114 | NFTA_LIST_UNPEC, |
| 115 | NFTA_LIST_ELEM, |
| 116 | __NFTA_LIST_MAX |
| 117 | }; |
| 118 | #define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1) |
| 119 | |
| 120 | /** |
| 121 | * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes |
| 122 | * |
| 123 | * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32) |
| 124 | * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32) |
Pablo Neira Ayuso | 2cbce13 | 2015-06-12 13:55:41 +0200 | [diff] [blame] | 125 | * @NFTA_HOOK_DEV: netdevice name (NLA_STRING) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 126 | */ |
| 127 | enum nft_hook_attributes { |
| 128 | NFTA_HOOK_UNSPEC, |
| 129 | NFTA_HOOK_HOOKNUM, |
| 130 | NFTA_HOOK_PRIORITY, |
Pablo Neira Ayuso | 2cbce13 | 2015-06-12 13:55:41 +0200 | [diff] [blame] | 131 | NFTA_HOOK_DEV, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 132 | __NFTA_HOOK_MAX |
| 133 | }; |
| 134 | #define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1) |
| 135 | |
| 136 | /** |
Pablo Neira Ayuso | 9ddf632 | 2013-10-10 13:26:33 +0200 | [diff] [blame] | 137 | * enum nft_table_flags - nf_tables table flags |
| 138 | * |
| 139 | * @NFT_TABLE_F_DORMANT: this table is not active |
| 140 | */ |
| 141 | enum nft_table_flags { |
| 142 | NFT_TABLE_F_DORMANT = 0x1, |
| 143 | }; |
| 144 | |
| 145 | /** |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 146 | * enum nft_table_attributes - nf_tables table netlink attributes |
| 147 | * |
| 148 | * @NFTA_TABLE_NAME: name of the table (NLA_STRING) |
Pablo Neira Ayuso | 9ddf632 | 2013-10-10 13:26:33 +0200 | [diff] [blame] | 149 | * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32) |
Tomasz Bursztyka | d8bcc768 | 2013-12-12 15:00:42 +0200 | [diff] [blame] | 150 | * @NFTA_TABLE_USE: number of chains in this table (NLA_U32) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 151 | */ |
| 152 | enum nft_table_attributes { |
| 153 | NFTA_TABLE_UNSPEC, |
| 154 | NFTA_TABLE_NAME, |
Pablo Neira Ayuso | 9ddf632 | 2013-10-10 13:26:33 +0200 | [diff] [blame] | 155 | NFTA_TABLE_FLAGS, |
Tomasz Bursztyka | d8bcc768 | 2013-12-12 15:00:42 +0200 | [diff] [blame] | 156 | NFTA_TABLE_USE, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 157 | __NFTA_TABLE_MAX |
| 158 | }; |
| 159 | #define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1) |
| 160 | |
| 161 | /** |
| 162 | * enum nft_chain_attributes - nf_tables chain netlink attributes |
| 163 | * |
| 164 | * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING) |
| 165 | * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64) |
| 166 | * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING) |
| 167 | * @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] | 168 | * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32) |
| 169 | * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32) |
Pablo Neira Ayuso | 9370761 | 2013-10-10 23:21:26 +0200 | [diff] [blame] | 170 | * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING) |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 171 | * @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] | 172 | */ |
| 173 | enum nft_chain_attributes { |
| 174 | NFTA_CHAIN_UNSPEC, |
| 175 | NFTA_CHAIN_TABLE, |
| 176 | NFTA_CHAIN_HANDLE, |
| 177 | NFTA_CHAIN_NAME, |
| 178 | NFTA_CHAIN_HOOK, |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 179 | NFTA_CHAIN_POLICY, |
| 180 | NFTA_CHAIN_USE, |
Pablo Neira Ayuso | 9370761 | 2013-10-10 23:21:26 +0200 | [diff] [blame] | 181 | NFTA_CHAIN_TYPE, |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 182 | NFTA_CHAIN_COUNTERS, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 183 | __NFTA_CHAIN_MAX |
| 184 | }; |
| 185 | #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) |
| 186 | |
| 187 | /** |
| 188 | * enum nft_rule_attributes - nf_tables rule netlink attributes |
| 189 | * |
| 190 | * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING) |
| 191 | * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING) |
| 192 | * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64) |
| 193 | * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes) |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 194 | * @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] | 195 | * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) |
Pablo Neira Ayuso | 0768b3b | 2014-02-19 17:27:06 +0100 | [diff] [blame] | 196 | * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 197 | */ |
| 198 | enum nft_rule_attributes { |
| 199 | NFTA_RULE_UNSPEC, |
| 200 | NFTA_RULE_TABLE, |
| 201 | NFTA_RULE_CHAIN, |
| 202 | NFTA_RULE_HANDLE, |
| 203 | NFTA_RULE_EXPRESSIONS, |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 204 | NFTA_RULE_COMPAT, |
Eric Leblond | 5e94846 | 2013-10-10 13:41:44 +0200 | [diff] [blame] | 205 | NFTA_RULE_POSITION, |
Pablo Neira Ayuso | 0768b3b | 2014-02-19 17:27:06 +0100 | [diff] [blame] | 206 | NFTA_RULE_USERDATA, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 207 | __NFTA_RULE_MAX |
| 208 | }; |
| 209 | #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) |
| 210 | |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 211 | /** |
Pablo Neira Ayuso | 0ca743a | 2013-10-14 00:06:06 +0200 | [diff] [blame] | 212 | * enum nft_rule_compat_flags - nf_tables rule compat flags |
| 213 | * |
| 214 | * @NFT_RULE_COMPAT_F_INV: invert the check result |
| 215 | */ |
| 216 | enum nft_rule_compat_flags { |
| 217 | NFT_RULE_COMPAT_F_INV = (1 << 1), |
| 218 | NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV, |
| 219 | }; |
| 220 | |
| 221 | /** |
| 222 | * enum nft_rule_compat_attributes - nf_tables rule compat attributes |
| 223 | * |
| 224 | * @NFTA_RULE_COMPAT_PROTO: numerice value of handled protocol (NLA_U32) |
| 225 | * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32) |
| 226 | */ |
| 227 | enum nft_rule_compat_attributes { |
| 228 | NFTA_RULE_COMPAT_UNSPEC, |
| 229 | NFTA_RULE_COMPAT_PROTO, |
| 230 | NFTA_RULE_COMPAT_FLAGS, |
| 231 | __NFTA_RULE_COMPAT_MAX |
| 232 | }; |
| 233 | #define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1) |
| 234 | |
| 235 | /** |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 236 | * enum nft_set_flags - nf_tables set flags |
| 237 | * |
| 238 | * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink |
| 239 | * @NFT_SET_CONSTANT: set contents may not change while bound |
| 240 | * @NFT_SET_INTERVAL: set contains intervals |
| 241 | * @NFT_SET_MAP: set is used as a dictionary |
Patrick McHardy | 761da29 | 2015-03-26 12:39:36 +0000 | [diff] [blame] | 242 | * @NFT_SET_TIMEOUT: set uses timeouts |
Patrick McHardy | 7c6c6e9 | 2015-04-11 10:46:41 +0100 | [diff] [blame] | 243 | * @NFT_SET_EVAL: set contains expressions for evaluation |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 244 | */ |
| 245 | enum nft_set_flags { |
| 246 | NFT_SET_ANONYMOUS = 0x1, |
| 247 | NFT_SET_CONSTANT = 0x2, |
| 248 | NFT_SET_INTERVAL = 0x4, |
| 249 | NFT_SET_MAP = 0x8, |
Patrick McHardy | 761da29 | 2015-03-26 12:39:36 +0000 | [diff] [blame] | 250 | NFT_SET_TIMEOUT = 0x10, |
Patrick McHardy | 7c6c6e9 | 2015-04-11 10:46:41 +0100 | [diff] [blame] | 251 | NFT_SET_EVAL = 0x20, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 252 | }; |
| 253 | |
| 254 | /** |
Patrick McHardy | c50b960 | 2014-03-28 10:19:47 +0000 | [diff] [blame] | 255 | * enum nft_set_policies - set selection policy |
| 256 | * |
| 257 | * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use |
| 258 | * @NFT_SET_POL_MEMORY: prefer low memory use over high performance |
| 259 | */ |
| 260 | enum nft_set_policies { |
| 261 | NFT_SET_POL_PERFORMANCE, |
| 262 | NFT_SET_POL_MEMORY, |
| 263 | }; |
| 264 | |
| 265 | /** |
| 266 | * enum nft_set_desc_attributes - set element description |
| 267 | * |
| 268 | * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32) |
| 269 | */ |
| 270 | enum nft_set_desc_attributes { |
| 271 | NFTA_SET_DESC_UNSPEC, |
| 272 | NFTA_SET_DESC_SIZE, |
| 273 | __NFTA_SET_DESC_MAX |
| 274 | }; |
| 275 | #define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1) |
| 276 | |
| 277 | /** |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 278 | * enum nft_set_attributes - nf_tables set netlink attributes |
| 279 | * |
| 280 | * @NFTA_SET_TABLE: table name (NLA_STRING) |
| 281 | * @NFTA_SET_NAME: set name (NLA_STRING) |
| 282 | * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32) |
| 283 | * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32) |
| 284 | * @NFTA_SET_KEY_LEN: key data length (NLA_U32) |
| 285 | * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32) |
| 286 | * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) |
Patrick McHardy | c50b960 | 2014-03-28 10:19:47 +0000 | [diff] [blame] | 287 | * @NFTA_SET_POLICY: selection policy (NLA_U32) |
| 288 | * @NFTA_SET_DESC: set description (NLA_NESTED) |
Pablo Neira Ayuso | 958bee1 | 2014-04-03 11:48:44 +0200 | [diff] [blame] | 289 | * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32) |
Patrick McHardy | 761da29 | 2015-03-26 12:39:36 +0000 | [diff] [blame] | 290 | * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64) |
| 291 | * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32) |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 292 | */ |
| 293 | enum nft_set_attributes { |
| 294 | NFTA_SET_UNSPEC, |
| 295 | NFTA_SET_TABLE, |
| 296 | NFTA_SET_NAME, |
| 297 | NFTA_SET_FLAGS, |
| 298 | NFTA_SET_KEY_TYPE, |
| 299 | NFTA_SET_KEY_LEN, |
| 300 | NFTA_SET_DATA_TYPE, |
| 301 | NFTA_SET_DATA_LEN, |
Patrick McHardy | c50b960 | 2014-03-28 10:19:47 +0000 | [diff] [blame] | 302 | NFTA_SET_POLICY, |
| 303 | NFTA_SET_DESC, |
Pablo Neira Ayuso | 958bee1 | 2014-04-03 11:48:44 +0200 | [diff] [blame] | 304 | NFTA_SET_ID, |
Patrick McHardy | 761da29 | 2015-03-26 12:39:36 +0000 | [diff] [blame] | 305 | NFTA_SET_TIMEOUT, |
| 306 | NFTA_SET_GC_INTERVAL, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 307 | __NFTA_SET_MAX |
| 308 | }; |
| 309 | #define NFTA_SET_MAX (__NFTA_SET_MAX - 1) |
| 310 | |
| 311 | /** |
| 312 | * enum nft_set_elem_flags - nf_tables set element flags |
| 313 | * |
| 314 | * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval |
| 315 | */ |
| 316 | enum nft_set_elem_flags { |
| 317 | NFT_SET_ELEM_INTERVAL_END = 0x1, |
| 318 | }; |
| 319 | |
| 320 | /** |
| 321 | * enum nft_set_elem_attributes - nf_tables set element netlink attributes |
| 322 | * |
| 323 | * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data) |
| 324 | * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes) |
| 325 | * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32) |
Patrick McHardy | c3e1b00 | 2015-03-26 12:39:37 +0000 | [diff] [blame] | 326 | * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64) |
| 327 | * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64) |
Patrick McHardy | 68e942e | 2015-04-05 14:43:38 +0200 | [diff] [blame] | 328 | * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY) |
Patrick McHardy | f25ad2e | 2015-04-11 10:46:39 +0100 | [diff] [blame] | 329 | * @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes) |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 330 | */ |
| 331 | enum nft_set_elem_attributes { |
| 332 | NFTA_SET_ELEM_UNSPEC, |
| 333 | NFTA_SET_ELEM_KEY, |
| 334 | NFTA_SET_ELEM_DATA, |
| 335 | NFTA_SET_ELEM_FLAGS, |
Patrick McHardy | c3e1b00 | 2015-03-26 12:39:37 +0000 | [diff] [blame] | 336 | NFTA_SET_ELEM_TIMEOUT, |
| 337 | NFTA_SET_ELEM_EXPIRATION, |
Patrick McHardy | 68e942e | 2015-04-05 14:43:38 +0200 | [diff] [blame] | 338 | NFTA_SET_ELEM_USERDATA, |
Patrick McHardy | f25ad2e | 2015-04-11 10:46:39 +0100 | [diff] [blame] | 339 | NFTA_SET_ELEM_EXPR, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 340 | __NFTA_SET_ELEM_MAX |
| 341 | }; |
| 342 | #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1) |
| 343 | |
| 344 | /** |
| 345 | * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes |
| 346 | * |
| 347 | * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) |
| 348 | * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) |
| 349 | * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) |
Pablo Neira Ayuso | 958bee1 | 2014-04-03 11:48:44 +0200 | [diff] [blame] | 350 | * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32) |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 351 | */ |
| 352 | enum nft_set_elem_list_attributes { |
| 353 | NFTA_SET_ELEM_LIST_UNSPEC, |
| 354 | NFTA_SET_ELEM_LIST_TABLE, |
| 355 | NFTA_SET_ELEM_LIST_SET, |
| 356 | NFTA_SET_ELEM_LIST_ELEMENTS, |
Pablo Neira Ayuso | 958bee1 | 2014-04-03 11:48:44 +0200 | [diff] [blame] | 357 | NFTA_SET_ELEM_LIST_SET_ID, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 358 | __NFTA_SET_ELEM_LIST_MAX |
| 359 | }; |
| 360 | #define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) |
| 361 | |
| 362 | /** |
| 363 | * enum nft_data_types - nf_tables data types |
| 364 | * |
| 365 | * @NFT_DATA_VALUE: generic data |
| 366 | * @NFT_DATA_VERDICT: netfilter verdict |
| 367 | * |
| 368 | * The type of data is usually determined by the kernel directly and is not |
| 369 | * explicitly specified by userspace. The only difference are sets, where |
| 370 | * userspace specifies the key and mapping data types. |
| 371 | * |
| 372 | * The values 0xffffff00-0xffffffff are reserved for internally used types. |
| 373 | * The remaining range can be freely used by userspace to encode types, all |
| 374 | * values are equivalent to NFT_DATA_VALUE. |
| 375 | */ |
| 376 | enum nft_data_types { |
| 377 | NFT_DATA_VALUE, |
| 378 | NFT_DATA_VERDICT = 0xffffff00U, |
| 379 | }; |
| 380 | |
| 381 | #define NFT_DATA_RESERVED_MASK 0xffffff00U |
| 382 | |
| 383 | /** |
| 384 | * enum nft_data_attributes - nf_tables data netlink attributes |
| 385 | * |
| 386 | * @NFTA_DATA_VALUE: generic data (NLA_BINARY) |
| 387 | * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes) |
| 388 | */ |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 389 | enum nft_data_attributes { |
| 390 | NFTA_DATA_UNSPEC, |
| 391 | NFTA_DATA_VALUE, |
| 392 | NFTA_DATA_VERDICT, |
| 393 | __NFTA_DATA_MAX |
| 394 | }; |
| 395 | #define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1) |
| 396 | |
Patrick McHardy | 7d74026 | 2015-04-11 02:27:39 +0100 | [diff] [blame] | 397 | /* Maximum length of a value */ |
| 398 | #define NFT_DATA_VALUE_MAXLEN 64 |
| 399 | |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 400 | /** |
| 401 | * enum nft_verdict_attributes - nf_tables verdict netlink attributes |
| 402 | * |
| 403 | * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts) |
| 404 | * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING) |
| 405 | */ |
| 406 | enum nft_verdict_attributes { |
| 407 | NFTA_VERDICT_UNSPEC, |
| 408 | NFTA_VERDICT_CODE, |
| 409 | NFTA_VERDICT_CHAIN, |
| 410 | __NFTA_VERDICT_MAX |
| 411 | }; |
| 412 | #define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1) |
| 413 | |
| 414 | /** |
| 415 | * enum nft_expr_attributes - nf_tables expression netlink attributes |
| 416 | * |
| 417 | * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING) |
| 418 | * @NFTA_EXPR_DATA: type specific data (NLA_NESTED) |
| 419 | */ |
| 420 | enum nft_expr_attributes { |
| 421 | NFTA_EXPR_UNSPEC, |
| 422 | NFTA_EXPR_NAME, |
| 423 | NFTA_EXPR_DATA, |
| 424 | __NFTA_EXPR_MAX |
| 425 | }; |
| 426 | #define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1) |
| 427 | |
| 428 | /** |
| 429 | * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes |
| 430 | * |
| 431 | * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32) |
| 432 | * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes) |
| 433 | */ |
| 434 | enum nft_immediate_attributes { |
| 435 | NFTA_IMMEDIATE_UNSPEC, |
| 436 | NFTA_IMMEDIATE_DREG, |
| 437 | NFTA_IMMEDIATE_DATA, |
| 438 | __NFTA_IMMEDIATE_MAX |
| 439 | }; |
| 440 | #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1) |
| 441 | |
| 442 | /** |
| 443 | * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes |
| 444 | * |
| 445 | * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers) |
| 446 | * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers) |
| 447 | * @NFTA_BITWISE_LEN: length of operands (NLA_U32) |
| 448 | * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes) |
| 449 | * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes) |
| 450 | * |
| 451 | * The bitwise expression performs the following operation: |
| 452 | * |
| 453 | * dreg = (sreg & mask) ^ xor |
| 454 | * |
| 455 | * which allow to express all bitwise operations: |
| 456 | * |
| 457 | * mask xor |
| 458 | * NOT: 1 1 |
| 459 | * OR: 0 x |
| 460 | * XOR: 1 x |
| 461 | * AND: x 0 |
| 462 | */ |
| 463 | enum nft_bitwise_attributes { |
| 464 | NFTA_BITWISE_UNSPEC, |
| 465 | NFTA_BITWISE_SREG, |
| 466 | NFTA_BITWISE_DREG, |
| 467 | NFTA_BITWISE_LEN, |
| 468 | NFTA_BITWISE_MASK, |
| 469 | NFTA_BITWISE_XOR, |
| 470 | __NFTA_BITWISE_MAX |
| 471 | }; |
| 472 | #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1) |
| 473 | |
| 474 | /** |
| 475 | * enum nft_byteorder_ops - nf_tables byteorder operators |
| 476 | * |
| 477 | * @NFT_BYTEORDER_NTOH: network to host operator |
| 478 | * @NFT_BYTEORDER_HTON: host to network opertaor |
| 479 | */ |
| 480 | enum nft_byteorder_ops { |
| 481 | NFT_BYTEORDER_NTOH, |
| 482 | NFT_BYTEORDER_HTON, |
| 483 | }; |
| 484 | |
| 485 | /** |
| 486 | * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes |
| 487 | * |
| 488 | * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers) |
| 489 | * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers) |
| 490 | * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops) |
| 491 | * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32) |
| 492 | * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4) |
| 493 | */ |
| 494 | enum nft_byteorder_attributes { |
| 495 | NFTA_BYTEORDER_UNSPEC, |
| 496 | NFTA_BYTEORDER_SREG, |
| 497 | NFTA_BYTEORDER_DREG, |
| 498 | NFTA_BYTEORDER_OP, |
| 499 | NFTA_BYTEORDER_LEN, |
| 500 | NFTA_BYTEORDER_SIZE, |
| 501 | __NFTA_BYTEORDER_MAX |
| 502 | }; |
| 503 | #define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1) |
| 504 | |
| 505 | /** |
| 506 | * enum nft_cmp_ops - nf_tables relational operator |
| 507 | * |
| 508 | * @NFT_CMP_EQ: equal |
| 509 | * @NFT_CMP_NEQ: not equal |
| 510 | * @NFT_CMP_LT: less than |
| 511 | * @NFT_CMP_LTE: less than or equal to |
| 512 | * @NFT_CMP_GT: greater than |
| 513 | * @NFT_CMP_GTE: greater than or equal to |
| 514 | */ |
| 515 | enum nft_cmp_ops { |
| 516 | NFT_CMP_EQ, |
| 517 | NFT_CMP_NEQ, |
| 518 | NFT_CMP_LT, |
| 519 | NFT_CMP_LTE, |
| 520 | NFT_CMP_GT, |
| 521 | NFT_CMP_GTE, |
| 522 | }; |
| 523 | |
| 524 | /** |
| 525 | * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes |
| 526 | * |
| 527 | * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers) |
| 528 | * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops) |
| 529 | * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes) |
| 530 | */ |
| 531 | enum nft_cmp_attributes { |
| 532 | NFTA_CMP_UNSPEC, |
| 533 | NFTA_CMP_SREG, |
| 534 | NFTA_CMP_OP, |
| 535 | NFTA_CMP_DATA, |
| 536 | __NFTA_CMP_MAX |
| 537 | }; |
| 538 | #define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1) |
| 539 | |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 540 | /** |
| 541 | * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes |
| 542 | * |
| 543 | * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) |
| 544 | * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) |
| 545 | * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) |
Pablo Neira Ayuso | 958bee1 | 2014-04-03 11:48:44 +0200 | [diff] [blame] | 546 | * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32) |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 547 | */ |
| 548 | enum nft_lookup_attributes { |
| 549 | NFTA_LOOKUP_UNSPEC, |
| 550 | NFTA_LOOKUP_SET, |
| 551 | NFTA_LOOKUP_SREG, |
| 552 | NFTA_LOOKUP_DREG, |
Pablo Neira Ayuso | 958bee1 | 2014-04-03 11:48:44 +0200 | [diff] [blame] | 553 | NFTA_LOOKUP_SET_ID, |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 554 | __NFTA_LOOKUP_MAX |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 555 | }; |
Patrick McHardy | 20a6934 | 2013-10-11 12:06:22 +0200 | [diff] [blame] | 556 | #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 557 | |
Patrick McHardy | 22fe54d | 2015-04-05 14:41:08 +0200 | [diff] [blame] | 558 | enum nft_dynset_ops { |
| 559 | NFT_DYNSET_OP_ADD, |
| 560 | NFT_DYNSET_OP_UPDATE, |
| 561 | }; |
| 562 | |
| 563 | /** |
| 564 | * enum nft_dynset_attributes - dynset expression attributes |
| 565 | * |
| 566 | * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING) |
| 567 | * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32) |
| 568 | * @NFTA_DYNSET_OP: operation (NLA_U32) |
| 569 | * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32) |
| 570 | * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32) |
| 571 | * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64) |
Patrick McHardy | 3e135cd | 2015-04-11 10:46:42 +0100 | [diff] [blame] | 572 | * @NFTA_DYNSET_EXPR: expression (NLA_NESTED: nft_expr_attributes) |
Patrick McHardy | 22fe54d | 2015-04-05 14:41:08 +0200 | [diff] [blame] | 573 | */ |
| 574 | enum nft_dynset_attributes { |
| 575 | NFTA_DYNSET_UNSPEC, |
| 576 | NFTA_DYNSET_SET_NAME, |
| 577 | NFTA_DYNSET_SET_ID, |
| 578 | NFTA_DYNSET_OP, |
| 579 | NFTA_DYNSET_SREG_KEY, |
| 580 | NFTA_DYNSET_SREG_DATA, |
| 581 | NFTA_DYNSET_TIMEOUT, |
Patrick McHardy | 3e135cd | 2015-04-11 10:46:42 +0100 | [diff] [blame] | 582 | NFTA_DYNSET_EXPR, |
Patrick McHardy | 22fe54d | 2015-04-05 14:41:08 +0200 | [diff] [blame] | 583 | __NFTA_DYNSET_MAX, |
| 584 | }; |
| 585 | #define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1) |
| 586 | |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 587 | /** |
| 588 | * enum nft_payload_bases - nf_tables payload expression offset bases |
| 589 | * |
| 590 | * @NFT_PAYLOAD_LL_HEADER: link layer header |
| 591 | * @NFT_PAYLOAD_NETWORK_HEADER: network header |
| 592 | * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header |
| 593 | */ |
| 594 | enum nft_payload_bases { |
| 595 | NFT_PAYLOAD_LL_HEADER, |
| 596 | NFT_PAYLOAD_NETWORK_HEADER, |
| 597 | NFT_PAYLOAD_TRANSPORT_HEADER, |
| 598 | }; |
| 599 | |
| 600 | /** |
| 601 | * enum nft_payload_attributes - nf_tables payload expression netlink attributes |
| 602 | * |
| 603 | * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers) |
| 604 | * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases) |
| 605 | * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32) |
| 606 | * @NFTA_PAYLOAD_LEN: payload length (NLA_U32) |
| 607 | */ |
| 608 | enum nft_payload_attributes { |
| 609 | NFTA_PAYLOAD_UNSPEC, |
| 610 | NFTA_PAYLOAD_DREG, |
| 611 | NFTA_PAYLOAD_BASE, |
| 612 | NFTA_PAYLOAD_OFFSET, |
| 613 | NFTA_PAYLOAD_LEN, |
| 614 | __NFTA_PAYLOAD_MAX |
| 615 | }; |
| 616 | #define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1) |
| 617 | |
| 618 | /** |
| 619 | * enum nft_exthdr_attributes - nf_tables IPv6 extension header expression netlink attributes |
| 620 | * |
| 621 | * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers) |
| 622 | * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8) |
| 623 | * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32) |
| 624 | * @NFTA_EXTHDR_LEN: extension header length (NLA_U32) |
| 625 | */ |
| 626 | enum nft_exthdr_attributes { |
| 627 | NFTA_EXTHDR_UNSPEC, |
| 628 | NFTA_EXTHDR_DREG, |
| 629 | NFTA_EXTHDR_TYPE, |
| 630 | NFTA_EXTHDR_OFFSET, |
| 631 | NFTA_EXTHDR_LEN, |
| 632 | __NFTA_EXTHDR_MAX |
| 633 | }; |
| 634 | #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1) |
| 635 | |
| 636 | /** |
| 637 | * enum nft_meta_keys - nf_tables meta expression keys |
| 638 | * |
| 639 | * @NFT_META_LEN: packet length (skb->len) |
| 640 | * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT |
| 641 | * @NFT_META_PRIORITY: packet priority (skb->priority) |
| 642 | * @NFT_META_MARK: packet mark (skb->mark) |
| 643 | * @NFT_META_IIF: packet input interface index (dev->ifindex) |
| 644 | * @NFT_META_OIF: packet output interface index (dev->ifindex) |
| 645 | * @NFT_META_IIFNAME: packet input interface name (dev->name) |
| 646 | * @NFT_META_OIFNAME: packet output interface name (dev->name) |
| 647 | * @NFT_META_IIFTYPE: packet input interface type (dev->type) |
| 648 | * @NFT_META_OIFTYPE: packet output interface type (dev->type) |
| 649 | * @NFT_META_SKUID: originating socket UID (fsuid) |
| 650 | * @NFT_META_SKGID: originating socket GID (fsgid) |
| 651 | * @NFT_META_NFTRACE: packet nftrace bit |
| 652 | * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid) |
| 653 | * @NFT_META_SECMARK: packet secmark (skb->secmark) |
Patrick McHardy | 124edfa | 2014-01-03 12:16:17 +0000 | [diff] [blame] | 654 | * @NFT_META_NFPROTO: netfilter protocol |
Patrick McHardy | 4566bf2 | 2014-01-03 12:16:18 +0000 | [diff] [blame] | 655 | * @NFT_META_L4PROTO: layer 4 protocol number |
Tomasz Bursztyka | f5efc69 | 2014-04-14 15:41:28 +0300 | [diff] [blame] | 656 | * @NFT_META_BRI_IIFNAME: packet input bridge interface name |
| 657 | * @NFT_META_BRI_OIFNAME: packet output bridge interface name |
Ana Rey | e2a093f | 2014-08-06 13:52:49 +0200 | [diff] [blame] | 658 | * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback |
Ana Rey | afc5be30 | 2014-08-24 14:08:36 +0200 | [diff] [blame] | 659 | * @NFT_META_CPU: cpu id through smp_processor_id() |
Ana Rey | 3045d76 | 2014-09-02 20:36:14 +0200 | [diff] [blame] | 660 | * @NFT_META_IIFGROUP: packet input interface group |
| 661 | * @NFT_META_OIFGROUP: packet output interface group |
Ana Rey | ce67417 | 2014-11-03 18:10:50 +0100 | [diff] [blame] | 662 | * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 663 | */ |
| 664 | enum nft_meta_keys { |
| 665 | NFT_META_LEN, |
| 666 | NFT_META_PROTOCOL, |
| 667 | NFT_META_PRIORITY, |
| 668 | NFT_META_MARK, |
| 669 | NFT_META_IIF, |
| 670 | NFT_META_OIF, |
| 671 | NFT_META_IIFNAME, |
| 672 | NFT_META_OIFNAME, |
| 673 | NFT_META_IIFTYPE, |
| 674 | NFT_META_OIFTYPE, |
| 675 | NFT_META_SKUID, |
| 676 | NFT_META_SKGID, |
| 677 | NFT_META_NFTRACE, |
| 678 | NFT_META_RTCLASSID, |
| 679 | NFT_META_SECMARK, |
Patrick McHardy | 124edfa | 2014-01-03 12:16:17 +0000 | [diff] [blame] | 680 | NFT_META_NFPROTO, |
Patrick McHardy | 4566bf2 | 2014-01-03 12:16:18 +0000 | [diff] [blame] | 681 | NFT_META_L4PROTO, |
Tomasz Bursztyka | f5efc69 | 2014-04-14 15:41:28 +0300 | [diff] [blame] | 682 | NFT_META_BRI_IIFNAME, |
| 683 | NFT_META_BRI_OIFNAME, |
Ana Rey | e2a093f | 2014-08-06 13:52:49 +0200 | [diff] [blame] | 684 | NFT_META_PKTTYPE, |
Ana Rey | afc5be30 | 2014-08-24 14:08:36 +0200 | [diff] [blame] | 685 | NFT_META_CPU, |
Ana Rey | 3045d76 | 2014-09-02 20:36:14 +0200 | [diff] [blame] | 686 | NFT_META_IIFGROUP, |
| 687 | NFT_META_OIFGROUP, |
Ana Rey | ce67417 | 2014-11-03 18:10:50 +0100 | [diff] [blame] | 688 | NFT_META_CGROUP, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 689 | }; |
| 690 | |
| 691 | /** |
| 692 | * enum nft_meta_attributes - nf_tables meta expression netlink attributes |
| 693 | * |
| 694 | * @NFTA_META_DREG: destination register (NLA_U32) |
| 695 | * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys) |
Arturo Borrero Gonzalez | e035b77 | 2013-12-26 16:38:01 +0100 | [diff] [blame] | 696 | * @NFTA_META_SREG: source register (NLA_U32) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 697 | */ |
| 698 | enum nft_meta_attributes { |
| 699 | NFTA_META_UNSPEC, |
| 700 | NFTA_META_DREG, |
| 701 | NFTA_META_KEY, |
Arturo Borrero Gonzalez | e035b77 | 2013-12-26 16:38:01 +0100 | [diff] [blame] | 702 | NFTA_META_SREG, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 703 | __NFTA_META_MAX |
| 704 | }; |
| 705 | #define NFTA_META_MAX (__NFTA_META_MAX - 1) |
| 706 | |
| 707 | /** |
| 708 | * enum nft_ct_keys - nf_tables ct expression keys |
| 709 | * |
| 710 | * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info) |
| 711 | * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir) |
| 712 | * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status) |
| 713 | * @NFT_CT_MARK: conntrack mark value |
| 714 | * @NFT_CT_SECMARK: conntrack secmark value |
| 715 | * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms |
| 716 | * @NFT_CT_HELPER: connection tracking helper assigned to conntrack |
| 717 | * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol |
| 718 | * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address) |
| 719 | * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address) |
| 720 | * @NFT_CT_PROTOCOL: conntrack layer 4 protocol |
| 721 | * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source |
| 722 | * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination |
| 723 | */ |
| 724 | enum nft_ct_keys { |
| 725 | NFT_CT_STATE, |
| 726 | NFT_CT_DIRECTION, |
| 727 | NFT_CT_STATUS, |
| 728 | NFT_CT_MARK, |
| 729 | NFT_CT_SECMARK, |
| 730 | NFT_CT_EXPIRATION, |
| 731 | NFT_CT_HELPER, |
| 732 | NFT_CT_L3PROTOCOL, |
| 733 | NFT_CT_SRC, |
| 734 | NFT_CT_DST, |
| 735 | NFT_CT_PROTOCOL, |
| 736 | NFT_CT_PROTO_SRC, |
| 737 | NFT_CT_PROTO_DST, |
Florian Westphal | d2bf2f3 | 2014-02-18 15:25:32 +0100 | [diff] [blame] | 738 | NFT_CT_LABELS, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 739 | }; |
| 740 | |
| 741 | /** |
| 742 | * enum nft_ct_attributes - nf_tables ct expression netlink attributes |
| 743 | * |
| 744 | * @NFTA_CT_DREG: destination register (NLA_U32) |
| 745 | * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys) |
| 746 | * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8) |
Kristian Evensen | c4ede3d | 2014-01-07 16:43:54 +0100 | [diff] [blame] | 747 | * @NFTA_CT_SREG: source register (NLA_U32) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 748 | */ |
| 749 | enum nft_ct_attributes { |
| 750 | NFTA_CT_UNSPEC, |
| 751 | NFTA_CT_DREG, |
| 752 | NFTA_CT_KEY, |
| 753 | NFTA_CT_DIRECTION, |
Kristian Evensen | c4ede3d | 2014-01-07 16:43:54 +0100 | [diff] [blame] | 754 | NFTA_CT_SREG, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 755 | __NFTA_CT_MAX |
| 756 | }; |
| 757 | #define NFTA_CT_MAX (__NFTA_CT_MAX - 1) |
| 758 | |
Pablo Neira Ayuso | d2168e8 | 2015-08-05 12:38:44 +0200 | [diff] [blame^] | 759 | enum nft_limit_type { |
| 760 | NFT_LIMIT_PKTS, |
| 761 | NFT_LIMIT_PKT_BYTES |
| 762 | }; |
| 763 | |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 764 | /** |
| 765 | * enum nft_limit_attributes - nf_tables limit expression netlink attributes |
| 766 | * |
| 767 | * @NFTA_LIMIT_RATE: refill rate (NLA_U64) |
| 768 | * @NFTA_LIMIT_UNIT: refill unit (NLA_U64) |
Pablo Neira Ayuso | 3e87baa | 2015-08-02 18:02:14 +0200 | [diff] [blame] | 769 | * @NFTA_LIMIT_BURST: burst (NLA_U32) |
Pablo Neira Ayuso | d2168e8 | 2015-08-05 12:38:44 +0200 | [diff] [blame^] | 770 | * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 771 | */ |
| 772 | enum nft_limit_attributes { |
| 773 | NFTA_LIMIT_UNSPEC, |
| 774 | NFTA_LIMIT_RATE, |
| 775 | NFTA_LIMIT_UNIT, |
Pablo Neira Ayuso | 3e87baa | 2015-08-02 18:02:14 +0200 | [diff] [blame] | 776 | NFTA_LIMIT_BURST, |
Pablo Neira Ayuso | d2168e8 | 2015-08-05 12:38:44 +0200 | [diff] [blame^] | 777 | NFTA_LIMIT_TYPE, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 778 | __NFTA_LIMIT_MAX |
| 779 | }; |
| 780 | #define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1) |
| 781 | |
| 782 | /** |
| 783 | * enum nft_counter_attributes - nf_tables counter expression netlink attributes |
| 784 | * |
| 785 | * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64) |
| 786 | * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64) |
| 787 | */ |
| 788 | enum nft_counter_attributes { |
| 789 | NFTA_COUNTER_UNSPEC, |
| 790 | NFTA_COUNTER_BYTES, |
| 791 | NFTA_COUNTER_PACKETS, |
| 792 | __NFTA_COUNTER_MAX |
| 793 | }; |
| 794 | #define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1) |
| 795 | |
| 796 | /** |
| 797 | * enum nft_log_attributes - nf_tables log expression netlink attributes |
| 798 | * |
| 799 | * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32) |
| 800 | * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING) |
| 801 | * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32) |
| 802 | * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32) |
Pablo Neira Ayuso | 09d27b8 | 2014-06-25 13:37:13 +0200 | [diff] [blame] | 803 | * @NFTA_LOG_LEVEL: log level (NLA_U32) |
| 804 | * @NFTA_LOG_FLAGS: logging flags (NLA_U32) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 805 | */ |
| 806 | enum nft_log_attributes { |
| 807 | NFTA_LOG_UNSPEC, |
| 808 | NFTA_LOG_GROUP, |
| 809 | NFTA_LOG_PREFIX, |
| 810 | NFTA_LOG_SNAPLEN, |
| 811 | NFTA_LOG_QTHRESHOLD, |
Pablo Neira Ayuso | 09d27b8 | 2014-06-25 13:37:13 +0200 | [diff] [blame] | 812 | NFTA_LOG_LEVEL, |
| 813 | NFTA_LOG_FLAGS, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 814 | __NFTA_LOG_MAX |
| 815 | }; |
| 816 | #define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1) |
| 817 | |
| 818 | /** |
Eric Leblond | 0aff078 | 2013-12-06 00:24:13 +0100 | [diff] [blame] | 819 | * enum nft_queue_attributes - nf_tables queue expression netlink attributes |
| 820 | * |
| 821 | * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16) |
| 822 | * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16) |
| 823 | * @NFTA_QUEUE_FLAGS: various flags (NLA_U16) |
| 824 | */ |
| 825 | enum nft_queue_attributes { |
| 826 | NFTA_QUEUE_UNSPEC, |
| 827 | NFTA_QUEUE_NUM, |
| 828 | NFTA_QUEUE_TOTAL, |
| 829 | NFTA_QUEUE_FLAGS, |
| 830 | __NFTA_QUEUE_MAX |
| 831 | }; |
| 832 | #define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1) |
| 833 | |
| 834 | #define NFT_QUEUE_FLAG_BYPASS 0x01 /* for compatibility with v2 */ |
| 835 | #define NFT_QUEUE_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ |
| 836 | #define NFT_QUEUE_FLAG_MASK 0x03 |
| 837 | |
| 838 | /** |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 839 | * enum nft_reject_types - nf_tables reject expression reject types |
| 840 | * |
| 841 | * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable |
| 842 | * @NFT_REJECT_TCP_RST: reject using TCP RST |
Pablo Neira Ayuso | 51b0a5d | 2014-09-26 14:35:14 +0200 | [diff] [blame] | 843 | * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 844 | */ |
| 845 | enum nft_reject_types { |
| 846 | NFT_REJECT_ICMP_UNREACH, |
| 847 | NFT_REJECT_TCP_RST, |
Pablo Neira Ayuso | 51b0a5d | 2014-09-26 14:35:14 +0200 | [diff] [blame] | 848 | NFT_REJECT_ICMPX_UNREACH, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 849 | }; |
| 850 | |
| 851 | /** |
Pablo Neira Ayuso | 51b0a5d | 2014-09-26 14:35:14 +0200 | [diff] [blame] | 852 | * enum nft_reject_code - Generic reject codes for IPv4/IPv6 |
| 853 | * |
| 854 | * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable |
| 855 | * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable |
| 856 | * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable |
| 857 | * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited |
| 858 | * |
| 859 | * These codes are mapped to real ICMP and ICMPv6 codes. |
| 860 | */ |
| 861 | enum nft_reject_inet_code { |
| 862 | NFT_REJECT_ICMPX_NO_ROUTE = 0, |
| 863 | NFT_REJECT_ICMPX_PORT_UNREACH, |
| 864 | NFT_REJECT_ICMPX_HOST_UNREACH, |
| 865 | NFT_REJECT_ICMPX_ADMIN_PROHIBITED, |
| 866 | __NFT_REJECT_ICMPX_MAX |
| 867 | }; |
Pablo Neira Ayuso | f0d1f04 | 2014-10-07 19:02:11 +0200 | [diff] [blame] | 868 | #define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1) |
Pablo Neira Ayuso | 51b0a5d | 2014-09-26 14:35:14 +0200 | [diff] [blame] | 869 | |
| 870 | /** |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 871 | * enum nft_reject_attributes - nf_tables reject expression netlink attributes |
| 872 | * |
| 873 | * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types) |
| 874 | * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8) |
| 875 | */ |
| 876 | enum nft_reject_attributes { |
| 877 | NFTA_REJECT_UNSPEC, |
| 878 | NFTA_REJECT_TYPE, |
| 879 | NFTA_REJECT_ICMP_CODE, |
| 880 | __NFTA_REJECT_MAX |
| 881 | }; |
| 882 | #define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1) |
| 883 | |
| 884 | /** |
| 885 | * enum nft_nat_types - nf_tables nat expression NAT types |
| 886 | * |
| 887 | * @NFT_NAT_SNAT: source NAT |
| 888 | * @NFT_NAT_DNAT: destination NAT |
| 889 | */ |
| 890 | enum nft_nat_types { |
| 891 | NFT_NAT_SNAT, |
| 892 | NFT_NAT_DNAT, |
| 893 | }; |
| 894 | |
| 895 | /** |
| 896 | * enum nft_nat_attributes - nf_tables nat expression netlink attributes |
| 897 | * |
| 898 | * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types) |
Tomasz Bursztyka | eb31628 | 2013-10-10 13:39:19 +0200 | [diff] [blame] | 899 | * @NFTA_NAT_FAMILY: NAT family (NLA_U32) |
| 900 | * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers) |
| 901 | * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers) |
| 902 | * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) |
| 903 | * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) |
Arturo Borrero | e42eff8 | 2014-09-04 14:06:14 +0200 | [diff] [blame] | 904 | * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 905 | */ |
| 906 | enum nft_nat_attributes { |
| 907 | NFTA_NAT_UNSPEC, |
| 908 | NFTA_NAT_TYPE, |
Tomasz Bursztyka | eb31628 | 2013-10-10 13:39:19 +0200 | [diff] [blame] | 909 | NFTA_NAT_FAMILY, |
| 910 | NFTA_NAT_REG_ADDR_MIN, |
| 911 | NFTA_NAT_REG_ADDR_MAX, |
| 912 | NFTA_NAT_REG_PROTO_MIN, |
| 913 | NFTA_NAT_REG_PROTO_MAX, |
Arturo Borrero | e42eff8 | 2014-09-04 14:06:14 +0200 | [diff] [blame] | 914 | NFTA_NAT_FLAGS, |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 915 | __NFTA_NAT_MAX |
| 916 | }; |
| 917 | #define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1) |
| 918 | |
Arturo Borrero | 9ba1f726 | 2014-09-08 13:45:00 +0200 | [diff] [blame] | 919 | /** |
| 920 | * enum nft_masq_attributes - nf_tables masquerade expression attributes |
| 921 | * |
| 922 | * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) |
| 923 | */ |
| 924 | enum nft_masq_attributes { |
Pablo Neira Ayuso | 39e393b | 2014-09-11 11:02:39 +0200 | [diff] [blame] | 925 | NFTA_MASQ_UNSPEC, |
Arturo Borrero | 9ba1f726 | 2014-09-08 13:45:00 +0200 | [diff] [blame] | 926 | NFTA_MASQ_FLAGS, |
| 927 | __NFTA_MASQ_MAX |
| 928 | }; |
| 929 | #define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1) |
| 930 | |
Pablo Neira Ayuso | 84d7fce | 2014-09-04 14:30:22 +0200 | [diff] [blame] | 931 | /** |
Arturo Borrero | e9105f1 | 2014-10-17 12:39:09 +0200 | [diff] [blame] | 932 | * enum nft_redir_attributes - nf_tables redirect expression netlink attributes |
| 933 | * |
| 934 | * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) |
| 935 | * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) |
| 936 | * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) |
| 937 | */ |
| 938 | enum nft_redir_attributes { |
| 939 | NFTA_REDIR_UNSPEC, |
| 940 | NFTA_REDIR_REG_PROTO_MIN, |
| 941 | NFTA_REDIR_REG_PROTO_MAX, |
| 942 | NFTA_REDIR_FLAGS, |
| 943 | __NFTA_REDIR_MAX |
| 944 | }; |
| 945 | #define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1) |
| 946 | |
| 947 | /** |
Pablo Neira Ayuso | d877f07 | 2015-05-31 18:04:11 +0200 | [diff] [blame] | 948 | * enum nft_dup_attributes - nf_tables dup expression netlink attributes |
| 949 | * |
| 950 | * @NFTA_DUP_SREG_ADDR: source register of address (NLA_U32: nft_registers) |
| 951 | * @NFTA_DUP_SREG_DEV: source register of output interface (NLA_U32: nft_register) |
| 952 | */ |
| 953 | enum nft_dup_attributes { |
| 954 | NFTA_DUP_UNSPEC, |
| 955 | NFTA_DUP_SREG_ADDR, |
| 956 | NFTA_DUP_SREG_DEV, |
| 957 | __NFTA_DUP_MAX |
| 958 | }; |
| 959 | #define NFTA_DUP_MAX (__NFTA_DUP_MAX - 1) |
| 960 | |
| 961 | /** |
Pablo Neira Ayuso | 84d7fce | 2014-09-04 14:30:22 +0200 | [diff] [blame] | 962 | * enum nft_gen_attributes - nf_tables ruleset generation attributes |
| 963 | * |
| 964 | * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32) |
| 965 | */ |
| 966 | enum nft_gen_attributes { |
| 967 | NFTA_GEN_UNSPEC, |
| 968 | NFTA_GEN_ID, |
| 969 | __NFTA_GEN_MAX |
| 970 | }; |
| 971 | #define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1) |
| 972 | |
Patrick McHardy | 9651851 | 2013-10-14 11:00:02 +0200 | [diff] [blame] | 973 | #endif /* _LINUX_NF_TABLES_H */ |