Commit 83138389 authored by Michael Graff's avatar Michael Graff

Conditionalize setting of struct sockaddr_in6's sin6_scope_id member.

Some machines have it, older ipv6 flavors do not.
parent 99f3a24e
......@@ -56,6 +56,12 @@
/* define if chroot() is available */
#undef HAVE_CHROOT
/* define if struct addrinfo exists */
#undef HAVE_ADDRINFO
/* define is getaddrinfo() exists */
#undef HAVE_GETADDRINFO
/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
#undef SHUTUP_SPUTAUX
#ifdef SHUTUP_SPUTAUX
......
......@@ -67,6 +67,12 @@
/* define if chroot() is available */
#undef HAVE_CHROOT
/* define if struct addrinfo exists */
#undef HAVE_ADDRINFO
/* define is getaddrinfo() exists */
#undef HAVE_GETADDRINFO
/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
#undef SHUTUP_SPUTAUX
#ifdef SHUTUP_SPUTAUX
......@@ -124,9 +130,3 @@ int sigwait(const unsigned int *set, int *sig);
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the addrinfo struct */
#undef HAVE_ADDRINFO
/* Define if you have the getaddrinfo function */
#undef HAVE_GETADDRINFO
......@@ -3570,10 +3570,11 @@ case "$found_ipv6" in
yes)
ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
echo $ac_n "checking for in6addr_any""... $ac_c" 1>&6
echo "configure:3575: checking for in6addr_any" >&5
echo "configure:3576: checking for in6addr_any" >&5
cat > conftest.$ac_ext <<EOF
#line 3577 "configure"
#line 3578 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3584,7 +3585,7 @@ int main() {
struct in6_addr in6; in6 = in6addr_any; return (0);
; return 0; }
EOF
if { (eval echo configure:3588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
......@@ -3598,10 +3599,41 @@ else
LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"
fi
rm -f conftest*
echo $ac_n "checking for sin6_scope_id in struct sockaddr_in6""... $ac_c" 1>&6
echo "configure:3605: checking for sin6_scope_id in struct sockaddr_in6" >&5
cat > conftest.$ac_ext <<EOF
#line 3607 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
$isc_netinetin6_hack
$isc_netinet6in6_hack
int main() {
struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);
; return 0; }
EOF
if { (eval echo configure:3620: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
result="#undef LWRES_HAVE_SIN6_SCOPE_ID"
fi
rm -f conftest*
LWRES_HAVE_SIN6_SCOPE_ID="$result"
echo $ac_n "checking for in6_pktinfo""... $ac_c" 1>&6
echo "configure:3603: checking for in6_pktinfo" >&5
echo "configure:3635: checking for in6_pktinfo" >&5
cat > conftest.$ac_ext <<EOF
#line 3605 "configure"
#line 3637 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3614,7 +3646,7 @@ int main() {
struct in6_pktinfo xyzzy; return (0);
; return 0; }
EOF
if { (eval echo configure:3618: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"
......@@ -3633,6 +3665,7 @@ rm -f conftest*
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
ISC_IPV6_H="ipv6.h"
ISC_IPV6_O="ipv6.$O"
ISC_ISCIPV6_O="unix/ipv6.$O"
......@@ -3660,9 +3693,9 @@ esac
# the files.
#
echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
echo "configure:3664: checking for inet_ntop" >&5
echo "configure:3697: checking for inet_ntop" >&5
cat > conftest.$ac_ext <<EOF
#line 3666 "configure"
#line 3699 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3672,7 +3705,7 @@ int main() {
inet_ntop(0, 0, 0, 0); return (0);
; return 0; }
EOF
if { (eval echo configure:3676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
......@@ -3687,9 +3720,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
echo "configure:3691: checking for inet_pton" >&5
echo "configure:3724: checking for inet_pton" >&5
cat > conftest.$ac_ext <<EOF
#line 3693 "configure"
#line 3726 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3699,7 +3732,7 @@ int main() {
inet_pton(0, 0, 0); return (0);
; return 0; }
EOF
if { (eval echo configure:3703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
......@@ -3714,9 +3747,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
echo "configure:3718: checking for inet_aton" >&5
echo "configure:3751: checking for inet_aton" >&5
cat > conftest.$ac_ext <<EOF
#line 3720 "configure"
#line 3753 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3726,7 +3759,7 @@ int main() {
struct in_addr in; inet_aton(0, &in); return (0);
; return 0; }
EOF
if { (eval echo configure:3730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"
......@@ -3747,12 +3780,12 @@ rm -f conftest*
# Check for some other useful functions that are not ever-present.
echo $ac_n "checking for strsep""... $ac_c" 1>&6
echo "configure:3751: checking for strsep" >&5
echo "configure:3784: checking for strsep" >&5
if eval "test \"`echo '$''{'ac_cv_func_strsep'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3756 "configure"
#line 3789 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strsep(); below. */
......@@ -3775,7 +3808,7 @@ strsep();
; return 0; }
EOF
if { (eval echo configure:3779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strsep=yes"
else
......@@ -3796,12 +3829,12 @@ ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"
fi
echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
echo "configure:3800: checking for vsnprintf" >&5
echo "configure:3833: checking for vsnprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3805 "configure"
#line 3838 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vsnprintf(); below. */
......@@ -3824,7 +3857,7 @@ vsnprintf();
; return 0; }
EOF
if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vsnprintf=yes"
else
......@@ -3853,17 +3886,17 @@ fi
echo $ac_n "checking for sizeof(long long int) == sizeof(long int)""... $ac_c" 1>&6
echo "configure:3857: checking for sizeof(long long int) == sizeof(long int)" >&5
echo "configure:3890: checking for sizeof(long long int) == sizeof(long int)" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""default yes" 1>&6
ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"
else
cat > conftest.$ac_ext <<EOF
#line 3863 "configure"
#line 3896 "configure"
#include "confdefs.h"
main() { exit(!(sizeof(long long int) == sizeof(long int))); }
EOF
if { (eval echo configure:3867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:3900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"
......@@ -3883,12 +3916,12 @@ fi
# Security Stuff
#
echo $ac_n "checking for chroot""... $ac_c" 1>&6
echo "configure:3887: checking for chroot" >&5
echo "configure:3920: checking for chroot" >&5
if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3892 "configure"
#line 3925 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char chroot(); below. */
......@@ -3911,7 +3944,7 @@ chroot();
; return 0; }
EOF
if { (eval echo configure:3915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_chroot=yes"
else
......@@ -3937,17 +3970,17 @@ for ac_hdr in linux/capability.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3941: checking for $ac_hdr" >&5
echo "configure:3974: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3946 "configure"
#line 3979 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3977,17 +4010,17 @@ for ac_hdr in linux/prctl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3981: checking for $ac_hdr" >&5
echo "configure:4014: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3986 "configure"
#line 4019 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4389,6 +4422,7 @@ s%@ISC_IPV6_H@%$ISC_IPV6_H%g
s%@ISC_IPV6_O@%$ISC_IPV6_O%g
s%@ISC_ISCIPV6_O@%$ISC_ISCIPV6_O%g
s%@ISC_IPV6_C@%$ISC_IPV6_C%g
s%@LWRES_HAVE_SIN6_SCOPE_ID@%$LWRES_HAVE_SIN6_SCOPE_ID%g
s%@ISC_PLATFORM_NEEDNTOP@%$ISC_PLATFORM_NEEDNTOP%g
s%@ISC_PLATFORM_NEEDPTON@%$ISC_PLATFORM_NEEDPTON%g
s%@ISC_PLATFORM_NEEDATON@%$ISC_PLATFORM_NEEDATON%g
......
......@@ -13,7 +13,7 @@ dnl PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dnl ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
dnl SOFTWARE.
AC_REVISION($Revision: 1.148 $)
AC_REVISION($Revision: 1.149 $)
AC_PREREQ(2.13)
......@@ -715,6 +715,7 @@ case "$found_ipv6" in
yes)
ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
AC_MSG_CHECKING(for in6addr_any)
AC_TRY_LINK([
#include <sys/types.h>
......@@ -728,6 +729,22 @@ $isc_netinetin6_hack],
[AC_MSG_RESULT(no)
ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
$isc_netinetin6_hack
$isc_netinet6in6_hack
],
[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
[AC_MSG_RESULT(yes)
result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
[AC_MSG_RESULT(no)
result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
LWRES_HAVE_SIN6_SCOPE_ID="$result"
AC_MSG_CHECKING(for in6_pktinfo)
AC_TRY_COMPILE([
#include <sys/types.h>
......@@ -748,6 +765,7 @@ $isc_netinet6in6_hack
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
ISC_IPV6_H="ipv6.h"
ISC_IPV6_O="ipv6.$O"
ISC_ISCIPV6_O="unix/ipv6.$O"
......@@ -768,7 +786,7 @@ AC_SUBST(ISC_IPV6_H)
AC_SUBST(ISC_IPV6_O)
AC_SUBST(ISC_ISCIPV6_O)
AC_SUBST(ISC_IPV6_C)
AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
#
# Check for network functions that are often missing. We do this
# after the libtool checking, so we can put the right suffix on
......
......@@ -3,7 +3,7 @@
* The Berkeley Software Design Inc. software License Agreement specifies
* the terms and conditions for redistribution.
*
* BSDI $Id: getaddrinfo.c,v 1.20 2000/06/15 18:49:53 explorer Exp $
* BSDI $Id: getaddrinfo.c,v 1.21 2000/06/15 21:52:21 explorer Exp $
*/
#include <config.h>
......@@ -217,9 +217,12 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
char nbuf[NI_MAXHOST];
char ntmp[NI_MAXHOST];
int addrsize, addroff;
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
char *p, *ep;
lwres_uint32_t scopeid;
#endif
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
/* scope identifier portion */
ntmp[0] = '\0';
if (strchr(hostname, '%') != NULL) {
......@@ -244,6 +247,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
}
} else
scopeid = 0;
#endif
if (lwres_net_pton(AF_INET, hostname, (struct in_addr *)abuf)) {
if (family == AF_INET6) {
......@@ -283,8 +287,10 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
SIN(ai->ai_addr)->sin_port = port;
memcpy((char *)ai->ai_addr + addroff, abuf, addrsize);
if (flags & AI_CANONNAME) {
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
if (ai->ai_family == AF_INET6)
SIN6(ai->ai_addr)->sin6_scope_id = scopeid;
#endif
if (lwres_getnameinfo(ai->ai_addr,
ai->ai_addrlen, nbuf, sizeof(nbuf),
NULL, 0,
......
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