Skip to content

Commit f4797b3

Browse files
dsaherndavem330
authored andcommitted
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: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1edce99 commit f4797b3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/ipv6/route.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,7 +2440,8 @@ static int ip6_convert_metrics(struct mx6_config *mxc,
24402440

24412441
static struct rt6_info *ip6_nh_lookup_table(struct net *net,
24422442
struct fib6_config *cfg,
2443-
const struct in6_addr *gw_addr)
2443+
const struct in6_addr *gw_addr,
2444+
u32 tbid, int flags)
24442445
{
24452446
struct flowi6 fl6 = {
24462447
.flowi6_oif = cfg->fc_ifindex,
@@ -2449,15 +2450,15 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
24492450
};
24502451
struct fib6_table *table;
24512452
struct rt6_info *rt;
2452-
int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
24532453

2454-
table = fib6_get_table(net, cfg->fc_table);
2454+
table = fib6_get_table(net, tbid);
24552455
if (!table)
24562456
return NULL;
24572457

24582458
if (!ipv6_addr_any(&cfg->fc_prefsrc))
24592459
flags |= RT6_LOOKUP_F_HAS_SADDR;
24602460

2461+
flags |= RT6_LOOKUP_F_IGNORE_LINKSTATE;
24612462
rt = ip6_pol_route(net, table, cfg->fc_ifindex, &fl6, flags);
24622463

24632464
/* if table lookup failed, fall back to full lookup */
@@ -2480,7 +2481,10 @@ static int ip6_route_check_nh(struct net *net,
24802481
int err = -EHOSTUNREACH;
24812482

24822483
if (cfg->fc_table) {
2483-
grt = ip6_nh_lookup_table(net, cfg, gw_addr);
2484+
int flags = RT6_LOOKUP_F_IFACE;
2485+
2486+
grt = ip6_nh_lookup_table(net, cfg, gw_addr,
2487+
cfg->fc_table, flags);
24842488
if (grt) {
24852489
if (grt->rt6i_flags & RTF_GATEWAY ||
24862490
(dev && dev != grt->dst.dev)) {

0 commit comments

Comments
 (0)