mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
net: Move call_fib_rule_notifiers up in fib_nl_newrule
Move call_fib_rule_notifiers up in fib_nl_newrule to the point right before the rule is inserted into the list. At this point there are no more failure paths within the core rule code, so if the notifier does not fail then the rule will be inserted into the list. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c30d9356e9
commit
9776d32537
1 changed files with 5 additions and 1 deletions
|
@ -631,6 +631,11 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
if (err < 0)
|
||||
goto errout_free;
|
||||
|
||||
err = call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD, rule, ops,
|
||||
extack);
|
||||
if (err < 0)
|
||||
goto errout_free;
|
||||
|
||||
list_for_each_entry(r, &ops->rules_list, list) {
|
||||
if (r->pref > rule->pref)
|
||||
break;
|
||||
|
@ -667,7 +672,6 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
if (rule->tun_id)
|
||||
ip_tunnel_need_metadata();
|
||||
|
||||
call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD, rule, ops, extack);
|
||||
notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).portid);
|
||||
flush_route_cache(ops);
|
||||
rules_ops_put(ops);
|
||||
|
|
Loading…
Reference in a new issue