mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-18 10:34:24 +08:00
nexthop: Only emit a notification when nexthop is actually deleted
Currently, the in-kernel delete notification is emitted from the error path of nexthop_add() and replace_nexthop(), which can be confusing to in-kernel listeners as they are not familiar with the nexthop. Instead, only emit the notification when the nexthop is actually deleted. The following sub-cases are covered: 1. User space deletes the nexthop 2. The nexthop is deleted by the kernel due to a netdev event (e.g., nexthop device going down) 3. A group is deleted because its last nexthop is being deleted 4. The network namespace of the nexthop device is deleted Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
80690ec6b5
commit
0695564bb4
@ -870,8 +870,6 @@ static void __remove_nexthop_fib(struct net *net, struct nexthop *nh)
|
|||||||
bool do_flush = false;
|
bool do_flush = false;
|
||||||
struct fib_info *fi;
|
struct fib_info *fi;
|
||||||
|
|
||||||
call_nexthop_notifiers(net, NEXTHOP_EVENT_DEL, nh);
|
|
||||||
|
|
||||||
list_for_each_entry(fi, &nh->fi_list, nh_list) {
|
list_for_each_entry(fi, &nh->fi_list, nh_list) {
|
||||||
fi->fib_flags |= RTNH_F_DEAD;
|
fi->fib_flags |= RTNH_F_DEAD;
|
||||||
do_flush = true;
|
do_flush = true;
|
||||||
@ -909,6 +907,8 @@ static void __remove_nexthop(struct net *net, struct nexthop *nh,
|
|||||||
static void remove_nexthop(struct net *net, struct nexthop *nh,
|
static void remove_nexthop(struct net *net, struct nexthop *nh,
|
||||||
struct nl_info *nlinfo)
|
struct nl_info *nlinfo)
|
||||||
{
|
{
|
||||||
|
call_nexthop_notifiers(net, NEXTHOP_EVENT_DEL, nh);
|
||||||
|
|
||||||
/* remove from the tree */
|
/* remove from the tree */
|
||||||
rb_erase(&nh->rb_node, &net->nexthop.rb_root);
|
rb_erase(&nh->rb_node, &net->nexthop.rb_root);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user