netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: netfilter-devel@vger.kernel.org
Subject: RFC: Probably wrong code in nf_nat_snmp_basic.c
Date: Thu, 17 Nov 2011 22:14:02 +0100	[thread overview]
Message-ID: <4EC5791A.1040005@intra2net.com> (raw)

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 :)

Cheers,
Thomas

             reply	other threads:[~2011-11-17 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 21:14 Thomas Jarosch [this message]
2011-11-18  0:34 ` RFC: Probably wrong code in nf_nat_snmp_basic.c Pablo Neira Ayuso
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=4EC5791A.1040005@intra2net.com \
    --to=thomas.jarosch@intra2net.com \
    --cc=netfilter-devel@vger.kernel.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).