]> www.infradead.org Git - users/hch/misc.git/commit
nexthop: Move NHA_OIF validation to rtm_to_nh_config_rtnl().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Wed, 19 Mar 2025 23:06:48 +0000 (16:06 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 25 Mar 2025 14:31:59 +0000 (07:31 -0700)
commitcaa074573ca0a110b609bf35b7fec3d967945315
tree4fb05b9416e5a61ace549fe29ea99d5a5fba95ea
parent9b9674f3e73a2be9a702d65b77fdac279590a009
nexthop: Move NHA_OIF validation to rtm_to_nh_config_rtnl().

NHA_OIF needs to look up a device by __dev_get_by_index(),
which requires RTNL.

Let's move NHA_OIF validation to rtm_to_nh_config_rtnl().

Note that the proceeding checks made the original !cfg->nh_fdb
check redundant.

  NHA_FDB is set           -> NHA_OIF cannot be set
  NHA_FDB is set but false -> NHA_OIF must be set
  NHA_FDB is not set       -> NHA_OIF must be set

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20250319230743.65267-4-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/nexthop.c