Skip to content

Commit 758101e

Browse files
guyharrisinfrastation
authored andcommitted
configure: check for gethostbyaddr(), not gethostbyname().
We use gethostbyaddr() to translate IP addresses in packets to names; we don't use gethostbyname() to translate names to IP addresses (libpcap does the latter when compiling filters, so we leave that up to it, and nothing's left for us to do). This probably has the same effect as checking for gethostbyname(), but it makes it a bit clearer why we'd check for it. (cherry picked from commit b1ccc20)
1 parent 0bdde63 commit 758101e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

aclocal.m4

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,11 +1045,11 @@ dnl
10451045
dnl AC_LBL_LIBRARY_NET
10461046
dnl
10471047
dnl This test is for network applications that need socket() and
1048-
dnl gethostbyname() -ish functions. Under Solaris, those applications
1048+
dnl gethostbyaddr() -ish functions. Under Solaris, those applications
10491049
dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
10501050
dnl with "-lnsl" but should *not* link with "-lsocket" because
10511051
dnl libsocket.a breaks a number of things (for instance:
1052-
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
1052+
dnl gethostbyaddr() under IRIX 5.2, and snoop sockets under most
10531053
dnl versions of IRIX).
10541054
dnl
10551055
dnl Unfortunately, many application developers are not aware of this,
@@ -1077,16 +1077,16 @@ dnl statically and happen to have a libresolv.a lying around (and no
10771077
dnl libnsl.a).
10781078
dnl
10791079
AC_DEFUN(AC_LBL_LIBRARY_NET, [
1080-
# Most operating systems have gethostbyname() in the default searched
1080+
# Most operating systems have gethostbyaddr() in the default searched
10811081
# libraries (i.e. libc):
10821082
# Some OSes (eg. Solaris) place it in libnsl
10831083
# Some strange OSes (SINIX) have it in libsocket:
1084-
AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)
1084+
AC_SEARCH_LIBS(gethostbyaddr, nsl socket resolv)
10851085
# Unfortunately libsocket sometimes depends on libnsl and
10861086
# AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.
1087-
if test "$ac_cv_search_gethostbyname" = "no"
1087+
if test "$ac_cv_search_gethostbyaddr" = "no"
10881088
then
1089-
AC_CHECK_LIB(socket, gethostbyname,
1089+
AC_CHECK_LIB(socket, gethostbyaddr,
10901090
LIBS="-lsocket -lnsl $LIBS", , -lnsl)
10911091
fi
10921092
AC_SEARCH_LIBS(socket, socket, ,

0 commit comments

Comments
 (0)