Skip to content

Commit 4a8e56e

Browse files
idoschdavem330
authored andcommitted
ipv6: Export sernum update function
We are going to allow dead routes to stay in the FIB tree (e.g., when they are part of a multipath route, directly connected route with no carrier) and revive them when their nexthop device gains carrier or when it is put administratively up. This is equivalent to the addition of the route to the FIB tree and we should therefore take care of updating the sernum of all the parent nodes of the node where the route is stored. Otherwise, we risk sockets caching and using sub-optimal dst entries. Export the function that performs the above, so that it could be invoked from fib6_ifup() later on. Signed-off-by: Ido Schimmel <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b5cb5a7 commit 4a8e56e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

include/net/ip6_fib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ unsigned int fib6_tables_seq_read(struct net *net);
405405
int fib6_tables_dump(struct net *net, struct notifier_block *nb);
406406

407407
void fib6_update_sernum(struct rt6_info *rt);
408+
void fib6_update_sernum_upto_root(struct net *net, struct rt6_info *rt);
408409

409410
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
410411
int fib6_rules_init(void);

net/ipv6/ip6_fib.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,8 @@ void fib6_force_start_gc(struct net *net)
11021102
jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
11031103
}
11041104

1105-
static void fib6_update_sernum_upto_root(struct rt6_info *rt,
1106-
int sernum)
1105+
static void __fib6_update_sernum_upto_root(struct rt6_info *rt,
1106+
int sernum)
11071107
{
11081108
struct fib6_node *fn = rcu_dereference_protected(rt->rt6i_node,
11091109
lockdep_is_held(&rt->rt6i_table->tb6_lock));
@@ -1117,6 +1117,11 @@ static void fib6_update_sernum_upto_root(struct rt6_info *rt,
11171117
}
11181118
}
11191119

1120+
void fib6_update_sernum_upto_root(struct net *net, struct rt6_info *rt)
1121+
{
1122+
__fib6_update_sernum_upto_root(rt, fib6_new_sernum(net));
1123+
}
1124+
11201125
/*
11211126
* Add routing information to the routing tree.
11221127
* <destination addr>/<source addr>
@@ -1230,7 +1235,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt,
12301235

12311236
err = fib6_add_rt2node(fn, rt, info, mxc, extack);
12321237
if (!err) {
1233-
fib6_update_sernum_upto_root(rt, sernum);
1238+
__fib6_update_sernum_upto_root(rt, sernum);
12341239
fib6_start_gc(info->nl_net, rt);
12351240
}
12361241

0 commit comments

Comments
 (0)