netfilter: nft_limit: replace pkt_bytes with bytes
Just a small refactor patch in order to improve the code readability. Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
dfc46034b5
commit
6e32388756
|
@ -168,7 +168,7 @@ static const struct nft_expr_ops nft_limit_pkts_ops = {
|
||||||
.dump = nft_limit_pkts_dump,
|
.dump = nft_limit_pkts_dump,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void nft_limit_pkt_bytes_eval(const struct nft_expr *expr,
|
static void nft_limit_bytes_eval(const struct nft_expr *expr,
|
||||||
struct nft_regs *regs,
|
struct nft_regs *regs,
|
||||||
const struct nft_pktinfo *pkt)
|
const struct nft_pktinfo *pkt)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ static void nft_limit_pkt_bytes_eval(const struct nft_expr *expr,
|
||||||
regs->verdict.code = NFT_BREAK;
|
regs->verdict.code = NFT_BREAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nft_limit_pkt_bytes_init(const struct nft_ctx *ctx,
|
static int nft_limit_bytes_init(const struct nft_ctx *ctx,
|
||||||
const struct nft_expr *expr,
|
const struct nft_expr *expr,
|
||||||
const struct nlattr * const tb[])
|
const struct nlattr * const tb[])
|
||||||
{
|
{
|
||||||
|
@ -188,7 +188,7 @@ static int nft_limit_pkt_bytes_init(const struct nft_ctx *ctx,
|
||||||
return nft_limit_init(priv, tb);
|
return nft_limit_init(priv, tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nft_limit_pkt_bytes_dump(struct sk_buff *skb,
|
static int nft_limit_bytes_dump(struct sk_buff *skb,
|
||||||
const struct nft_expr *expr)
|
const struct nft_expr *expr)
|
||||||
{
|
{
|
||||||
const struct nft_limit *priv = nft_expr_priv(expr);
|
const struct nft_limit *priv = nft_expr_priv(expr);
|
||||||
|
@ -196,12 +196,12 @@ static int nft_limit_pkt_bytes_dump(struct sk_buff *skb,
|
||||||
return nft_limit_dump(skb, priv, NFT_LIMIT_PKT_BYTES);
|
return nft_limit_dump(skb, priv, NFT_LIMIT_PKT_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct nft_expr_ops nft_limit_pkt_bytes_ops = {
|
static const struct nft_expr_ops nft_limit_bytes_ops = {
|
||||||
.type = &nft_limit_type,
|
.type = &nft_limit_type,
|
||||||
.size = NFT_EXPR_SIZE(sizeof(struct nft_limit)),
|
.size = NFT_EXPR_SIZE(sizeof(struct nft_limit)),
|
||||||
.eval = nft_limit_pkt_bytes_eval,
|
.eval = nft_limit_bytes_eval,
|
||||||
.init = nft_limit_pkt_bytes_init,
|
.init = nft_limit_bytes_init,
|
||||||
.dump = nft_limit_pkt_bytes_dump,
|
.dump = nft_limit_bytes_dump,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct nft_expr_ops *
|
static const struct nft_expr_ops *
|
||||||
|
@ -215,7 +215,7 @@ nft_limit_select_ops(const struct nft_ctx *ctx,
|
||||||
case NFT_LIMIT_PKTS:
|
case NFT_LIMIT_PKTS:
|
||||||
return &nft_limit_pkts_ops;
|
return &nft_limit_pkts_ops;
|
||||||
case NFT_LIMIT_PKT_BYTES:
|
case NFT_LIMIT_PKT_BYTES:
|
||||||
return &nft_limit_pkt_bytes_ops;
|
return &nft_limit_bytes_ops;
|
||||||
}
|
}
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue