Commit 43501e65 authored by Mark Andrews's avatar Mark Andrews

1978. [port] Handle systems which have a broken recvmsg().

                        [RT #15742]
parent c2b2bd69
1978. [port] Handle systems which have a broken recvmsg().
[RT #15742]
1977. [bug] Silence noisy log message. [RT #15704]
1976. [bug] Handle systems with no IPv4 addresses. [RT #15695]
......
......@@ -16,7 +16,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.in,v 1.77 2006/01/05 00:30:34 marka Exp $ */
/* $Id: config.h.in,v 1.78 2006/02/02 23:07:53 marka Exp $ */
/*! \file */
......@@ -150,6 +150,10 @@ int sigwait(const unsigned int *set, int *sig);
/* Define if threads need PTHREAD_SCOPE_SYSTEM */
#undef NEED_PTHREAD_SCOPE_SYSTEM
/* Define if recvmsg() does not meet all of the BSD socket API specifications.
*/
#undef BROKEN_RECVMSG
/* Define if you cannot bind() before connect() for TCP sockets. */
#undef BROKEN_TCP_BIND_BEFORE_CONNECT
......
......@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# $Id: configure,v 1.388 2006/01/05 00:30:34 marka Exp $
# $Id: configure,v 1.389 2006/02/02 23:07:53 marka Exp $
#
# Portions Copyright (C) 1996-2001 Nominum, Inc.
#
......@@ -29,7 +29,7 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# From configure.in Revision: 1.400 .
# From configure.in Revision: 1.401 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
......@@ -27278,6 +27278,20 @@ fi
;;
esac
#
# Some hosts need msg_namelen to match the size of the socket stucture.
# Some hosts don't set msg_namelen appropriately on return from recvmsg().
#
case $host in
*os2*|*hp-mpeix*)
cat >>confdefs.h <<\_ACEOF
#define BROKEN_RECVMSG 1
_ACEOF
;;
esac
#
# Microsoft has their own way of handling shared libraries that requires
# additional qualifiers on extern variables. Unix systems don't need it.
......
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.400 $)
AC_REVISION($Revision: 1.401 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.59)
......@@ -1780,6 +1780,17 @@ case "$host" in
;;
esac
#
# Some hosts need msg_namelen to match the size of the socket stucture.
# Some hosts don't set msg_namelen appropriately on return from recvmsg().
#
case $host in
*os2*|*hp-mpeix*)
AC_DEFINE(BROKEN_RECVMSG, 1,
[Define if recvmsg() does not meet all of the BSD socket API specifications.])
;;
esac
#
# Microsoft has their own way of handling shared libraries that requires
# additional qualifiers on extern variables. Unix systems don't need it.
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.261 2005/12/07 04:21:27 explorer Exp $ */
/* $Id: socket.c,v 1.262 2006/02/02 23:06:45 marka Exp $ */
/*! \file */
......@@ -768,8 +768,26 @@ build_msghdr_recv(isc_socket_t *sock, isc_socketevent_t *dev,
if (sock->type == isc_sockettype_udp) {
memset(&dev->address, 0, sizeof(dev->address));
#ifdef BROKEN_RECVMSG
if (sock->pf == AF_INET) {
msg->msg_name = (void *)&dev->address.type.sin;
msg->msg_namelen = sizeof(dev->address.type.sin6);
} else if (sock->pf == AF_INET6) {
msg->msg_name = (void *)&dev->address.type.sin6;
msg->msg_namelen = sizeof(dev->address.type.sin6);
#ifdef ISC_PLATFORM_HAVESYSUNH
} else if (sock->pf == AF_UNIX) {
msg->msg_name = (void *)&dev->address.type.sunix;
msg->msg_namelen = sizeof(dev->address.type.sunix);
#endif
} else {
msg->msg_name = (void *)&dev->address.type.sa;
msg->msg_namelen = sizeof(dev->address.type);
}
#else
msg->msg_name = (void *)&dev->address.type.sa;
msg->msg_namelen = sizeof(dev->address.type);
#endif
#ifdef ISC_NET_RECVOVERFLOW
/* If needed, steal one iovec for overflow detection. */
maxiov--;
......@@ -942,6 +960,10 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
cc = recvmsg(sock->fd, &msghdr, 0);
recv_errno = errno;
#if defined(ISC_SOCKET_DEBUG)
dump_msg(&msghdr);
#endif
if (cc < 0) {
if (SOFT_ERROR(recv_errno))
return (DOIO_SOFT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment