Skip to content

Commit

Permalink
nexthop: Only parse NHA_OP_FLAGS for dump messages that require it
Browse files Browse the repository at this point in the history
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 <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20240311162307.545385-3-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
idosch authored and kuba-moo committed Mar 12, 2024
1 parent dc5e014 commit 262a68a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/ipv4/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
}

Expand Down

0 comments on commit 262a68a

Please sign in to comment.