All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Cc: netdev@vger.kernel.org, Andrew Collins <bsderandrew@gmail.com>
Subject: Re: [PATCH] fib_rules: add .suppress operation
Date: Sat, 27 Jul 2013 09:07:58 +0200	[thread overview]
Message-ID: <20130727070758.GA23904@order.stressinduktion.org> (raw)
In-Reply-To: <20130726104657.GF10216@zirkel.wertarbyte.de>

Hm, IPv4 actually seems to have the same problem:

On Fri, Jul 26, 2013 at 12:46:57PM +0200, Stefan Tomanek wrote:
> +static int fib4_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg) {
> +	/* do not accept result if the route does not meet the required prefix length */
> +	struct fib_result *result = (struct fib_result *) arg->result;
> +	if (result->prefixlen < rule->table_prefixlen_min) {
> +		return 1;
> +	}
> +	return 0;
> +}

In case of suppressing the route, we need to decrement the reference counter
of fib_info:

if (!(fib_flags & FIB_LOOKUP_NOREF))
	fib_info_put(result->fi);	


Also:

> index e361f48..bb15664 100644
> --- a/include/net/fib_rules.h
> +++ b/include/net/fib_rules.h
> @@ -18,6 +18,7 @@ struct fib_rule {
>         u32                     pref;
>         u32                     flags;
>         u32                     table;
> +       u8                      table_prefixlen_min;
>         u8                      action;
>         u32                     target;
>         struct fib_rule __rcu   *ctarget;
> @@ -46,6 +47,8 @@ struct fib_rules_ops {   
>         int                     (*action)(struct fib_rule *,
>                                           struct flowi *, int,
>                                           struct fib_lookup_arg *);
> +       int                     (*suppress)(struct fib_rule *,
> +                                           struct fib_lookup_arg *);

          bool and true/false would be nicer.

>         int                     (*match)(struct fib_rule *,
>                                          struct flowi *, int);
>         int                     (*configure)(struct fib_rule *,
> 

Greetings,

  Hannes

  parent reply	other threads:[~2013-07-27  7:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 22:02 [PATCH] fib_rules: add minimum prefix length Stefan Tomanek
2013-07-23 22:38 ` Stephen Hemminger
2013-07-23 22:52   ` Stefan Tomanek
2013-07-24  2:14 ` Hannes Frederic Sowa
2013-07-24  7:57   ` Stefan Tomanek
2013-07-25 16:29   ` Stefan Tomanek
2013-07-25 17:43     ` [PATCH] fib_rules/fib6rules: " Stefan Tomanek
2013-07-25 18:17     ` [PATCH] fib_rules: " Hannes Frederic Sowa
2013-07-25 18:28       ` Stefan Tomanek
2013-07-25 21:46         ` Andrew Collins
2013-07-25 22:11           ` Stefan Tomanek
2013-07-26 10:46             ` [PATCH] fib_rules: add .suppress operation Stefan Tomanek
2013-07-26 17:05               ` Hannes Frederic Sowa
2013-07-27  6:08                 ` Hannes Frederic Sowa
2013-07-27  6:26               ` Hannes Frederic Sowa
2013-07-27  7:07               ` Hannes Frederic Sowa [this message]
2013-07-27 10:21                 ` Stefan Tomanek
2013-07-27 15:10                   ` Hannes Frederic Sowa
2013-07-28 10:36                     ` Stefan Tomanek
2013-07-30  6:52                 ` [PATCH v2 1/2] fib6_rules: make error handling consistent with IPv4 Stefan Tomanek
2013-07-30  6:53                 ` [PATCH v2 2/2] fib_rules: add .suppress operation Stefan Tomanek
2013-07-30  7:03                   ` David Miller
2013-07-30  7:23                     ` Stefan Tomanek
2013-07-30  7:34                       ` David Miller
2013-07-30  7:46                 ` [PATCH v3] " Stefan Tomanek
2013-07-31 22:13                   ` David Miller
2013-08-01  0:24                     ` Stefan Tomanek
2013-08-01  0:26                       ` David Miller
2013-08-01  0:17                 ` [PATCH v4] " Stefan Tomanek
2013-08-01  0:27                   ` David Miller
2013-08-01  1:26                     ` Stefan Tomanek
2013-08-01  5:35                       ` Hannes Frederic Sowa
2013-07-26 10:54           ` [PATCH] fib_rules: add minimum prefix length Stefan Tomanek

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=20130727070758.GA23904@order.stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=bsderandrew@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefan.tomanek@wertarbyte.de \
    /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.