aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 }