diff mbox

ipv6 route: Aggregate table getting code

Message ID 1445129499-2496-1-git-send-email-masashi.honma@gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Masashi Honma Oct. 18, 2015, 12:51 a.m. UTC
These lines could be aggregated to one line because fib6_new_table() calls
fib6_get_table() inside on both cases CONFIG_IPV6_MULTIPLE_TABLES is enabled or
not.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 net/ipv6/route.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

David Miller Oct. 19, 2015, 6:09 a.m. UTC | #1
From: Masashi Honma <masashi.honma@gmail.com>
Date: Sun, 18 Oct 2015 09:51:39 +0900

> These lines could be aggregated to one line because fib6_new_table() calls
> fib6_get_table() inside on both cases CONFIG_IPV6_MULTIPLE_TABLES is enabled or
> not.
> 
> Signed-off-by: Masashi Honma <masashi.honma@gmail.com>

This is not correct.

The whole point of the test is so that the kernel log message
warning for failing to provide NLM_F_CREATE can be printed
in precisely the correct conditions.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masashi Honma Oct. 25, 2015, 2:42 a.m. UTC | #2
On 2015/10/19 15:09, David Miller wrote:
> This is not correct.
>
> The whole point of the test is so that the kernel log message
> warning for failing to provide NLM_F_CREATE can be printed
> in precisely the correct conditions.

Thanks. Now I understand importance of the warning.

Though fib6_get_table() is called twice to show the warning.
So I made another patch to reduce calling the function.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index cb32ce2..1ff4130 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1778,16 +1778,7 @@  int ip6_route_info_create(struct fib6_config *cfg, struct rt6_info **rt_ret)
 		cfg->fc_metric = IP6_RT_PRIO_USER;
 
 	err = -ENOBUFS;
-	if (cfg->fc_nlinfo.nlh &&
-	    !(cfg->fc_nlinfo.nlh->nlmsg_flags & NLM_F_CREATE)) {
-		table = fib6_get_table(net, cfg->fc_table);
-		if (!table) {
-			pr_warn("NLM_F_CREATE should be specified when creating new route\n");
-			table = fib6_new_table(net, cfg->fc_table);
-		}
-	} else {
-		table = fib6_new_table(net, cfg->fc_table);
-	}
+	table = fib6_new_table(net, cfg->fc_table);
 
 	if (!table)
 		goto out;