浏览代码

ipv6: don't set DST_NOCOUNT for remotely added routes

DST_NOCOUNT should only be used if an authorized user adds routes
locally. In case of routes which are added on behalf of router
advertisments this flag must not get used as it allows an unlimited
number of routes getting added remotely.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Sabrina Dubroca 11 年之前
父节点
当前提交
c88507fbad
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/ipv6/route.c

+ 1 - 1
net/ipv6/route.c

@@ -1513,7 +1513,7 @@ int ip6_route_add(struct fib6_config *cfg)
 	if (!table)
 	if (!table)
 		goto out;
 		goto out;
 
 
-	rt = ip6_dst_alloc(net, NULL, DST_NOCOUNT, table);
+	rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table);
 
 
 	if (!rt) {
 	if (!rt) {
 		err = -ENOMEM;
 		err = -ENOMEM;