From: Ido Schimmel Date: Mon, 11 Mar 2024 16:23:05 +0000 (+0200) Subject: nexthop: Only parse NHA_OP_FLAGS for dump messages that require it X-Git-Tag: microblaze-v6.10~161^2~1^2~2 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=262a68aa46f88d9b42f1569f893d53f71ddf7e52;p=linux-2.6-microblaze.git nexthop: Only parse NHA_OP_FLAGS for dump messages that require it The attribute is parsed in __nh_valid_dump_req() which is called by the dump handlers of RTM_GETNEXTHOP and RTM_GETNEXTHOPBUCKET although it is only used by the former and rejected by the policy of the latter. Move the parsing to nh_valid_dump_req() which is only called by the dump handler of RTM_GETNEXTHOP. This is a preparation for a subsequent patch. Signed-off-by: Ido Schimmel Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20240311162307.545385-3-idosch@nvidia.com Signed-off-by: Jakub Kicinski --- diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 6901fa390651..d1669000ac1c 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -3398,11 +3398,6 @@ static int __nh_valid_dump_req(const struct nlmsghdr *nlh, struct nlattr **tb, return -EINVAL; } - if (tb[NHA_OP_FLAGS]) - filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]); - else - filter->op_flags = 0; - return 0; } @@ -3418,6 +3413,11 @@ static int nh_valid_dump_req(const struct nlmsghdr *nlh, if (err < 0) return err; + if (tb[NHA_OP_FLAGS]) + filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]); + else + filter->op_flags = 0; + return __nh_valid_dump_req(nlh, tb, filter, cb->extack); }