* [PATCH] Explicitly call fib_get_table() in fib_frontend.c
@ 2007-10-22 15:56 Pavel Emelyanov
2007-10-24 4:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 15:56 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, devel
In case the "multiple tables" config option is y, the ip_fib_local_table
is not a variable, but a macro, that calls fib_get_table(RT_TABLE_LOCAL).
Some code uses this "variable" *3* times in one place, thus implicitly
making 3 calls. Fix it.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 78b514b..6012390 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -128,13 +128,14 @@ struct net_device * ip_dev_find(__be32 addr)
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
struct fib_result res;
struct net_device *dev = NULL;
+ struct fib_table *local_table;
#ifdef CONFIG_IP_MULTIPLE_TABLES
res.r = NULL;
#endif
- if (!ip_fib_local_table ||
- ip_fib_local_table->tb_lookup(ip_fib_local_table, &fl, &res))
+ local_table = fib_get_table(RT_TABLE_LOCAL);
+ if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
return NULL;
if (res.type != RTN_LOCAL)
goto out;
@@ -152,6 +153,7 @@ unsigned inet_addr_type(__be32 addr)
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
struct fib_result res;
unsigned ret = RTN_BROADCAST;
+ struct fib_table *local_table;
if (ZERONET(addr) || BADCLASS(addr))
return RTN_BROADCAST;
@@ -162,10 +164,10 @@ unsigned inet_addr_type(__be32 addr)
res.r = NULL;
#endif
- if (ip_fib_local_table) {
+ local_table = fib_get_table(RT_TABLE_LOCAL);
+ if (local_table) {
ret = RTN_UNICAST;
- if (!ip_fib_local_table->tb_lookup(ip_fib_local_table,
- &fl, &res)) {
+ if (!local_table->tb_lookup(local_table, &fl, &res)) {
ret = res.type;
fib_res_put(&res);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Explicitly call fib_get_table() in fib_frontend.c
2007-10-22 15:56 [PATCH] Explicitly call fib_get_table() in fib_frontend.c Pavel Emelyanov
@ 2007-10-24 4:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-10-24 4:17 UTC (permalink / raw)
To: xemul; +Cc: netdev, devel
From: Pavel Emelyanov <xemul@openvz.org>
Date: Mon, 22 Oct 2007 19:56:04 +0400
> In case the "multiple tables" config option is y, the ip_fib_local_table
> is not a variable, but a macro, that calls fib_get_table(RT_TABLE_LOCAL).
>
> Some code uses this "variable" *3* times in one place, thus implicitly
> making 3 calls. Fix it.
>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Good catch, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-24 4:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 15:56 [PATCH] Explicitly call fib_get_table() in fib_frontend.c Pavel Emelyanov
2007-10-24 4:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).