Commit f4797b33 authored by David Ahern's avatar David Ahern Committed by David S. Miller

net/ipv6: Add flags and table id to ip6_nh_lookup_table

onlink verification needs to do a lookup in potentially different
table than the table in fib6_config and without the RT6_LOOKUP_F_IFACE
flag. Change ip6_nh_lookup_table to take table id and flags as input
arguments. Both verifications want to ignore link state, so add that
flag can stay in the lookup helper.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1edce99f
...@@ -2440,7 +2440,8 @@ static int ip6_convert_metrics(struct mx6_config *mxc, ...@@ -2440,7 +2440,8 @@ static int ip6_convert_metrics(struct mx6_config *mxc,
static struct rt6_info *ip6_nh_lookup_table(struct net *net, static struct rt6_info *ip6_nh_lookup_table(struct net *net,
struct fib6_config *cfg, struct fib6_config *cfg,
const struct in6_addr *gw_addr) const struct in6_addr *gw_addr,
u32 tbid, int flags)
{ {
struct flowi6 fl6 = { struct flowi6 fl6 = {
.flowi6_oif = cfg->fc_ifindex, .flowi6_oif = cfg->fc_ifindex,
...@@ -2449,15 +2450,15 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net, ...@@ -2449,15 +2450,15 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
}; };
struct fib6_table *table; struct fib6_table *table;
struct rt6_info *rt; struct rt6_info *rt;
int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
table = fib6_get_table(net, cfg->fc_table); table = fib6_get_table(net, tbid);
if (!table) if (!table)
return NULL; return NULL;
if (!ipv6_addr_any(&cfg->fc_prefsrc)) if (!ipv6_addr_any(&cfg->fc_prefsrc))
flags |= RT6_LOOKUP_F_HAS_SADDR; flags |= RT6_LOOKUP_F_HAS_SADDR;
flags |= RT6_LOOKUP_F_IGNORE_LINKSTATE;
rt = ip6_pol_route(net, table, cfg->fc_ifindex, &fl6, flags); rt = ip6_pol_route(net, table, cfg->fc_ifindex, &fl6, flags);
/* if table lookup failed, fall back to full lookup */ /* if table lookup failed, fall back to full lookup */
...@@ -2480,7 +2481,10 @@ static int ip6_route_check_nh(struct net *net, ...@@ -2480,7 +2481,10 @@ static int ip6_route_check_nh(struct net *net,
int err = -EHOSTUNREACH; int err = -EHOSTUNREACH;
if (cfg->fc_table) { if (cfg->fc_table) {
grt = ip6_nh_lookup_table(net, cfg, gw_addr); int flags = RT6_LOOKUP_F_IFACE;
grt = ip6_nh_lookup_table(net, cfg, gw_addr,
cfg->fc_table, flags);
if (grt) { if (grt) {
if (grt->rt6i_flags & RTF_GATEWAY || if (grt->rt6i_flags & RTF_GATEWAY ||
(dev && dev != grt->dst.dev)) { (dev && dev != grt->dst.dev)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment