Commit 2c32ca4c authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 01887ccc
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
		}
+2 −1
Original line number Diff line number Diff line
@@ -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;
	}