From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 03/12] netfilter: nft_limit: replace pkt_bytes with bytes
Date: Mon, 4 Sep 2017 22:11:05 +0200 [thread overview]
Message-ID: <1504555874-4168-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1504555874-4168-1-git-send-email-pablo@netfilter.org>
From: "Pablo M. Bermudo Garay" <pablombg@gmail.com>
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>
---
net/netfilter/nft_limit.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/net/netfilter/nft_limit.c b/net/netfilter/nft_limit.c
index 14538b1d4d11..aae2d1ec27f3 100644
--- a/net/netfilter/nft_limit.c
+++ b/net/netfilter/nft_limit.c
@@ -168,9 +168,9 @@ static const struct nft_expr_ops nft_limit_pkts_ops = {
.dump = nft_limit_pkts_dump,
};
-static void nft_limit_pkt_bytes_eval(const struct nft_expr *expr,
- struct nft_regs *regs,
- const struct nft_pktinfo *pkt)
+static void nft_limit_bytes_eval(const struct nft_expr *expr,
+ struct nft_regs *regs,
+ const struct nft_pktinfo *pkt)
{
struct nft_limit *priv = nft_expr_priv(expr);
u64 cost = div64_u64(priv->nsecs * pkt->skb->len, priv->rate);
@@ -179,29 +179,29 @@ static void nft_limit_pkt_bytes_eval(const struct nft_expr *expr,
regs->verdict.code = NFT_BREAK;
}
-static int nft_limit_pkt_bytes_init(const struct nft_ctx *ctx,
- const struct nft_expr *expr,
- const struct nlattr * const tb[])
+static int nft_limit_bytes_init(const struct nft_ctx *ctx,
+ const struct nft_expr *expr,
+ const struct nlattr * const tb[])
{
struct nft_limit *priv = nft_expr_priv(expr);
return nft_limit_init(priv, tb);
}
-static int nft_limit_pkt_bytes_dump(struct sk_buff *skb,
- const struct nft_expr *expr)
+static int nft_limit_bytes_dump(struct sk_buff *skb,
+ const struct nft_expr *expr)
{
const struct nft_limit *priv = nft_expr_priv(expr);
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,
.size = NFT_EXPR_SIZE(sizeof(struct nft_limit)),
- .eval = nft_limit_pkt_bytes_eval,
- .init = nft_limit_pkt_bytes_init,
- .dump = nft_limit_pkt_bytes_dump,
+ .eval = nft_limit_bytes_eval,
+ .init = nft_limit_bytes_init,
+ .dump = nft_limit_bytes_dump,
};
static const struct nft_expr_ops *
@@ -215,7 +215,7 @@ nft_limit_select_ops(const struct nft_ctx *ctx,
case NFT_LIMIT_PKTS:
return &nft_limit_pkts_ops;
case NFT_LIMIT_PKT_BYTES:
- return &nft_limit_pkt_bytes_ops;
+ return &nft_limit_bytes_ops;
}
return ERR_PTR(-EOPNOTSUPP);
}
--
2.1.4
next prev parent reply other threads:[~2017-09-04 20:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 20:11 [PATCH 00/12] Netfilter updates for next-net (part 2) Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 01/12] netfilter: xt_hashlimit: add rate match mode Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 02/12] netfilter: nf_tables: add select_ops for stateful objects Pablo Neira Ayuso
2017-09-04 20:11 ` Pablo Neira Ayuso [this message]
2017-09-04 20:11 ` [PATCH 04/12] netfilter: nft_limit: add stateful object type Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 05/12] netfilter: remove unused hooknum arg from packet functions Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 06/12] net: Replace NF_CT_ASSERT() with WARN_ON() Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 07/12] net: Remove CONFIG_NETFILTER_DEBUG and _ASSERT() macros Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 08/12] netfilter: nf_tables: add nf_tables_updchain() Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 09/12] netfilter: nf_tables: add nf_tables_addchain() Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 10/12] netlink: add NLM_F_NONREC flag for deletion requests Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 11/12] netfilter: nf_tables: use NLM_F_NONREC " Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 12/12] netfilter: nf_tables: support for recursive chain deletion Pablo Neira Ayuso
2017-09-04 22:28 ` [PATCH 00/12] Netfilter updates for next-net (part 2) David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504555874-4168-4-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).