netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: mathieu.poirier@linaro.org
Cc: pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH RESEND v2 1/1] netfilter: xtables: add quota support to nfacct
Date: Mon, 27 Jan 2014 00:02:31 +0100	[thread overview]
Message-ID: <20140126230231.GA29022@breakpoint.cc> (raw)
In-Reply-To: <1390766673-21444-2-git-send-email-mathieu.poirier@linaro.org>

mathieu.poirier@linaro.org <mathieu.poirier@linaro.org> wrote:

[ removed netfilter@ from CC ]

> Adding packet and byte quota support.  Once a quota has been
> reached a noticifaction is sent to user space that includes
> the name of the accounting object along with the current byte
> and packet count.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> diff --git a/include/uapi/linux/netfilter/xt_nfacct.h b/include/uapi/linux/netfilter/xt_nfacct.h
> index 3e19c8a..d38104f 100644
> --- a/include/uapi/linux/netfilter/xt_nfacct.h
> +++ b/include/uapi/linux/netfilter/xt_nfacct.h
> @@ -3,11 +3,25 @@
>  
> +struct xt_nfacct_match_info_v1 {
> +	char		name[NFACCT_NAME_MAX];
> +	struct nf_acct	*nfacct;
> +
> +	__u32 flags;
> +	__aligned_u64 quota;
> +	struct nf_acct_quota	*priv;
> +};

I think that pointers should be aligned to 8-byte boundary, else
this can cause issues with 32-bit-userspace-on-64-bit-kernel.

It also should be flagged as "kernel only", e.g. via comment.

> index b3be0ef..ff66792 100644
> --- a/net/netfilter/xt_nfacct.c
> +++ b/net/netfilter/xt_nfacct.c
> @@ -8,10 +8,14 @@
>  #include <linux/netfilter/xt_nfacct.h>
> +#include <linux/netfilter_ipv4/ipt_ULOG.h>

ULOG is the ipv4-only predecessor of NFLOG target, why this include?

> +	nfacct = nfnl_acct_find_get(info->name);
> +	if (nfacct == NULL) {
> +		pr_info("xt_nfacct: invalid accounting object `%s'\n",
> +		       info->name);
> +		return -ENOENT;
> +	}
> +
> +	info->nfacct = nfacct;
> +
> +	if ((info->flags & XT_NFACCT_QUOTA) && !info->priv) {
> +		info->priv =  kmalloc(sizeof(struct nf_acct_quota), GFP_KERNEL);
> +		if (info->priv == NULL)
> +			return -ENOMEM;

I think this misses a _put of nfacct object.

Thanks for your patience.

  reply	other threads:[~2014-01-26 23:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-26 20:04 [PATCH RESEND v2 0/1] Add quota capabilities to nfacct mathieu.poirier
2014-01-26 20:04 ` [PATCH RESEND v2 1/1] netfilter: xtables: add quota support " mathieu.poirier
2014-01-26 23:02   ` Florian Westphal [this message]
2014-01-27 15:35     ` Mathieu Poirier
2014-01-27 16:44       ` Pablo Neira Ayuso

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=20140126230231.GA29022@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=mathieu.poirier@linaro.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).