]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: fib_rules: Factorise fib_newrule() and fib_delrule().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 7 Feb 2025 07:24:59 +0000 (16:24 +0900)
committerJakub Kicinski <kuba@kernel.org>
Tue, 11 Feb 2025 03:08:52 +0000 (19:08 -0800)
commita0596c2c63fc9d9ad16d701044293e11d8f97953
tree87737c9a47fbee0a1024875b118d07478697726e
parent5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d
net: fib_rules: Factorise fib_newrule() and fib_delrule().

fib_nl_newrule() / fib_nl_delrule() is the doit() handler for
RTM_NEWRULE / RTM_DELRULE but also called from vrf_newlink().

Currently, we hold RTNL on both paths but will not on the former.

Also, we set dev_net(dev)->rtnl to skb->sk in vrf_fib_rule() because
fib_nl_newrule() / fib_nl_delrule() fetch net as sock_net(skb->sk).

Let's Factorise the two functions and pass net and rtnl_held flag.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20250207072502.87775-6-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/vrf.c
include/net/fib_rules.h
net/core/fib_rules.c