From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: Netfilter Development Mailing list
<netfilter-devel@vger.kernel.org>,
Patrick McHardy <kaber@trash.net>
Subject: Re: [nf_tables PATCH 3/3] netfilter: nf_tables: add new expression nft_redir
Date: Thu, 16 Oct 2014 10:41:50 +0200 [thread overview]
Message-ID: <20141016084150.GB8862@salvia> (raw)
In-Reply-To: <CAOkSjBh4TJ5kqX_hCf+AnnB8HQfbv=crywwxdQ4x4+K5M1NVmA@mail.gmail.com>
On Wed, Oct 15, 2014 at 01:14:12PM +0200, Arturo Borrero Gonzalez wrote:
> On 15 October 2014 12:06, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >> +int nft_redir_init(const struct nft_ctx *ctx,
> >> + const struct nft_expr *expr,
> >> + const struct nlattr * const tb[])
> >> +{
> >> + struct nft_redir *priv = nft_expr_priv(expr);
> >> + int err;
> >> +
> >> + if (tb[NFTA_REDIR_REG_PROTO_MIN]) {
> >> + priv->sreg_proto_min = ntohl(nla_get_be32(
> >> + tb[NFTA_REDIR_REG_PROTO_MIN]));
> >
> > I prefer this:
> >
> > priv->sreg_proto_min =
> > ntohl(nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MIN]));
> >
> >
> >> + err = nft_validate_input_register(priv->sreg_proto_min);
> >> + if (err < 0)
> >> + return err;
> >> + }
> >
> > No else here? ->sreg_proto_min is left uninitialized.
> >
>
> Such behaviour is copied from nft_nat.
> I'm not sure to which value I should initialize sreg_proto_min.
This seems fine for redirect as ->sreg_proto_min will be zero. Keep in
mind that we have to support redirect with no port range specified. I
mean, iptables supports -j REDIRECT without arguments.
Regarding nft_nat, not good. I'm going to send a patch to reject
invalid configurations. At least one of the NFTA_NAT_REG_*_MIN needs to
be specified.
next prev parent reply other threads:[~2014-10-16 8:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 17:22 [nf_tables PATCH 1/3] netfilter: refactor NAT's redirect IPv4 code Arturo Borrero Gonzalez
2014-10-14 17:22 ` [nf_tables PATCH 2/3] netfilter: refactor NAT's redirect IPv6 code Arturo Borrero Gonzalez
2014-10-14 17:22 ` [nf_tables PATCH 3/3] netfilter: nf_tables: add new expression nft_redir Arturo Borrero Gonzalez
2014-10-15 10:06 ` Pablo Neira Ayuso
2014-10-15 10:11 ` Arturo Borrero Gonzalez
2014-10-15 11:14 ` Arturo Borrero Gonzalez
2014-10-16 8:41 ` Pablo Neira Ayuso [this message]
2014-10-15 9:50 ` [nf_tables PATCH 1/3] netfilter: refactor NAT's redirect IPv4 code 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=20141016084150.GB8862@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.