[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1347451307.13103.885.camel@edumazet-glaptop>
Date: Wed, 12 Sep 2012 14:01:47 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>,
Lorenzo Colitti <lorenzo@...gle.com>,
Maciej Żenczykowski <maze@...gle.com>,
Tom Herbert <therbert@...gle.com>
Subject: [PATCH net-next 2/2] ipv6: dont cache cloned routes
From: Eric Dumazet <edumazet@...gle.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@...gle.com>
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Cc: Maciej Żenczykowski <maze@...gle.com>
Cc: Tom Herbert <therbert@...gle.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;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists