From c75b6fe3f147206ee3fd10fb0ee55a06245c0a4f Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 7 Nov 2023 11:30:02 -0500 Subject: [PATCH] LU-10391 lnet: hops -1 is valid For route setup a hops value of -1 is valid. We were assuming userland would never send a -1 which is wrong. Test-Parameters: trivial testlist=sanity-lnet Fixes: 6557cd4b8c8 ("LU-10391 lnet: migrate router management to Netlink") Change-Id: I616334fccfe3aba6409f1a856c62cf02d07782a9 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53019 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- lnet/lnet/api-ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 4bc70c6..18159a3 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -7413,7 +7413,7 @@ static int lnet_route_cmd(struct sk_buff *skb, struct genl_info *info) } hops = nla_get_s64(route_prop); - if (hops < 1 || hops > 255) { + if ((hops < 1 || hops > 255) && hops != -1) { GENL_SET_ERR_MSG(info, "invalid hop count must be between 1 and 255"); GOTO(report_err, rc = -EINVAL); -- 1.8.3.1