2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Always assume BSD4.4 msghdr version

This commit is contained in:
Ondřej Surý
2018-08-21 14:26:39 +02:00
parent 388d6db5a1
commit e6dc08b06c
5 changed files with 2 additions and 201 deletions

152
configure vendored
View File

@@ -739,15 +739,9 @@ ISC_IRS_GETNAMEINFOSOCKLEN
ISC_IRS_NEEDADDRINFO
ISC_PLATFORM_HAVETFO
ISC_PLATFORM_NEEDPORTT
ISC_PLATFORM_MSGHDRFLAVOR
ISC_PLATFORM_HAVESALEN
ISC_EXTRA_SRCS
ISC_EXTRA_OBJS
ISC_PLATFORM_NEEDPTON
ISC_PLATFORM_NEEDNTOP
ISC_PLATFORM_HAVEIF_LADDRCONF
ISC_PLATFORM_HAVEIF_LADDRREQ
ISC_PLATFORM_HAVESOCKADDRSTORAGE
BIND9_CO_RULE
LIBTOOL_ALLOW_UNDEFINED
LIBTOOL_MODE_UNINSTALL
@@ -17844,6 +17838,7 @@ main ()
struct sockaddr_in6 sin6;
struct in6_addr in6;
struct in6_pktinfo in6_pi;
struct sockaddr_storage storage;
in6 = in6addr_any;
in6 = in6addr_loopback;
sin6.sin6_scope_id = 0;
@@ -17864,35 +17859,6 @@ See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5
$as_echo_n "checking for struct sockaddr_storage... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/socket.h>
int
main ()
{
struct sockaddr_storage storage; return (0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5
$as_echo_n "checking for struct if_laddrreq... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -17951,92 +17917,6 @@ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
#
# Check for network functions that are often missing. We do this
# after the libtool checking, so we can put the right suffix on
# the files. It also needs to come after checking for a Kame add-on,
# which provides some (all?) of the desired functions.
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntop with IPv6 support" >&5
$as_echo_n "checking for inet_ntop with IPv6 support... " >&6; }
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming inet_ntop not needed" >&5
$as_echo "assuming inet_ntop not needed" >&6; }
ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
main() {
char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
# addresses with less than four octets, like "1.2.3". Also leading
# zeros should also be rejected.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working inet_pton with IPv6 support" >&5
$as_echo_n "checking for working inet_pton with IPv6 support... " >&6; }
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming inet_pton needed" >&5
$as_echo "assuming inet_pton needed" >&6; }
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 :
(inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sa_len in struct sockaddr" >&5
$as_echo_n "checking for sa_len in struct sockaddr... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -18064,36 +17944,6 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#
# Look for a 4.4BSD or 4.3BSD struct msghdr
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct msghdr flavor" >&5
$as_echo_n "checking for struct msghdr flavor... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/socket.h>
int
main ()
{
struct msghdr msg; msg.msg_flags = 0; return (0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 4.4BSD" >&5
$as_echo "4.4BSD" >&6; }
ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 4.3BSD" >&5
$as_echo "4.3BSD" >&6; }
ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#
# Look for in_port_t.
#

View File

@@ -1988,20 +1988,6 @@ AC_TRY_COMPILE([
ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"])
AC_SUBST(ISC_PLATFORM_HAVESALEN)
#
# Look for a 4.4BSD or 4.3BSD struct msghdr
#
AC_MSG_CHECKING(for struct msghdr flavor)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>],
[struct msghdr msg; msg.msg_flags = 0; return (0);],
[AC_MSG_RESULT(4.4BSD)
ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
[AC_MSG_RESULT(4.3BSD)
ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
#
# Look for in_port_t.
#

View File

@@ -58,11 +58,6 @@
*/
@ISC_PLATFORM_HAVEIF_LADDRREQ@
/*! \brief
* Define either ISC_PLATFORM_BSD44MSGHDR or ISC_PLATFORM_BSD43MSGHDR.
*/
@ISC_PLATFORM_MSGHDRFLAVOR@
/*! \brief
* Define if the system supports if_nametoindex.
*/

View File

@@ -364,8 +364,7 @@ isc_net_probe_ipv6pktinfo(void) {
return (ipv6pktinfo_result);
}
#if ISC_CMSG_IP_TOS || \
defined(ISC_NET_BSD44MSGHDR) && defined(IPV6_TCLASS)
#if ISC_CMSG_IP_TOS || defined(IPV6_TCLASS)
static inline ISC_SOCKADDR_LEN_T
cmsg_len(ISC_SOCKADDR_LEN_T len) {
@@ -411,7 +410,6 @@ cmsg_space(ISC_SOCKADDR_LEN_T len) {
#endif
}
#ifdef ISC_NET_BSD44MSGHDR
/*
* Make a fd non-blocking.
*/
@@ -574,7 +572,6 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) {
return (true);
}
#endif
#endif
static void
try_dscp_v4(void) {
@@ -624,15 +621,11 @@ try_dscp_v4(void) {
dscp_result |= ISC_NET_DSCPRECVV4;
#endif /* IP_RECVTOS */
#ifdef ISC_NET_BSD44MSGHDR
#if ISC_CMSG_IP_TOS
if (cmsgsend(s, IPPROTO_IP, IP_TOS, res0))
dscp_result |= ISC_NET_DSCPPKTV4;
#endif /* ISC_CMSG_IP_TOS */
#endif /* ISC_NET_BSD44MSGHDR */
freeaddrinfo(res0);
close(s);
@@ -685,10 +678,8 @@ try_dscp_v6(void) {
dscp_result |= ISC_NET_DSCPRECVV6;
#endif /* IPV6_RECVTCLASS */
#ifdef ISC_NET_BSD44MSGHDR
if (cmsgsend(s, IPPROTO_IPV6, IPV6_TCLASS, res0))
dscp_result |= ISC_NET_DSCPPKTV6;
#endif /* ISC_NET_BSD44MSGHDR */
freeaddrinfo(res0);
close(s);

View File

@@ -1244,14 +1244,12 @@ cmsg_space(ISC_SOCKADDR_LEN_T len) {
*/
static void
process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
#ifdef ISC_NET_BSD44MSGHDR
#ifdef USE_CMSG
struct cmsghdr *cmsgp;
struct in6_pktinfo *pktinfop;
#ifdef SO_TIMESTAMP
void *timevalp;
#endif
#endif
#endif
/*
@@ -1264,8 +1262,6 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
UNUSED(msg);
UNUSED(dev);
#ifdef ISC_NET_BSD44MSGHDR
#ifdef MSG_TRUNC
if ((msg->msg_flags & MSG_TRUNC) == MSG_TRUNC)
dev->attributes |= ISC_SOCKEVENTATTR_TRUNC;
@@ -1350,8 +1346,6 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
cmsgp = CMSG_NXTHDR(msg, cmsgp);
}
#endif /* USE_CMSG */
#endif /* ISC_NET_BSD44MSGHDR */
}
/*
@@ -1375,9 +1369,7 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev,
isc_region_t used;
size_t write_count;
size_t skip_count;
#ifdef ISC_NET_BSD44MSGHDR
struct cmsghdr *cmsgp;
#endif
memset(msg, 0, sizeof(*msg));
@@ -1439,8 +1431,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev,
config:
msg->msg_iov = iov;
msg->msg_iovlen = iovcount;
#ifdef ISC_NET_BSD44MSGHDR
msg->msg_control = NULL;
msg->msg_controllen = 0;
msg->msg_flags = 0;
@@ -1572,10 +1562,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev,
}
#endif
#endif /* USE_CMSG */
#else /* ISC_NET_BSD44MSGHDR */
msg->msg_accrights = NULL;
msg->msg_accrightslen = 0;
#endif /* ISC_NET_BSD44MSGHDR */
if (write_countp != NULL)
*write_countp = write_count;
@@ -1690,7 +1676,6 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev,
msg->msg_iov = iov;
msg->msg_iovlen = iovcount;
#ifdef ISC_NET_BSD44MSGHDR
#if defined(USE_CMSG)
msg->msg_control = cmsgbuf;
msg->msg_controllen = RECVCMSGBUFLEN;
@@ -1699,10 +1684,6 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev,
msg->msg_controllen = 0;
#endif /* USE_CMSG */
msg->msg_flags = 0;
#else /* ISC_NET_BSD44MSGHDR */
msg->msg_accrights = NULL;
msg->msg_accrightslen = 0;
#endif /* ISC_NET_BSD44MSGHDR */
if (read_countp != NULL)
*read_countp = read_count;
@@ -1774,10 +1755,8 @@ dump_msg(struct msghdr *msg) {
printf("\t\t%u\tbase %p, len %ld\n", i,
msg->msg_iov[i].iov_base,
(long) msg->msg_iov[i].iov_len);
#ifdef ISC_NET_BSD44MSGHDR
printf("\tcontrol %p, controllen %ld\n", msg->msg_control,
(long) msg->msg_controllen);
#endif
}
#endif