Skip to content

Commit 262a68a

Browse files
idoschkuba-moo
authored andcommitted
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>
1 parent dc5e014 commit 262a68a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/ipv4/nexthop.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -3398,11 +3398,6 @@ static int __nh_valid_dump_req(const struct nlmsghdr *nlh, struct nlattr **tb,
33983398
return -EINVAL;
33993399
}
34003400

3401-
if (tb[NHA_OP_FLAGS])
3402-
filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]);
3403-
else
3404-
filter->op_flags = 0;
3405-
34063401
return 0;
34073402
}
34083403

@@ -3418,6 +3413,11 @@ static int nh_valid_dump_req(const struct nlmsghdr *nlh,
34183413
if (err < 0)
34193414
return err;
34203415

3416+
if (tb[NHA_OP_FLAGS])
3417+
filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]);
3418+
else
3419+
filter->op_flags = 0;
3420+
34213421
return __nh_valid_dump_req(nlh, tb, filter, cb->extack);
34223422
}
34233423

0 commit comments

Comments
 (0)