All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Hans Schillstrom <hans@schillstrom.com>
Cc: netfilter-devel@vger.kernel.org, gaofeng@cn.fujitsu.com,
	fw@strlen.de, ronald645@gmail.com
Subject: Re: [PATCH] netfilter: log: netns NULL ptr bug when calling from conntrack.
Date: Wed, 15 May 2013 14:00:13 +0200	[thread overview]
Message-ID: <20130515120013.GA20074@localhost> (raw)
In-Reply-To: <1368617025-17375-1-git-send-email-hans@schillstrom.com>

Hi Hans,

On Wed, May 15, 2013 at 01:23:45PM +0200, Hans Schillstrom wrote:
> When callling log functions from conntrack both in and out
> is NULL i.e. there exist no net pointer.
> 
> Adding struct net *net in call to nf_logfn() will secure that
> there always is a vaild net ptr.
> 
> Reported as bugzilla bug 818

This approach to fix it looks good. Thanks a lot!

Just resolved a minor nitpick:

> Reported-by: Ronald <ronald645@gmail.com>
> Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
> ---
>  include/net/netfilter/nf_log.h        |  3 ++-
>  include/net/netfilter/nfnetlink_log.h |  3 ++-
>  net/bridge/netfilter/ebt_log.c        |  5 ++---
>  net/bridge/netfilter/ebt_ulog.c       | 18 +++++++++++-------
>  net/ipv4/netfilter/ipt_ULOG.c         | 13 ++++++++-----
>  net/netfilter/nf_log.c                |  2 +-
>  net/netfilter/nfnetlink_log.c         |  4 ++--
>  net/netfilter/xt_LOG.c                | 13 +++++++------
>  net/netfilter/xt_NFLOG.c              |  3 ++-
>  9 files changed, 37 insertions(+), 27 deletions(-)
> 
> diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
> index 31f1fb9..99eac12 100644
> --- a/include/net/netfilter/nf_log.h
> +++ b/include/net/netfilter/nf_log.h
> @@ -30,7 +30,8 @@ struct nf_loginfo {
>  	} u;
>  };
>  
> -typedef void nf_logfn(u_int8_t pf,
> +typedef void nf_logfn(struct net *net,
> +		      u_int8_t pf,
>  		      unsigned int hooknum,
>  		      const struct sk_buff *skb,
>  		      const struct net_device *in,
> diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
> index e2dec42..5ca3f14 100644
> --- a/include/net/netfilter/nfnetlink_log.h
> +++ b/include/net/netfilter/nfnetlink_log.h
> @@ -2,7 +2,8 @@
>  #define _KER_NFNETLINK_LOG_H
>  
>  void
> -nfulnl_log_packet(u_int8_t pf,
> +nfulnl_log_packet(struct net *net,
> +		  u_int8_t pf,
>  		  unsigned int hooknum,
>  		  const struct sk_buff *skb,
>  		  const struct net_device *in,
> diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
> index 9878eb8..837612c 100644
> --- a/net/bridge/netfilter/ebt_log.c
> +++ b/net/bridge/netfilter/ebt_log.c
> @@ -72,13 +72,12 @@ print_ports(const struct sk_buff *skb, uint8_t protocol, int offset)
>  }
>  
>  static void
> -ebt_log_packet(u_int8_t pf, unsigned int hooknum,
> +ebt_log_packet(struct net *net, int8_t pf, unsigned int hooknum,

pf still has to be u_int8_t so I don't hit a compilation warning. No
need to resent I fixed it here.

  reply	other threads:[~2013-05-15 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 11:23 [PATCH] netfilter: log: netns NULL ptr bug when calling from conntrack Hans Schillstrom
2013-05-15 12:00 ` Pablo Neira Ayuso [this message]
2013-05-15 12:13   ` Hans Schillstrom
2013-05-17  9:57 ` Gao feng

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=20130515120013.GA20074@localhost \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=hans@schillstrom.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=ronald645@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.