]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
log: convert group and qthreshold to use u16
authorPablo Neira Ayuso <pablo@netfilter.org>
Sat, 17 Aug 2013 10:41:49 +0000 (12:41 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 17 Aug 2013 10:42:00 +0000 (12:42 +0200)
Required since (netfilter: nft_log: group and qthreshold are 2^16)
kernel change.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/statement.h
src/netlink_delinearize.c
src/netlink_linearize.c

index 20b6f9a90571432ee8d2347a7fb4d54e2fd4c18b..53702317b782a6a03afc79cc43644b09fb43618c 100644 (file)
@@ -30,9 +30,9 @@ extern struct stmt *meta_stmt_alloc(const struct location *loc,
 
 struct log_stmt {
        const char              *prefix;
-       unsigned int            group;
        unsigned int            snaplen;
-       unsigned int            qthreshold;
+       uint16_t                group;
+       uint16_t                qthreshold;
 };
 
 extern struct stmt *log_stmt_alloc(const struct location *loc);
index f92e83f315440c317d7bb713e4d53db008f9aed0..4aacbbde74315c6671b094957cd01a94a8c677c1 100644 (file)
@@ -370,10 +370,10 @@ static void netlink_parse_log(struct netlink_parse_ctx *ctx,
        prefix = nft_rule_expr_get_str(nle, NFT_EXPR_LOG_PREFIX);
        if (prefix != NULL)
                stmt->log.prefix = xstrdup(prefix);
-       stmt->log.group = nft_rule_expr_get_u32(nle, NFT_EXPR_LOG_GROUP);
+       stmt->log.group = nft_rule_expr_get_u16(nle, NFT_EXPR_LOG_GROUP);
        stmt->log.snaplen = nft_rule_expr_get_u32(nle, NFT_EXPR_LOG_SNAPLEN);
        stmt->log.qthreshold =
-               nft_rule_expr_get_u32(nle, NFT_EXPR_LOG_QTHRESHOLD);
+               nft_rule_expr_get_u16(nle, NFT_EXPR_LOG_QTHRESHOLD);
        list_add_tail(&stmt->list, &ctx->rule->stmts);
 }
 
index e507f9125619ca401111cfa5ad5113070701c78a..427fdb674050fe1212bca2abb1736334f3f7bcf5 100644 (file)
@@ -531,7 +531,7 @@ static void netlink_gen_log_stmt(struct netlink_linearize_ctx *ctx,
                                      stmt->log.prefix);
        }
        if (stmt->log.group) {
-               nft_rule_expr_set_u32(nle, NFT_EXPR_LOG_GROUP,
+               nft_rule_expr_set_u16(nle, NFT_EXPR_LOG_GROUP,
                                      stmt->log.group);
        }
        if (stmt->log.snaplen) {
@@ -539,7 +539,7 @@ static void netlink_gen_log_stmt(struct netlink_linearize_ctx *ctx,
                                      stmt->log.snaplen);
        }
        if (stmt->log.qthreshold) {
-               nft_rule_expr_set_u32(nle, NFT_EXPR_LOG_QTHRESHOLD,
+               nft_rule_expr_set_u16(nle, NFT_EXPR_LOG_QTHRESHOLD,
                                      stmt->log.qthreshold);
        }
        nft_rule_add_expr(ctx->nlr, nle);