2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

First pass at addrlength grossness cleanup. Man, this is ugly.

This commit is contained in:
Michael Graff
1999-02-06 08:48:08 +00:00
parent 14cb69a4f7
commit 491b48ec3f
10 changed files with 129 additions and 87 deletions

View File

@@ -17,6 +17,8 @@ DISTFILES = Makefile.in config.h.in configure.in \
distclean:: FORCE distclean:: FORCE
rm -f config.cache config.h config.log config.status rm -f config.cache config.h config.log config.status
cleandir: distclean
kit: kitclean kit: kitclean
mkdir bind-${VERSION} mkdir bind-${VERSION}
@(cd bind-${VERSION}; for i in ${DISTFILES}; do ln -s ../$$i $$i; done) @(cd bind-${VERSION}; for i in ${DISTFILES}; do ln -s ../$$i $$i; done)

View File

@@ -9,8 +9,3 @@
/* define if you need AF_INET6 */ /* define if you need AF_INET6 */
#undef NEED_AF_INET6 #undef NEED_AF_INET6
/* Probably not the right place... */
#ifdef NEED_AF_INET6
#define AF_INET6 99
#endif

View File

@@ -27,11 +27,6 @@
/* define if you need AF_INET6 */ /* define if you need AF_INET6 */
#undef NEED_AF_INET6 #undef NEED_AF_INET6
/* Probably not the right place... */
#ifdef NEED_AF_INET6
#define AF_INET6 99
#endif
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H

78
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.13 # From configure.in Revision: 1.14
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.12 # Generated automatically using autoconf version 2.12
@@ -1289,8 +1289,13 @@ fi
fi fi
echo $ac_n "checking for socket in -lxnet""... $ac_c" 1>&6
echo "configure:1294: checking for socket in -lxnet" >&5 case "$host" in
mips-sgi-irix*)
;;
*)
echo $ac_n "checking for socket in -lxnet""... $ac_c" 1>&6
echo "configure:1299: checking for socket in -lxnet" >&5
ac_lib_var=`echo xnet'_'socket | sed 'y%./+-%__p_%'` ac_lib_var=`echo xnet'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@@ -1298,7 +1303,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lxnet $LIBS" LIBS="-lxnet $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1302 "configure" #line 1307 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1309,7 +1314,7 @@ int main() {
socket() socket()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@@ -1335,7 +1340,7 @@ EOF
else else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
echo "configure:1339: checking for socket in -lsocket" >&5 echo "configure:1344: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@@ -1343,7 +1348,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS" LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1347 "configure" #line 1352 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1354,7 +1359,7 @@ int main() {
socket() socket()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:1363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@@ -1381,8 +1386,8 @@ else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
fi fi
echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
echo "configure:1386: checking for inet_ntoa in -lnsl" >&5 echo "configure:1391: checking for inet_ntoa in -lnsl" >&5
ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'` ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@@ -1390,7 +1395,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS" LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1394 "configure" #line 1399 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@@ -1401,7 +1406,7 @@ int main() {
inet_ntoa() inet_ntoa()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@@ -1428,17 +1433,19 @@ else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
fi fi
fi fi
;;
esac
echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6 echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
echo "configure:1437: checking for inet_ntop" >&5 echo "configure:1444: checking for inet_ntop" >&5
if eval "test \"`echo '$''{'ac_cv_func_inet_ntop'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_inet_ntop'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1442 "configure" #line 1449 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char inet_ntop(); below. */ which can conflict with char inet_ntop(); below. */
@@ -1461,7 +1468,7 @@ inet_ntop();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:1472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_inet_ntop=yes" eval "ac_cv_func_inet_ntop=yes"
else else
@@ -1488,12 +1495,12 @@ EOF
fi fi
echo $ac_n "checking for inet_pton""... $ac_c" 1>&6 echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
echo "configure:1492: checking for inet_pton" >&5 echo "configure:1499: checking for inet_pton" >&5
if eval "test \"`echo '$''{'ac_cv_func_inet_pton'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_inet_pton'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1497 "configure" #line 1504 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char inet_pton(); below. */ which can conflict with char inet_pton(); below. */
@@ -1516,7 +1523,7 @@ inet_pton();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:1527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_inet_pton=yes" eval "ac_cv_func_inet_pton=yes"
else else
@@ -1543,12 +1550,12 @@ EOF
fi fi
echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
echo "configure:1547: checking for inet_aton" >&5 echo "configure:1554: checking for inet_aton" >&5
if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1552 "configure" #line 1559 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char inet_aton(); below. */ which can conflict with char inet_aton(); below. */
@@ -1571,7 +1578,7 @@ inet_aton();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:1582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_inet_aton=yes" eval "ac_cv_func_inet_aton=yes"
else else
@@ -1599,7 +1606,7 @@ fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:1603: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo "configure:1610: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@@ -1628,7 +1635,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args. # Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2 set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1632: checking for $ac_word" >&5 echo "configure:1639: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@@ -1665,7 +1672,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh. # ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1669: checking for a BSD compatible install" >&5 echo "configure:1676: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@@ -1715,22 +1722,20 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
STD_CINCLUDES=""
STD_CDEFINES=""
STD_CWARNINGS=""
if test "X$GCC" = "Xyes"; then if test "X$GCC" = "Xyes"; then
STD_CINCLUDES= STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes"
STD_CDEFINES=
STD_CWARNINGS="-W -Wall -Wmissing-prototypes"
case "$host" in case "$host" in
*-sun-solaris*) *-sun-solaris*)
LIBS="$LIBS -lthread" LIBS="$LIBS -lthread"
;; ;;
esac esac
else else
STD_CINCLUDES=
STD_CDEFINES=
STD_CWARNINGS=
case "$host" in case "$host" in
*-dec-osf*) *-dec-osf*)
CC="$CC -pthread" CC="$CC -pthread"
@@ -1743,23 +1748,32 @@ else
;; ;;
esac esac
fi fi
case "$host" in case "$host" in
*-dec-osf*)
STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=size_t"
;;
*-sun-solaris*) *-sun-solaris*)
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define NEED_AF_INET6 1 #define NEED_AF_INET6 1
EOF EOF
STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=int"
;; ;;
*-hp-hpux*) *-hp-hpux*)
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define NEED_AF_INET6 1 #define NEED_AF_INET6 1
EOF EOF
STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=int"
;;
*)
STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=int"
;; ;;
esac esac
BIND9_MAKE_RULES=make/rules BIND9_MAKE_RULES=$srcdir/make/rules
BIND9_VERSION=$srcdir/version BIND9_VERSION=$srcdir/version

View File

@@ -1,5 +1,5 @@
AC_REVISION($Revision: 1.14 $) AC_REVISION($Revision: 1.15 $)
AC_INIT(lib/dns/name.c) AC_INIT(lib/dns/name.c)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
@@ -45,10 +45,22 @@ AC_CHECK_LIB(pthread, pthread_create,,
AC_CHECK_LIB(pthread, __pthread_create) AC_CHECK_LIB(pthread, __pthread_create)
AC_CHECK_LIB(pthread, __pthread_create_system) AC_CHECK_LIB(pthread, __pthread_create_system)
) )
AC_CHECK_LIB(xnet, socket,,
AC_CHECK_LIB(socket, socket) dnl
AC_CHECK_LIB(nsl, inet_ntoa) dnl The wonderful thing about standards is there are so many to choose from...
) dnl
dnl Under IRIX (6.5 at least) -lxnet buys us nothign but compiler warnings.
dnl
case "$host" in
mips-sgi-irix*)
;;
*)
AC_CHECK_LIB(xnet, socket, ,
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, inet_ntoa)
)
;;
esac
AC_CHECK_FUNC(inet_ntop, , AC_CHECK_FUNC(inet_ntop, ,
[ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.o" [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.o"
@@ -70,22 +82,20 @@ AC_PROG_MAKE_SET
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_INSTALL AC_PROG_INSTALL
STD_CINCLUDES=""
STD_CDEFINES=""
STD_CWARNINGS=""
AC_SUBST(STD_CINCLUDES) AC_SUBST(STD_CINCLUDES)
AC_SUBST(STD_CDEFINES) AC_SUBST(STD_CDEFINES)
AC_SUBST(STD_CWARNINGS) AC_SUBST(STD_CWARNINGS)
if test "X$GCC" = "Xyes"; then if test "X$GCC" = "Xyes"; then
STD_CINCLUDES= STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes"
STD_CDEFINES=
STD_CWARNINGS="-W -Wall -Wmissing-prototypes"
case "$host" in case "$host" in
*-sun-solaris*) *-sun-solaris*)
LIBS="$LIBS -lthread" LIBS="$LIBS -lthread"
;; ;;
esac esac
else else
STD_CINCLUDES=
STD_CDEFINES=
STD_CWARNINGS=
case "$host" in case "$host" in
*-dec-osf*) *-dec-osf*)
CC="$CC -pthread" CC="$CC -pthread"
@@ -98,6 +108,10 @@ else
;; ;;
esac esac
fi fi
dnl
dnl Networking specifics.
dnl
case "$host" in case "$host" in
*-sun-solaris*) *-sun-solaris*)
AC_DEFINE(NEED_AF_INET6) AC_DEFINE(NEED_AF_INET6)
@@ -108,7 +122,7 @@ case "$host" in
esac esac
AC_SUBST_FILE(BIND9_MAKE_RULES) AC_SUBST_FILE(BIND9_MAKE_RULES)
BIND9_MAKE_RULES=make/rules BIND9_MAKE_RULES=$srcdir/make/rules
AC_SUBST_FILE(BIND9_VERSION) AC_SUBST_FILE(BIND9_VERSION)
BIND9_VERSION=$srcdir/version BIND9_VERSION=$srcdir/version

View File

@@ -27,15 +27,18 @@
* controlled tree. * controlled tree.
*/ */
#ifdef NEED_AF_INET6
#define AF_INET6 99
#endif
#ifdef NEED_INET_NTOP #ifdef NEED_INET_NTOP
char *isc_inet_ntop(int af, const void *src, char *dst, size_t size); const char *isc_inet_ntop(int af, const void *src, char *dst, size_t size);
#else #else
#define isc_inet_ntop inet_ntop #define isc_inet_ntop inet_ntop
#endif #endif
#ifdef NEED_INET_PTON #ifdef NEED_INET_PTON
int int isc_inet_pton(int af, const char *src, void *dst);
isc_inet_pton(int af, const char *src, void *dst);
#else #else
#define isc_inet_pton inet_pton #define isc_inet_pton inet_pton
#endif #endif

View File

@@ -70,9 +70,11 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
static char rcsid[] = "$Id: inet_aton.c,v 1.2 1999/02/06 01:51:36 halley Exp $"; static char rcsid[] = "$Id: inet_aton.c,v 1.3 1999/02/06 08:48:07 explorer Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@@ -82,6 +84,7 @@ static char rcsid[] = "$Id: inet_aton.c,v 1.2 1999/02/06 01:51:36 halley Exp $";
#include <ctype.h> #include <ctype.h>
#include <isc/types.h> #include <isc/types.h>
#include <isc/inet.h>
/* /*
* Check whether "cp" is a valid ascii representation * Check whether "cp" is a valid ascii representation

View File

@@ -16,9 +16,11 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/01/30 04:27:48 explorer Exp $"; static char rcsid[] = "$Id: inet_ntop.c,v 1.3 1999/02/06 08:48:07 explorer Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <config.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -28,9 +30,12 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/01/30 04:27:48 explorer Exp $
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <isc/inet.h>
#define NS_INT16SZ 2 #define NS_INT16SZ 2
#define NS_IN6ADDRSZ 16 #define NS_IN6ADDRSZ 16
@@ -39,9 +44,9 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/01/30 04:27:48 explorer Exp $
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/ */
static const char *isc_inet_ntop4(const u_char *src, char *dst, size_t size); static const char *isc_inet_ntop4(const unsigned char *src, char *dst, size_t size);
#ifdef AF_INET6 #ifdef AF_INET6
static const char *isc_inet_ntop6(const u_char *src, char *dst, size_t size); static const char *isc_inet_ntop6(const unsigned char *src, char *dst, size_t size);
#endif #endif
/* char * /* char *
@@ -76,12 +81,12 @@ isc_inet_ntop(int af, const void *src, char *dst, size_t size)
* `dst' (as a const) * `dst' (as a const)
* notes: * notes:
* (1) uses no statics * (1) uses no statics
* (2) takes a u_char* not an in_addr as input * (2) takes a unsigned char* not an in_addr as input
* author: * author:
* Paul Vixie, 1996. * Paul Vixie, 1996.
*/ */
static const char * static const char *
isc_inet_ntop4(const u_char *src, char *dst, size_t size) isc_inet_ntop4(const unsigned char *src, char *dst, size_t size)
{ {
static const char *fmt = "%u.%u.%u.%u"; static const char *fmt = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"]; char tmp[sizeof "255.255.255.255"];
@@ -103,7 +108,7 @@ isc_inet_ntop4(const u_char *src, char *dst, size_t size)
*/ */
#ifdef AF_INET6 #ifdef AF_INET6
static const char * static const char *
isc_inet_ntop6(const u_char *src, char *dst, size_t size) isc_inet_ntop6(const unsigned char *src, char *dst, size_t size)
{ {
/* /*
* Note that int32_t and int16_t need only be "at least" large enough * Note that int32_t and int16_t need only be "at least" large enough
@@ -114,7 +119,7 @@ isc_inet_ntop6(const u_char *src, char *dst, size_t size)
*/ */
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur; struct { int base, len; } best, cur;
u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
int i; int i;
/* /*

View File

@@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/02/02 00:37:09 halley Exp $"; static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/02/06 08:48:07 explorer Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <config.h> #include <config.h>
@@ -25,11 +25,15 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/02/02 00:37:09 halley Exp $";
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <isc/inet.h>
#define NS_INT16SZ 2 #define NS_INT16SZ 2
#define NS_INADDRSZ 4 #define NS_INADDRSZ 4
#define NS_IN6ADDRSZ 16 #define NS_IN6ADDRSZ 16
@@ -39,8 +43,8 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/02/02 00:37:09 halley Exp $";
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/ */
static int inet_pton4(const char *src, u_char *dst); static int inet_pton4(const char *src, unsigned char *dst);
static int inet_pton6(const char *src, u_char *dst); static int inet_pton6(const char *src, unsigned char *dst);
/* int /* int
* isc_inet_pton(af, src, dst) * isc_inet_pton(af, src, dst)
@@ -84,11 +88,11 @@ isc_inet_pton(af, src, dst)
static int static int
inet_pton4(src, dst) inet_pton4(src, dst)
const char *src; const char *src;
u_char *dst; unsigned char *dst;
{ {
static const char digits[] = "0123456789"; static const char digits[] = "0123456789";
int saw_digit, octets, ch; int saw_digit, octets, ch;
u_char tmp[NS_INADDRSZ], *tp; unsigned char tmp[NS_INADDRSZ], *tp;
saw_digit = 0; saw_digit = 0;
octets = 0; octets = 0;
@@ -97,7 +101,7 @@ inet_pton4(src, dst)
const char *pch; const char *pch;
if ((pch = strchr(digits, ch)) != NULL) { if ((pch = strchr(digits, ch)) != NULL) {
u_int new = *tp * 10 + (pch - digits); unsigned int new = *tp * 10 + (pch - digits);
if (new > 255) if (new > 255)
return (0); return (0);
@@ -137,14 +141,14 @@ inet_pton4(src, dst)
static int static int
inet_pton6(src, dst) inet_pton6(src, dst)
const char *src; const char *src;
u_char *dst; unsigned char *dst;
{ {
static const char xdigits_l[] = "0123456789abcdef", static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF"; xdigits_u[] = "0123456789ABCDEF";
u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok; const char *xdigits, *curtok;
int ch, saw_xdigit; int ch, saw_xdigit;
u_int val; unsigned int val;
memset((tp = tmp), '\0', NS_IN6ADDRSZ); memset((tp = tmp), '\0', NS_IN6ADDRSZ);
endp = tp + NS_IN6ADDRSZ; endp = tp + NS_IN6ADDRSZ;
@@ -179,8 +183,8 @@ inet_pton6(src, dst)
} }
if (tp + NS_INT16SZ > endp) if (tp + NS_INT16SZ > endp)
return (0); return (0);
*tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (u_char) val & 0xff; *tp++ = (unsigned char) val & 0xff;
saw_xdigit = 0; saw_xdigit = 0;
val = 0; val = 0;
continue; continue;
@@ -196,8 +200,8 @@ inet_pton6(src, dst)
if (saw_xdigit) { if (saw_xdigit) {
if (tp + NS_INT16SZ > endp) if (tp + NS_INT16SZ > endp)
return (0); return (0);
*tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (u_char) val & 0xff; *tp++ = (unsigned char) val & 0xff;
} }
if (colonp != NULL) { if (colonp != NULL) {
/* /*

View File

@@ -36,6 +36,9 @@
#include "util.h" #include "util.h"
/* temp hack! XXX */
#define ISC_SOCKADDR_LEN_T int
#ifndef _WIN32 #ifndef _WIN32
#define WINAPI /* we're not windows */ #define WINAPI /* we're not windows */
#endif #endif
@@ -718,7 +721,7 @@ internal_accept(isc_task_t *task, isc_event_t *ev)
isc_socket_newconnev_t *dev; isc_socket_newconnev_t *dev;
ncintev_t *iev; ncintev_t *iev;
struct sockaddr addr; struct sockaddr addr;
u_int addrlen; ISC_SOCKADDR_LEN_T addrlen;
int fd; int fd;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@@ -841,7 +844,7 @@ internal_recv(isc_task_t *task, isc_event_t *ev)
int cc; int cc;
size_t read_count; size_t read_count;
struct sockaddr addr; struct sockaddr addr;
u_int addrlen; ISC_SOCKADDR_LEN_T addrlen;
/* /*
* Find out what socket this is and lock it. * Find out what socket this is and lock it.
@@ -1634,11 +1637,14 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region,
*/ */
if (EMPTY(sock->recv_list)) { if (EMPTY(sock->recv_list)) {
if (sock->type == isc_socket_udp) { if (sock->type == isc_socket_udp) {
ISC_SOCKADDR_LEN_T addrlen;
ev->addrlength = sizeof(isc_sockaddr_t); ev->addrlength = sizeof(isc_sockaddr_t);
addrlen = (ISC_SOCKADDR_LEN_T)ev->addrlength;
cc = recvfrom(sock->fd, ev->region.base, cc = recvfrom(sock->fd, ev->region.base,
ev->region.length, 0, ev->region.length, 0,
(struct sockaddr *)&ev->address, (struct sockaddr *)&ev->address,
&ev->addrlength); &addrlen);
ev->addrlength = (unsigned int)addrlen;
} else { } else {
cc = recv(sock->fd, ev->region.base, cc = recv(sock->fd, ev->region.base,
ev->region.length, 0); ev->region.length, 0);
@@ -1734,13 +1740,14 @@ isc_socket_send(isc_socket_t *sock, isc_region_t *region,
isc_result_t isc_result_t
isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
isc_task_t *task, isc_taskaction_t action, void *arg, isc_task_t *task, isc_taskaction_t action, void *arg,
isc_sockaddr_t *address, unsigned int addrlength) isc_sockaddr_t *address, unsigned int addrlen)
{ {
isc_socketevent_t *ev; isc_socketevent_t *ev;
rwintev_t *iev; rwintev_t *iev;
isc_socketmgr_t *manager; isc_socketmgr_t *manager;
isc_task_t *ntask = NULL; isc_task_t *ntask = NULL;
int cc; int cc;
ISC_SOCKADDR_LEN_T addrlength = (ISC_SOCKADDR_LEN_T)addrlen;
REQUIRE(VALID_SOCKET(sock)); REQUIRE(VALID_SOCKET(sock));
@@ -2188,7 +2195,7 @@ internal_connect(isc_task_t *task, isc_event_t *ev)
isc_socket_connev_t *dev; isc_socket_connev_t *dev;
cnintev_t *iev; cnintev_t *iev;
int cc; int cc;
int optlen; ISC_SOCKADDR_LEN_T optlen;
sock = ev->sender; sock = ev->sender;
iev = (cnintev_t *)ev; iev = (cnintev_t *)ev;
@@ -2302,7 +2309,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp,
int *lengthp) int *lengthp)
{ {
isc_sockaddr_t addr; isc_sockaddr_t addr;
int len; ISC_SOCKADDR_LEN_T len;
REQUIRE(VALID_SOCKET(sock)); REQUIRE(VALID_SOCKET(sock));
REQUIRE(addressp != NULL); REQUIRE(addressp != NULL);
@@ -2318,13 +2325,13 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp,
return (ISC_R_UNEXPECTED); return (ISC_R_UNEXPECTED);
} }
if (*lengthp < sock->addrlength) { if ((unsigned int)*lengthp < (unsigned int)len) {
UNLOCK(&sock->lock); UNLOCK(&sock->lock);
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
} }
memcpy(addressp, &sock->address, (size_t)sock->addrlength); memcpy(addressp, &sock->address, (size_t)len);
*lengthp = sock->addrlength; *lengthp = (unsigned int)len;
UNLOCK(&sock->lock); UNLOCK(&sock->lock);