Skip to contentSkip to conversation

ipv4: Do not allow MAIN to be alias for new LOCAL w/ custom rules

PATCH In review Alexander Duyck 2 participants 2 messages Jan 2, 2017 – Jan 3, 2017

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

PATCH 1/1 ipv4: Do not allow MAIN to be alias for new LOCAL w/ custom rules

From: Alexander Duyck <[email protected]>

In the case of custom rules being present we need to handle the case of the LOCAL table being intialized after the new rule has been added. To address that I am adding a new check so that we can make certain we don't use an alias of MAIN for LOCAL when allocating a new table.

Fixes 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")
---
 net/ipv4/fib_frontend.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_frontend.c +1 -1
index 3ff8938893ec..eae0332b0e8c 100644
@@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id)
 	if (tb)
 		return tb;
 
-	if (id == RT_TABLE_LOCAL)
+	if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules)
 		alias = fib_new_table(net, RT_TABLE_MAIN);
 
 	tb = fib_trie_table(id, alias);
maintainer
#1 lore raw

From: Alexander Duyck <[email protected]>
Date: Mon, 02 Jan 2017 13:32:54 -0800

Quoted 10 lines

From: Alexander Duyck <[email protected]>

In the case of custom rules being present we need to handle the case of the LOCAL table being intialized after the new rule has been added. To address that I am adding a new check so that we can make certain we don't use an alias of MAIN for LOCAL when allocating a new table.

Fixes 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")

Applied and queued up for -stable, thanks Alex.