Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03cf786c authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller
Browse files

[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: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0fe91de
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -128,13 +128,14 @@ struct net_device * ip_dev_find(__be32 addr)
	struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
	struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
	struct fib_result res;
	struct fib_result res;
	struct net_device *dev = NULL;
	struct net_device *dev = NULL;
	struct fib_table *local_table;


#ifdef CONFIG_IP_MULTIPLE_TABLES
#ifdef CONFIG_IP_MULTIPLE_TABLES
	res.r = NULL;
	res.r = NULL;
#endif
#endif


	if (!ip_fib_local_table ||
	local_table = fib_get_table(RT_TABLE_LOCAL);
	    ip_fib_local_table->tb_lookup(ip_fib_local_table, &fl, &res))
	if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
		return NULL;
		return NULL;
	if (res.type != RTN_LOCAL)
	if (res.type != RTN_LOCAL)
		goto out;
		goto out;
@@ -152,6 +153,7 @@ unsigned inet_addr_type(__be32 addr)
	struct flowi		fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
	struct flowi		fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
	struct fib_result	res;
	struct fib_result	res;
	unsigned ret = RTN_BROADCAST;
	unsigned ret = RTN_BROADCAST;
	struct fib_table *local_table;


	if (ZERONET(addr) || BADCLASS(addr))
	if (ZERONET(addr) || BADCLASS(addr))
		return RTN_BROADCAST;
		return RTN_BROADCAST;
@@ -162,10 +164,10 @@ unsigned inet_addr_type(__be32 addr)
	res.r = NULL;
	res.r = NULL;
#endif
#endif


	if (ip_fib_local_table) {
	local_table = fib_get_table(RT_TABLE_LOCAL);
	if (local_table) {
		ret = RTN_UNICAST;
		ret = RTN_UNICAST;
		if (!ip_fib_local_table->tb_lookup(ip_fib_local_table,
		if (!local_table->tb_lookup(local_table, &fl, &res)) {
						   &fl, &res)) {
			ret = res.type;
			ret = res.type;
			fib_res_put(&res);
			fib_res_put(&res);
		}
		}