diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-11-24 21:26:27 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-01-31 22:32:18 +0100 |
commit | 6f137a2db3419e961e41eda28668cd99e8a3f2e2 (patch) | |
tree | a53b45962d657c1c02363d9b248aa944840a9134 /src/evaluate.c | |
parent | 8a236ef68cd43af81fac10c5b58658514273a14e (diff) |
src: add fwd statement for netdev
This patch add support for the forward statement, only available at the
netdev family.
# nft add table netdev filter
# nft add chain netdev filter ingress { type filter hook ingress device eth0 priority 0\; }
# nft add rule netdev filter ingress fwd to dummy0
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r-- | src/evaluate.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index ce132e3c..5e9783d1 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -1883,6 +1883,28 @@ static int stmt_evaluate_dup(struct eval_ctx *ctx, struct stmt *stmt) return 0; } +static int stmt_evaluate_fwd(struct eval_ctx *ctx, struct stmt *stmt) +{ + int err; + + switch (ctx->pctx.family) { + case NFPROTO_NETDEV: + if (stmt->fwd.to == NULL) + return stmt_error(ctx, stmt, + "missing destination interface"); + + err = stmt_evaluate_arg(ctx, stmt, &ifindex_type, + sizeof(uint32_t) * BITS_PER_BYTE, + &stmt->fwd.to); + if (err < 0) + return err; + break; + default: + return stmt_error(ctx, stmt, "unsupported family"); + } + return 0; +} + static int stmt_evaluate_queue(struct eval_ctx *ctx, struct stmt *stmt) { if (stmt->queue.queue != NULL) { @@ -1970,6 +1992,8 @@ int stmt_evaluate(struct eval_ctx *ctx, struct stmt *stmt) return stmt_evaluate_queue(ctx, stmt); case STMT_DUP: return stmt_evaluate_dup(ctx, stmt); + case STMT_FWD: + return stmt_evaluate_fwd(ctx, stmt); case STMT_SET: return stmt_evaluate_set(ctx, stmt); default: |