netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: valentina.giusti@bmw-carit.de
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
	fw@strlen.de, eric.dumazet@gmail.com, tgraf@redhat.com,
	jpa@google.com, pablo@netfilter.org, davem@davemloft.net,
	daniel.wagner@bmw-carit.de,
	Valentina Giusti <valentina.giusti@oss.bmw-carit.de>
Subject: Re: [PATCH v2 1/2] netfilter_queue: enable UID/GID socket info retrieval
Date: Thu, 19 Dec 2013 12:43:40 +0100	[thread overview]
Message-ID: <20131219114340.GB6047@breakpoint.cc> (raw)
In-Reply-To: <1387451007-14363-2-git-send-email-valentina.giusti@bmw-carit.de>

valentina.giusti@bmw-carit.de <valentina.giusti@bmw-carit.de> wrote:
> From: Valentina Giusti <valentina.giusti@oss.bmw-carit.de>
> 
> Thanks to commits 41063e9 (ipv4: Early TCP socket demux) and 421b388 (udp: ipv4:
> Add udp early demux) it is now possible to parse UID and GID socket info
> also for incoming TCP and UDP connections. Having this info available, it
> is convenient to let NFQUEUE parse it in order to improve and refine the
> traffic analysis in userspace.

> diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
> index 21258cf..2cdef07 100644
> --- a/net/netfilter/nfnetlink_queue_core.c
> +++ b/net/netfilter/nfnetlink_queue_core.c
> @@ -297,6 +297,29 @@ nfqnl_put_packet_info(struct sk_buff *nlskb, struct sk_buff *packet,
>  	return flags ? nla_put_be32(nlskb, NFQA_SKB_INFO, htonl(flags)) : 0;
>  }
>  
> +static int nfqnl_put_sk_uidgid(struct sk_buff *skb, struct sock *sk)
> +{
> +	const struct cred *cred;
> +
> +	if (sk && sk->sk_state != TCP_TIME_WAIT) {
[..]
> +	if ((queue->flags & NFQA_CFG_F_UID_GID) && entskb->sk)
> +		if (nfqnl_put_sk_uidgid(skb, entskb->sk))
> +			goto nla_put_failure;

Minor nit: sk is tested for non-null twice.  Suggestion:

if ((queue->flags & NFQA_CFG_F_UID_GID) &&
     nfqnl_put_sk_uidgid(skb, entskb->sk))
          goto nla_put_failure;

I don't think its necessary to resubmit the patch though, thus:

Reviewed-by: Florian Westphal <fw@strlen.de>

  reply	other threads:[~2013-12-19 11:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 11:03 [PATCH v2 0/2] Add UID/GID info to NFQUEUE valentina.giusti
2013-12-19 11:03 ` [PATCH v2 1/2] netfilter_queue: enable UID/GID socket info retrieval valentina.giusti
2013-12-19 11:43   ` Florian Westphal [this message]
2013-12-20  9:26   ` Pablo Neira Ayuso
2013-12-20  9:29     ` Pablo Neira Ayuso
2013-12-20  9:45       ` Valentina Giusti
2013-12-20 11:18       ` Valentina Giusti
2013-12-20 12:06         ` Florian Westphal
2013-12-19 11:03 ` [PATCH v2 2/2] libnetfilter_queue: add support for UID/GID socket info valentina.giusti

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=20131219114340.GB6047@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=daniel.wagner@bmw-carit.de \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jpa@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=tgraf@redhat.com \
    --cc=valentina.giusti@bmw-carit.de \
    --cc=valentina.giusti@oss.bmw-carit.de \
    /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).