Replace ipportmap boolean field by flags.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
enum {
STMT_NAT_F_INTERVAL = (1 << 0),
STMT_NAT_F_PREFIX = (1 << 1),
+ STMT_NAT_F_CONCAT = (1 << 2),
};
struct nat_stmt {
struct expr *proto;
uint32_t flags;
uint8_t family;
- bool ipportmap;
uint32_t type_flags;
};
if (err < 0)
return err;
- if (stmt->nat.ipportmap) {
+ if (stmt->nat.type_flags & STMT_NAT_F_CONCAT) {
err = stmt_evaluate_nat_map(ctx, stmt);
if (err < 0)
return err;
if (is_nat_proto_map(addr, family)) {
stmt->nat.family = family;
- stmt->nat.ipportmap = true;
+ stmt->nat.type_flags |= STMT_NAT_F_CONCAT;
ctx->stmt = stmt;
return;
}
}
}
- if (stmt->nat.ipportmap) {
+ if (stmt->nat.type_flags & STMT_NAT_F_CONCAT) {
/* nat_stmt evaluation step doesn't allow
- * stmt->nat.ipportmap && stmt->nat.proto.
+ * STMT_NAT_F_CONCAT && stmt->nat.proto.
*/
assert(stmt->nat.proto == NULL);
pmin_reg = amin_reg;
- /* if ipportmap is set, the mapped type is a
+ /* if STMT_NAT_F_CONCAT is set, the mapped type is a
* concatenation of 'addr . inet_service'.
* The map lookup will then return the
* concatenated value, so we need to skip
{
$<stmt>0->nat.family = $1;
$<stmt>0->nat.addr = $6;
- $<stmt>0->nat.ipportmap = true;
+ $<stmt>0->nat.type_flags = STMT_NAT_F_CONCAT;
}
| nf_key_proto INTERVAL TO stmt_expr
{
break;
}
- if (stmt->nat.ipportmap)
+ if (stmt->nat.type_flags & STMT_NAT_F_CONCAT)
nft_print(octx, " addr . port");
else if (stmt->nat.type_flags & STMT_NAT_F_PREFIX)
nft_print(octx, " prefix");