netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>
Subject: Re: [nft PATCH v2] src: add redirect support
Date: Tue, 4 Nov 2014 17:04:52 +0100	[thread overview]
Message-ID: <20141104160452.GA11419@salvia> (raw)
In-Reply-To: <CAOkSjBhMU2cw=B69G0=Rf-bC-H8BatAhA_07P=qFUjLYNCE4hg@mail.gmail.com>

On Tue, Nov 04, 2014 at 04:04:11PM +0100, Arturo Borrero Gonzalez wrote:
> On 4 November 2014 15:44, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Tue, Nov 04, 2014 at 02:56:58PM +0100, Arturo Borrero Gonzalez wrote:
> >> On 4 November 2014 14:37, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >> >
> >> > I think this needs to be:
> >> >
> >> > % nft add rule nat prerouting redirect [port] [nat_flags]
> >> >
> >>
> >> The port and nat_flags arguments are mutually exclusives. That's why I
> >> used the [port|nat_flags] syntax.
> >
> > iptables allows this:
> >
> > -j REDIRECT --to-ports 8000-8010 --random
> 
> Then, should I change the behaviour of the nft redirect parser?
> The code in my patch doesn't allow that.

Yes, you have to fix this.

> I think it makes no sense: "redirect to this port; no sorry, redirect
> to a random one."

--to-ports reads as "redirect all traffic from ports 8000 to 8010"
--random refers to --to-ports, it reads as "select the port from the
8000-8010 range at random"

If --random is not specified, then the NAT engines selects the destination
port in that range one after another (8000, 8001, 8002, ...) IIRC.

  reply	other threads:[~2014-11-04 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 10:41 [nft PATCH v2] src: add redirect support Arturo Borrero Gonzalez
2014-10-30 16:25 ` Pablo Neira Ayuso
2014-10-30 16:33   ` Pablo Neira Ayuso
2014-11-03 19:42   ` Arturo Borrero Gonzalez
2014-11-04 13:37     ` Pablo Neira Ayuso
2014-11-04 13:56       ` Arturo Borrero Gonzalez
2014-11-04 14:44         ` Pablo Neira Ayuso
2014-11-04 15:04           ` Arturo Borrero Gonzalez
2014-11-04 16:04             ` Pablo Neira Ayuso [this message]
2014-11-04 16:11               ` Arturo Borrero Gonzalez
  -- strict thread matches above, loose matches on Subject: below --
2014-11-03 20:20 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=20141104160452.GA11419@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo.borrero.glez@gmail.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).