Skip to content

Commit 610f585

Browse files
committed
nexthop: Only parse NHA_OP_FLAGS for dump messages that require it
JIRA: https://issues.redhat.com/browse/RHEL-59118 commit 262a68a Author: Ido Schimmel <idosch@nvidia.com> Date: Mon Mar 11 18:23:05 2024 +0200 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 <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> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
1 parent 4d44bcb commit 610f585

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/ipv4/nexthop.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,11 +3396,6 @@ static int __nh_valid_dump_req(const struct nlmsghdr *nlh, struct nlattr **tb,
33963396
return -EINVAL;
33973397
}
33983398

3399-
if (tb[NHA_OP_FLAGS])
3400-
filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]);
3401-
else
3402-
filter->op_flags = 0;
3403-
34043399
return 0;
34053400
}
34063401

@@ -3416,6 +3411,11 @@ static int nh_valid_dump_req(const struct nlmsghdr *nlh,
34163411
if (err < 0)
34173412
return err;
34183413

3414+
if (tb[NHA_OP_FLAGS])
3415+
filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]);
3416+
else
3417+
filter->op_flags = 0;
3418+
34193419
return __nh_valid_dump_req(nlh, tb, filter, cb->extack);
34203420
}
34213421

0 commit comments

Comments
 (0)