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

On Thu, Nov 17, 2011 at 10:14:02PM +0100, Thomas Jarosch wrote:
> Hi,
> 
> consider this piece of code from
> net/ipv4/netfilter/nf_nat_snmp_basic.c:1198
> 
> ---------------------------------------------
> /*
>     * Determine mappping for application layer addresses based
>     * on NAT manipulations for the packet.
>     */
> 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.

  reply	other threads:[~2011-11-18  0:34 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 [this message]
2011-11-18  8:43   ` Thomas Jarosch
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=20111118003429.GA30271@1984 \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=thomas.jarosch@intra2net.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 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).