aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-10-24 00:17:27 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-24 00:27:58 -0400
commit03cf786c4e83dba404ad23ca58f49147ae52dffd (patch)
treedc694a37209df68386edf7bc94ffa28df7e9cffc /net/ipv4/fib_frontend.c
parentf0fe91ded36bab95541e960ae8a115abc1f5ba03 (diff)
[IPV4]: Explicitly call fib_get_table() in fib_frontend.c
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 78b514ba1414..60123905dbbf 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)
128 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 128 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
129 struct fib_result res; 129 struct fib_result res;
130 struct net_device *dev = NULL; 130 struct net_device *dev = NULL;
131 struct fib_table *local_table;
131 132
132#ifdef CONFIG_IP_MULTIPLE_TABLES 133#ifdef CONFIG_IP_MULTIPLE_TABLES
133 res.r = NULL; 134 res.r = NULL;
134#endif 135#endif
135 136
136 if (!ip_fib_local_table || 137 local_table = fib_get_table(RT_TABLE_LOCAL);
137 ip_fib_local_table->tb_lookup(ip_fib_local_table, &fl, &res)) 138 if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
138 return NULL; 139 return NULL;
139 if (res.type != RTN_LOCAL) 140 if (res.type != RTN_LOCAL)
140 goto out; 141 goto out;
@@ -152,6 +153,7 @@ unsigned inet_addr_type(__be32 addr)
152 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 153 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
153 struct fib_result res; 154 struct fib_result res;
154 unsigned ret = RTN_BROADCAST; 155 unsigned ret = RTN_BROADCAST;
156 struct fib_table *local_table;
155 157
156 if (ZERONET(addr) || BADCLASS(addr)) 158 if (ZERONET(addr) || BADCLASS(addr))
157 return RTN_BROADCAST; 159 return RTN_BROADCAST;
@@ -162,10 +164,10 @@ unsigned inet_addr_type(__be32 addr)
162 res.r = NULL; 164 res.r = NULL;
163#endif 165#endif
164 166
165 if (ip_fib_local_table) { 167 local_table = fib_get_table(RT_TABLE_LOCAL);
168 if (local_table) {
166 ret = RTN_UNICAST; 169 ret = RTN_UNICAST;
167 if (!ip_fib_local_table->tb_lookup(ip_fib_local_table, 170 if (!local_table->tb_lookup(local_table, &fl, &res)) {
168 &fl, &res)) {
169 ret = res.type; 171 ret = res.type;
170 fib_res_put(&res); 172 fib_res_put(&res);
171 } 173 }