netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, James Morris <jmorris@namei.org>
Subject: Re: RFC: Probably wrong code in nf_nat_snmp_basic.c
Date: Fri, 18 Nov 2011 09:43:29 +0100	[thread overview]
Message-ID: <201111180943.29443.thomas.jarosch@intra2net.com> (raw)
In-Reply-To: <20111118003429.GA30271@1984>

On Friday, 18. November 2011 01:34:29 Pablo Neira Ayuso wrote:
> > if (dir == IP_CT_DIR_ORIGINAL) {
> > 
> >     /* SNAT traps */
> >     map.from = NOCT1(&ct->tuplehash[dir].tuple.src.u3.ip);
> >     map.to = NOCT1(&ct->tuplehash[!dir].tuple.dst.u3.ip);
> > 
> > } else {
> > 
> >     /* DNAT replies */
> >     map.from = NOCT1(&ct->tuplehash[dir].tuple.src.u3.ip);
> >     map.to = NOCT1(&ct->tuplehash[!dir].tuple.dst.u3.ip);
> > 
> > }
> > ---------------------------------------------
> > 
> > cppcheck reported: (style) Found duplicate branches for if and else.
> > 
> > 
> > Either I need glasses or the code is exactly the same :)
> 
> Indeed. I'll be happy to take a patch for this. If you don't make it
> in the following days, no problem, I'll take of this myself. Thanks
> for the report.

The if() statement is probably in there for a reason. I'm not familiar with 
the internal details of the ct stuff, perhaps map.from/map.to
should be swapped or something like that.

James, any idea what's going on?

Cheers,
Thomas

  reply	other threads:[~2011-11-18  8:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 21:14 RFC: Probably wrong code in nf_nat_snmp_basic.c Thomas Jarosch
2011-11-18  0:34 ` Pablo Neira Ayuso
2011-11-18  8:43   ` Thomas Jarosch [this message]
2011-11-28 15:46     ` Thomas Jarosch

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=201111180943.29443.thomas.jarosch@intra2net.com \
    --to=thomas.jarosch@intra2net.com \
    --cc=jmorris@namei.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).