Linux: Do not initialize msghdr's msg_iter/msg_iov

Since the initial Linux commit (2.6.12-rc2) the Linux function
kernel_recvmsg() handles the initialization of the msghdr members
related to the iov (msghdr.msg_iter and for earlier kernels
msghdr.msg_iov and msghdr.msg_iovlen).

The code in osi_NetReceive for Linux unnecessarily initializes these
structure members prior to calling kernel_recvmsg().

Remove the unnecessary code from osi_NetReceive along with the
surrounding preprocessor check for STRUCT_MSGHDR_HAS_MSG_ITER.  Since
this is the only location that uses this define, also remove the
associated autoconf test.

NOTE: This was discovered while investigating changes needed for
Linux 6.4, due to: "iov_iter: add iter_iovec() helper" (de4f5fed3f)
which renamed the Linux structure iter_iovec's member iov to __iov.
Since the openafs code that was affected by the Linux 6.4 change is
being removed as unnecessary, this commit is not Linux 6.4 specific,
but effects all versions of Linux.

Reviewed-on: https://gerrit.openafs.org/15408
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 5a7630acfd8bfd462b633475a6e195d9dbdfb451)

Change-Id: I3a803f76ab84f1e055e91cf4f2be96440f141746
Reviewed-on: https://gerrit.openafs.org/15410
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Cheyenne Wills 2023-04-25 10:37:01 -06:00 committed by Stephan Wiesand
parent 0967702c3f
commit 12ce31ce1d
2 changed files with 0 additions and 8 deletions

View File

@ -33,7 +33,6 @@ AC_CHECK_LINUX_STRUCT([key], [payload.value], [key.h])
AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h])
AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h])
AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])
AC_CHECK_LINUX_STRUCT([msghdr], [msg_iter], [socket.h])
AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
AC_CHECK_LINUX_STRUCT([proc_ops], [proc_compat_ioctl], [proc_fs.h])

View File

@ -202,13 +202,6 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *from, struct iovec *iov,
memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec));
msg.msg_name = from;
#if defined(STRUCT_MSGHDR_HAS_MSG_ITER)
msg.msg_iter.iov = tmpvec;
msg.msg_iter.nr_segs = iovcnt;
#else
msg.msg_iov = tmpvec;
msg.msg_iovlen = iovcnt;
#endif
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;