Add a new "dynset" expression for dynamic set updates. A new set op ->update() is added which, for non existant elements, invokes an initialization callback and inserts the new element. For both new or existing elements the extenstion pointer is returned to the caller to optionally perform timer updates or other actions. Element removal is not supported so far, however that seems to be a rather exotic need and can be added later on.
Showing the changes to include/uapi (1 of 8 files). Show all
Unified · Split
| @@ -515,6 +515,33 @@ enum nft_lookup_attributes { · 514 unmodified lines | ||
| 515 | 515 | }; |
| 516 | 516 | #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) |
| 517 | 517 | |
| 518 | +enum nft_dynset_ops { | |
| 519 | + NFT_DYNSET_OP_ADD, | |
| 520 | + NFT_DYNSET_OP_UPDATE, | |
| 521 | +}; | |
| 522 | + | |
| 523 | +/** | |
| 524 | + * enum nft_dynset_attributes - dynset expression attributes | |
| 525 | + * | |
| 526 | + * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING) | |
| 527 | + * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32) | |
| 528 | + * @NFTA_DYNSET_OP: operation (NLA_U32) | |
| 529 | + * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32) | |
| 530 | + * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32) | |
| 531 | + * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64) | |
| 532 | + */ | |
| 533 | +enum nft_dynset_attributes { | |
| 534 | + NFTA_DYNSET_UNSPEC, | |
| 535 | + NFTA_DYNSET_SET_NAME, | |
| 536 | + NFTA_DYNSET_SET_ID, | |
| 537 | + NFTA_DYNSET_OP, | |
| 538 | + NFTA_DYNSET_SREG_KEY, | |
| 539 | + NFTA_DYNSET_SREG_DATA, | |
| 540 | + NFTA_DYNSET_TIMEOUT, | |
| 541 | + __NFTA_DYNSET_MAX, | |
| 542 | +}; | |
| 543 | +#define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1) | |
| 544 | + | |
| 518 | 545 | /** |
| 519 | 546 | * enum nft_payload_bases - nf_tables payload expression offset bases |
| 520 | 547 | * |