Skip to contentSkip to conversation

ipv6: don't count addrconf generated routes against gc limit

PATCH Superseded Hannes Frederic Sowa 2 participants 4 messages Dec 6, 2013 – Dec 10, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: don't count addrconf generated routes against gc limit

Brett Ciphery reported that new ipv6 addresses failed to get installed because the addrconf generated dsts where counted against the dst gc limit. We don't need to count those routes like we currently don't count administratively added routes.

Because the max_addresses check enforces a limit on unbounded address generation first in case someone plays with router advertisments, we are still safe here.

---
 net/ipv6/route.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/route.c +2 -1
index ddb9d41..11fdf1f 100644
@@ -2166,7 +2166,8 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
 				    bool anycast)
 {
 	struct net *net = dev_net(idev->dev);
-	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, 0, NULL);
+	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev,
+					    DST_NOCOUNT, NULL);
 
 	if (!rt) {
 		net_warn_ratelimited("Maximum number of routes reached, consider increasing route/max_size\n");
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Fri, 6 Dec 2013 18:25:56 +0100

net/ipv6/route.c struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, · line 2173

Quoted 10 lines
net/ipv6/route.c +2 -1
@@ -2166,7 +2166,8 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
 				    bool anycast)
 {
 	struct net *net = dev_net(idev->dev);
-	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, 0, NULL);
+	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev,
+					    DST_NOCOUNT, NULL);
 
 	if (!rt) {
 		net_warn_ratelimited("Maximum number of routes reached, consider increasing route/max_size\n");

So basically, we only want to count routes that will have RTF_CACHE set on them.

This warning in the net_warn_ratelimited() is no longer relevant, only hard memory allocation failures can result in this !rt condition. So please respin this patch with that warning removed.

Thanks.

#2 lore raw

PATCH v2 1/1 ipv6: don't count addrconf generated routes against gc limit

Brett Ciphery reported that new ipv6 addresses failed to get installed because the addrconf generated dsts where counted against the dst gc limit. We don't need to count those routes like we currently don't count administratively added routes.

Because the max_addresses check enforces a limit on unbounded address generation first in case someone plays with router advertisments, we are still safe here.

---

Quoted 2 lines · David Miller

So basically, we only want to count routes that will have RTF_CACHE set on them.

Exactly.

Quoted 3 lines

This warning in the net_warn_ratelimited() is no longer relevant, only hard memory allocation failures can result in this !rt condition. So please respin this patch with that warning removed.

Sorry, I spinned the patch too fast after testing.

 net/ipv6/route.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/ipv6/route.c +3 -5
index ddb9d41..a0a48ac 100644
@@ -2166,12 +2166,10 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
 				    bool anycast)
 {
 	struct net *net = dev_net(idev->dev);
-	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, 0, NULL);
-
-	if (!rt) {
-		net_warn_ratelimited("Maximum number of routes reached, consider increasing route/max_size\n");
+	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev,
+					    DST_NOCOUNT, NULL);
+	if (!rt)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	in6_dev_hold(idev);
 
Signature · 1 line
1.8.3.1
maintainer
#3 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 7 Dec 2013 03:33:45 +0100

Quoted 11 lines

Brett Ciphery reported that new ipv6 addresses failed to get installed because the addrconf generated dsts where counted against the dst gc limit. We don't need to count those routes like we currently don't count administratively added routes.

Because the max_addresses check enforces a limit on unbounded address generation first in case someone plays with router advertisments, we are still safe here.

Applied and queued up for -stable, thanks!