Commit ebee3cad authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

ipv6: Add IPv6 multipath notifications for add / replace

Emit a notification when a multipath routes is added or replace.

Note that unlike the replace notifications sent from fib6_add_rt2node(),
it is possible we are sending a 'FIB_EVENT_ENTRY_REPLACE' when a route
was merely added and not replaced.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d133e4f1
...@@ -4965,6 +4965,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, ...@@ -4965,6 +4965,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
{ {
struct fib6_info *rt_notif = NULL, *rt_last = NULL; struct fib6_info *rt_notif = NULL, *rt_last = NULL;
struct nl_info *info = &cfg->fc_nlinfo; struct nl_info *info = &cfg->fc_nlinfo;
enum fib_event_type event_type;
struct fib6_config r_cfg; struct fib6_config r_cfg;
struct rtnexthop *rtnh; struct rtnexthop *rtnh;
struct fib6_info *rt; struct fib6_info *rt;
...@@ -5042,6 +5043,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, ...@@ -5042,6 +5043,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
*/ */
info->skip_notify = 1; info->skip_notify = 1;
/* For add and replace, send one notification with all nexthops. For
* append, send one notification with all appended nexthops.
*/
info->skip_notify_kernel = 1;
err_nh = NULL; err_nh = NULL;
list_for_each_entry(nh, &rt6_nh_list, next) { list_for_each_entry(nh, &rt6_nh_list, next) {
err = __ip6_ins_rt(nh->fib6_info, info, extack); err = __ip6_ins_rt(nh->fib6_info, info, extack);
...@@ -5078,6 +5084,15 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, ...@@ -5078,6 +5084,15 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
nhn++; nhn++;
} }
event_type = replace ? FIB_EVENT_ENTRY_REPLACE : FIB_EVENT_ENTRY_ADD;
err = call_fib6_multipath_entry_notifiers(info->nl_net, event_type,
rt_notif, nhn - 1, extack);
if (err) {
/* Delete all the siblings that were just added */
err_nh = NULL;
goto add_errout;
}
/* success ... tell user about new route */ /* success ... tell user about new route */
ip6_route_mpath_notify(rt_notif, rt_last, info, nlflags); ip6_route_mpath_notify(rt_notif, rt_last, info, nlflags);
goto cleanup; goto cleanup;
......
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