]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Support parsing lookup expression
authorPhil Sutter <phil@nwl.cc>
Tue, 20 Aug 2019 22:33:51 +0000 (00:33 +0200)
committerPhil Sutter <phil@nwl.cc>
Mon, 25 Nov 2019 22:31:12 +0000 (23:31 +0100)
Add required glue code to support family specific lookup expression
parsers implemented as family_ops callback.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft-shared.c
iptables/nft-shared.h
iptables/nft.c

index 19630c1e2990c755879fbcb429b2efc45c77d6d3..78e422781723f3910ce9dec5c214f9d4d1dd7029 100644 (file)
@@ -588,6 +588,13 @@ static void nft_parse_limit(struct nft_xt_ctx *ctx, struct nftnl_expr *e)
                ctx->h->ops->parse_match(match, ctx->cs);
 }
 
+static void nft_parse_lookup(struct nft_xt_ctx *ctx, struct nft_handle *h,
+                            struct nftnl_expr *e)
+{
+       if (ctx->h->ops->parse_lookup)
+               ctx->h->ops->parse_lookup(ctx, e, NULL);
+}
+
 void nft_rule_to_iptables_command_state(struct nft_handle *h,
                                        const struct nftnl_rule *r,
                                        struct iptables_command_state *cs)
@@ -628,6 +635,8 @@ void nft_rule_to_iptables_command_state(struct nft_handle *h,
                        nft_parse_target(&ctx, expr);
                else if (strcmp(name, "limit") == 0)
                        nft_parse_limit(&ctx, expr);
+               else if (strcmp(name, "lookup") == 0)
+                       nft_parse_lookup(&ctx, h, expr);
 
                expr = nftnl_expr_iter_next(iter);
        }
index 91762d2ed8a3e73bd6a0d50a509617da60c1542d..bee99a7dd0c9301d50211a57b08ffec4440001d0 100644 (file)
@@ -86,6 +86,8 @@ struct nft_family_ops {
                              void *data);
        void (*parse_cmp)(struct nft_xt_ctx *ctx, struct nftnl_expr *e,
                          void *data);
+       void (*parse_lookup)(struct nft_xt_ctx *ctx, struct nftnl_expr *e,
+                            void *data);
        void (*parse_immediate)(const char *jumpto, bool nft_goto, void *data);
 
        void (*print_table_header)(const char *tablename);
index a8e7694f86781d18cdb3a84bdd79b5511f8c6400..2bc94ff92e294a2be61ec9ac923b59c5c147d382 100644 (file)
@@ -3114,7 +3114,8 @@ static const char *supported_exprs[] = {
        "cmp",
        "bitwise",
        "counter",
-       "immediate"
+       "immediate",
+       "lookup",
 };