From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de
Subject: Re: [libnetfilter_conntrack PATCH 1/3] src: add support for IPv6 to struct __nfct_nat
Date: Tue, 17 May 2016 17:45:49 +0200 [thread overview]
Message-ID: <20160517154549.GA1998@salvia> (raw)
In-Reply-To: <146348943198.4910.10995009662328384564.stgit@nfdev2.cica.es>
On Tue, May 17, 2016 at 02:50:32PM +0200, Arturo Borrero Gonzalez wrote:
> @@ -114,18 +129,34 @@ int __setobjopt(struct nf_conntrack *ct, unsigned int option)
>
> static int getobjopt_is_snat(const struct nf_conntrack *ct)
> {
> - return ((test_bit(ATTR_STATUS, ct->head.set) ?
> - ct->status & IPS_SRC_NAT_DONE : 1) &&
> - ct->repl.dst.v4 !=
> - ct->head.orig.src.v4);
> + if (!(test_bit(ATTR_STATUS, ct->head.set) ?
> + ct->status & IPS_SRC_NAT_DONE : 1))
> + return 0;
Better untangle this code:
if (!test_bit(ATTR_STATUS, ct->head.set))
return 0;
if (!(ct->status & IPS_SRC_NAT_DONE))
return 0;
switch (ct->head.orig.l3protonum) {
case AF_INET:
return ct->repl.dst.v4 != ct->head.orig.src.v4;
default:
return 0;
}
> + switch (ct->head.orig.l3protonum) {
> + case AF_INET:
> + return ct->repl.dst.v4 != ct->head.orig.src.v4;
> + case AF_INET6:
> + return 0;
It is a bit strange to me that you add in this patch all these:
case AF_INET6:
return 0;
I'd rather see you adding this in 2/3 when you implement IPv6 support.
> + default:
> + return 0;
> + }
> }
>
next prev parent reply other threads:[~2016-05-17 15:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 12:50 [libnetfilter_conntrack PATCH 0/3] support for IPv6 NAT Arturo Borrero Gonzalez
2016-05-17 12:50 ` [libnetfilter_conntrack PATCH 1/3] src: add support for IPv6 to struct __nfct_nat Arturo Borrero Gonzalez
2016-05-17 15:45 ` Pablo Neira Ayuso [this message]
2016-05-17 12:50 ` [libnetfilter_conntrack PATCH 2/3] src: add support for IPv6 NAT Arturo Borrero Gonzalez
2016-05-17 15:38 ` Pablo Neira Ayuso
2016-05-17 12:50 ` [libnetfilter_conntrack PATCH 3/3] qa: update test_api with " Arturo Borrero Gonzalez
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=20160517154549.GA1998@salvia \
--to=pablo@netfilter.org \
--cc=arturo.borrero.glez@gmail.com \
--cc=fw@strlen.de \
--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).