netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Lorenzo Colitti <lorenzo@google.com>,
	Tom Herbert <therbert@google.com>
Subject: Re: [PATCH net-next 2/2] ipv6: dont cache cloned routes
Date: Wed, 12 Sep 2012 13:52:44 -0700	[thread overview]
Message-ID: <CANP3RGe41V_he=8mARs9FXc+vfrf=N+ipw5YoadiWx5hZuyyrw@mail.gmail.com> (raw)
In-Reply-To: <1347451307.13103.885.camel@edumazet-glaptop>

Acked-by: Maciej Żenczykowski <maze@google.com>

On Wed, Sep 12, 2012 at 5:01 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> We can now destroy cloned routes immediately from dst_release() instead
> of depending on garbage collection.
>
> Set DST_NOCACHE in rt6_alloc_clone() so that :
>
> 1) we avoid calling ip6_ins_rt() on such routes
>
> 2) dst_release() can call destroy when refcount becomes 0
>
> This allows machines to resist to DDOS.
>
> Reported-by: Lorenzo Colitti <lorenzo@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Maciej Żenczykowski <maze@google.com>
> Cc: Tom Herbert <therbert@google.com>
> ---
>  net/ipv6/route.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index d4ba3fc..fedbb41 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -840,6 +840,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort,
>         struct rt6_info *rt = ip6_rt_copy(ort, daddr);
>
>         if (rt) {
> +               rt->dst.flags |= DST_NOCACHE;
>                 rt->rt6i_flags |= RTF_CACHE;
>                 rt->n = neigh_clone(ort->n);
>         }
> @@ -887,7 +888,7 @@ restart:
>
>         dst_hold(&rt->dst);
>         if (nrt) {
> -               err = ip6_ins_rt(nrt);
> +               err = (nrt->dst.flags & DST_NOCACHE) ? 0 : ip6_ins_rt(nrt);
>                 if (!err)
>                         goto out2;
>         }
>
>

  reply	other threads:[~2012-09-12 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 12:01 [PATCH net-next 2/2] ipv6: dont cache cloned routes Eric Dumazet
2012-09-12 20:52 ` Maciej Żenczykowski [this message]
2012-09-13 21:02 ` David Miller

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='CANP3RGe41V_he=8mARs9FXc+vfrf=N+ipw5YoadiWx5hZuyyrw@mail.gmail.com' \
    --to=zenczykowski@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=lorenzo@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    /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).