sock: Fix SPDK_ZEROCOPY do not work for IPV6

For IPV6, cm->cmsg_level is SOL_IPV6 and cm->cmsg_type is
IPV6_RECVERR. However these combination was not included.

To clarify the fix check if positive conditions are satisfied and
then reverse the result.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I675f4337f383d3526fed1b86794697f41113ed4c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10428
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-11-25 08:37:21 +09:00 committed by Tomasz Zawadzki
parent 01887ccc30
commit 2c32ca4ceb
2 changed files with 5 additions and 2 deletions

View File

@ -657,7 +657,9 @@ _sock_check_zcopy(struct spdk_sock *sock)
}
cm = CMSG_FIRSTHDR(&msgh);
if (!cm || cm->cmsg_level != SOL_IP || cm->cmsg_type != IP_RECVERR) {
if (!(cm &&
((cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_RECVERR) ||
(cm->cmsg_level == SOL_IPV6 && cm->cmsg_type == IPV6_RECVERR)))) {
SPDK_WARNLOG("Unexpected cmsg level or type!\n");
return 0;
}

View File

@ -842,7 +842,8 @@ _sock_check_zcopy(struct spdk_sock *_sock, int status)
}
cm = CMSG_FIRSTHDR(&sock->recv_task.msg);
if (cm->cmsg_level != SOL_IP || cm->cmsg_type != IP_RECVERR) {
if (!((cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_RECVERR) ||
(cm->cmsg_level == SOL_IPV6 && cm->cmsg_type == IPV6_RECVERR))) {
SPDK_WARNLOG("Unexpected cmsg level or type!\n");
return 0;
}