From 35a6b10c1bc488ca195e9c641563c29251f725f3 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 24 Apr 2020 21:56:51 +0200 Subject: src: add netmap support This patch allows you to specify an interval of IP address in maps. table ip x { chain y { type nat hook postrouting priority srcnat; policy accept; snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24 } } } The example above performs SNAT to packets that comes from 10.141.11.0/24 using the prefix 192.168.2.0/24, e.g. 10.141.11.4 is mangled to 192.168.2.4. Signed-off-by: Pablo Neira Ayuso --- src/statement.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/statement.c') diff --git a/src/statement.c b/src/statement.c index 5bbc0540..8a1cd6e0 100644 --- a/src/statement.c +++ b/src/statement.c @@ -609,6 +609,8 @@ static void nat_stmt_print(const struct stmt *stmt, struct output_ctx *octx) if (stmt->nat.ipportmap) nft_print(octx, " addr . port"); + else if (stmt->nat.type_flags & STMT_NAT_F_PREFIX) + nft_print(octx, " prefix"); else if (stmt->nat.type_flags & STMT_NAT_F_INTERVAL) nft_print(octx, " interval"); -- cgit v1.2.3