summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-12-08 22:14:09 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-12-09 19:12:20 +0100
commit87ed152ebf561f20a2b5e23f2cf91e56a8d01838 (patch)
treeebe2645056362813ad7e9f306f37a2109ac66877
parent0451b82aaaf0b0bf67e7dcf38ffa4f7cef5e3066 (diff)
netlink_delinearize: fix listing of set members in host byteorder using integer_type
nft list table filter ... cpu { 50331648, 33554432, 0, 16777216} counter packets 8 bytes 344 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/netlink_delinearize.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index c809bb6b..e9a04dd4 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -742,6 +742,29 @@ static void payload_dependency_store(struct rule_pp_ctx *ctx,
ctx->pdep = stmt;
}
+static void integer_type_postprocess(struct expr *expr)
+{
+ struct expr *i;
+
+ switch (expr->ops->type) {
+ case EXPR_VALUE:
+ if (expr->byteorder == BYTEORDER_HOST_ENDIAN) {
+ uint32_t len = div_round_up(expr->len, BITS_PER_BYTE);
+
+ mpz_switch_byteorder(expr->value, len);
+ }
+ break;
+ case EXPR_SET_REF:
+ list_for_each_entry(i, &expr->set->init->expressions, list) {
+ expr_set_type(i, expr->dtype, expr->byteorder);
+ integer_type_postprocess(i);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
static void payload_match_postprocess(struct rule_pp_ctx *ctx,
struct stmt *stmt, struct expr *expr)
{
@@ -805,6 +828,12 @@ static void meta_match_postprocess(struct rule_pp_ctx *ctx,
left->flags & EXPR_F_PROTOCOL)
payload_dependency_store(ctx, stmt, left->meta.base);
break;
+ case OP_LOOKUP:
+ expr_set_type(expr->right, expr->left->dtype,
+ expr->left->byteorder);
+ if (expr->right->dtype == &integer_type)
+ integer_type_postprocess(expr->right);
+ break;
default:
break;
}