diff options
author | Phil Sutter <phil@nwl.cc> | 2023-12-15 01:10:39 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2024-04-19 19:21:21 +0200 |
commit | 4955ae1a81b73f9a61b7fbf1a73e11544513548e (patch) | |
tree | 7883c0cd9e049bdb80d7694a174d31ee3b44a278 /src/rule.c | |
parent | 83ed57d587afb248dc5dc72006b247319193008d (diff) |
Add support for table's persist flag
Bison parser lacked support for passing multiple flags, JSON parser
did not support table flags at all.
Document also 'owner' flag (and describe their relationship in nft.8.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/rule.c')
-rw-r--r-- | src/rule.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1215,6 +1215,7 @@ struct table *table_lookup_fuzzy(const struct handle *h, static const char *table_flags_name[TABLE_FLAGS_MAX] = { "dormant", "owner", + "persist", }; const char *table_flag_name(uint32_t flag) @@ -1225,6 +1226,17 @@ const char *table_flag_name(uint32_t flag) return table_flags_name[flag]; } +unsigned int parse_table_flag(const char *name) +{ + int i; + + for (i = 0; i < TABLE_FLAGS_MAX; i++) { + if (!strcmp(name, table_flags_name[i])) + return 1 << i; + } + return 0; +} + static void table_print_flags(const struct table *table, const char **delim, struct output_ctx *octx) { |