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