netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: Probably wrong code in nf_nat_snmp_basic.c
@ 2011-11-17 21:14 Thomas Jarosch
  2011-11-18  0:34 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Jarosch @ 2011-11-17 21:14 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-28 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-11-28 15:46     ` Thomas Jarosch

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