Linux Netfilter development
 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>,
	Giuseppe Longo <giuseppelng@gmail.com>
Subject: Re: [ebtables-compat-experimental5 PATCH] iptables: xtables-eb: adjust policy in user-defined chains
Date: Wed, 19 Nov 2014 13:36:04 +0100	[thread overview]
Message-ID: <20141119123604.GA8544@salvia> (raw)
In-Reply-To: <CAOkSjBjFf9vi98B8oJ1y2LGjaYg+s4nP1uMKn0bqCUYh2wxRFg@mail.gmail.com>

On Wed, Nov 19, 2014 at 01:23:01PM +0100, Arturo Borrero Gonzalez wrote:
> On 18 November 2014 19:43, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >>                       if (command == 'N' && c == 'P') {
> >> -                             command = c;
> >> -                             optind--; /* No table specified */
> >> -                             goto handle_P;
> >> +                             xtables_error(PARAMETER_PROBLEM,
> >> +                                           "The default policy in user-defined"
> >> +                                           " chains is RETURN (mandatory)");
> >>                       }
> >
> > I'd really prefer to avoid changes in the ebtables parser. Could you
> > perform this checking from later on, when validating the
> > configuration.
> >
> >         if (strcmp(chain, "INPUT") != 0 &&
> >             strcmp(chain, "FORWARD") != 0 &&
> >             ...                           &&
> >             strcmp(policy, "RETURN") != 0)
> >                 xtables_error("...);
> >
> 
> In the user-defined chain creation path, the code jumps to several
> places (the goto handle_P; thing). I don't see clearly a zone where to
> put these validations.
> 
> Could you please point to where would you like to put this code?

This will leave the while ((c = getopt_long ...) loop at some point,
right? So perform the validation after the parsing is done.

      reply	other threads:[~2014-11-19 12:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17 12:36 [ebtables-compat-experimental5 PATCH] iptables: xtables-eb: adjust policy in user-defined chains Arturo Borrero Gonzalez
2014-11-18 18:43 ` Pablo Neira Ayuso
2014-11-19 12:23   ` Arturo Borrero Gonzalez
2014-11-19 12:36     ` Pablo Neira Ayuso [this message]

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=20141119123604.GA8544@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo.borrero.glez@gmail.com \
    --cc=giuseppelng@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