From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org, kaber@trash.net
Subject: Re: [nf_tables PATCH v4 1/5] netfilter: nft_nat: include a flag attribute
Date: Tue, 9 Sep 2014 11:50:03 +0200 [thread overview]
Message-ID: <20140909095003.GA9128@salvia> (raw)
In-Reply-To: <20140904120518.5971.77791.stgit@nfdev.cica.es>
On Thu, Sep 04, 2014 at 02:06:14PM +0200, Arturo Borrero Gonzalez wrote:
> Both SNAT and DNAT (and the upcoming masquerade) can have additional
> configuration parameters, such as port randomization or NAT addressing
> persistence.
> We can cover these scenarios by simply adding a flag attribute for
> userspace to fill when needed.
>
> The flags to use are defined in include/uapi/linux/netfilter/nf_nat.h,
> NF_NAT_RANGE_MAP_IPS
> NF_NAT_RANGE_PROTO_SPECIFIED
> NF_NAT_RANGE_PROTO_RANDOM
> NF_NAT_RANGE_PERSISTENT
> NF_NAT_RANGE_PROTO_RANDOM_FULLY
> NF_NAT_RANGE_PROTO_RANDOM_ALL
>
> The caller must take care of not messing up with the flags, as they are
> added unconditionally to the final resulting nf_nat_range.
Not sure this comment is relevant. Of course, userspace should select
the flags accordingly :-). Let me know if the intention was other than
insisting on the fact that the flags alter the way the NAT is done.
> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
> v2: address Florian Westphal's comments: check all flag bits to be known.
> v3: style cleanup requested by Pablo Neira. Mask name shortened.
> v4: nf-next rebase.
>
> include/uapi/linux/netfilter/nf_nat.h | 5 +++++
> include/uapi/linux/netfilter/nf_tables.h | 2 ++
> net/netfilter/nft_nat.c | 16 ++++++++++++++++
> 3 files changed, 23 insertions(+)
>
> diff --git a/include/uapi/linux/netfilter/nf_nat.h b/include/uapi/linux/netfilter/nf_nat.h
> index 1ad3659..898db2d 100644
> --- a/include/uapi/linux/netfilter/nf_nat.h
> +++ b/include/uapi/linux/netfilter/nf_nat.h
> @@ -13,6 +13,11 @@
> #define NF_NAT_RANGE_PROTO_RANDOM_ALL \
> (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
>
> +#define NF_NAT_RANGE_MASK \
> + (NF_NAT_RANGE_MAP_IPS|NF_NAT_RANGE_PROTO_SPECIFIED \
> + |NF_NAT_RANGE_PROTO_RANDOM|NF_NAT_RANGE_PERSISTENT \
> + |NF_NAT_RANGE_PROTO_RANDOM_FULLY)
I'm going to make the following comestic change:
#define NF_NAT_RANGE_MASK \
(NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \
NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \
NF_NAT_RANGE_PROTO_RANDOM_FULLY)
Next time, place the '|' '&' and so on after at the end of the line.
If no more comments, I'll push this to nf-next. Thanks.
next prev parent reply other threads:[~2014-09-09 9:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 12:06 [nf_tables PATCH v4 1/5] netfilter: nft_nat: include a flag attribute Arturo Borrero Gonzalez
2014-09-04 12:06 ` [nf_tables PATCH v4 2/5] netfilter: nf_nat_masquerade_ipv4: code factorization Arturo Borrero Gonzalez
2014-09-09 9:52 ` Pablo Neira Ayuso
2014-09-04 12:06 ` [nf_tables PATCH v4 3/5] netfilter: nf_nat_masquerade_ipv6: " Arturo Borrero Gonzalez
2014-09-09 9:52 ` Pablo Neira Ayuso
2014-09-04 12:07 ` [nf_tables PATCH v4 4/5] netfilter: nft_nat: split code in AF parts Arturo Borrero Gonzalez
2014-09-04 12:07 ` [nf_tables PATCH v4 5/5] netfilter: nft_nat: add masquerade support Arturo Borrero Gonzalez
2014-09-04 12:21 ` Patrick McHardy
2014-09-04 12:40 ` Pablo Neira Ayuso
2014-09-04 13:54 ` Arturo Borrero Gonzalez
2014-09-04 14:31 ` Patrick McHardy
2014-09-09 9:50 ` Pablo Neira Ayuso [this message]
2014-09-09 10:14 ` [nf_tables PATCH v4 1/5] netfilter: nft_nat: include a flag attribute Arturo Borrero Gonzalez
2014-09-09 11:08 ` Pablo Neira Ayuso
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=20140909095003.GA9128@salvia \
--to=pablo@netfilter.org \
--cc=arturo.borrero.glez@gmail.com \
--cc=kaber@trash.net \
--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).