From: James Simmons Date: Tue, 7 Nov 2023 16:30:02 +0000 (-0500) Subject: LU-10391 lnet: hops -1 is valid X-Git-Tag: 2.15.60~114 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F53019%2F2;p=fs%2Flustre-release.git 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 --- 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);