From 6f137a2db3419e961e41eda28668cd99e8a3f2e2 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 24 Nov 2015 21:26:27 +0100 Subject: 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 --- src/statement.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/statement.c') diff --git a/src/statement.c b/src/statement.c index 153e93be..ca924410 100644 --- a/src/statement.c +++ b/src/statement.c @@ -490,3 +490,26 @@ struct stmt *dup_stmt_alloc(const struct location *loc) { return stmt_alloc(loc, &dup_stmt_ops); } + +static void fwd_stmt_print(const struct stmt *stmt) +{ + printf("fwd to "); + expr_print(stmt->fwd.to); +} + +static void fwd_stmt_destroy(struct stmt *stmt) +{ + expr_free(stmt->fwd.to); +} + +static const struct stmt_ops fwd_stmt_ops = { + .type = STMT_FWD, + .name = "fwd", + .print = fwd_stmt_print, + .destroy = fwd_stmt_destroy, +}; + +struct stmt *fwd_stmt_alloc(const struct location *loc) +{ + return stmt_alloc(loc, &fwd_stmt_ops); +} -- cgit v1.2.3