Commit b7f317e0 authored by Kirk Webb's avatar Kirk Webb

Committing healthd-0.6.5+linux code to testbed CVS. This is comprised of the

original healthd-0.6.5 codebase plus my linux port and a 'push' mode for
central, unsolicited reporting.  The code for the healthd collection daemon
is kept elsewhere in the 'hmcd' subdirectory under 'sensors'.  Also included
is a 'quiet' switch (-q) for healthd (no syslog entries for sensor conditions).
parent c884cd89
$Id: CHANGELOG,v 1.1 2001-12-05 18:45:06 kwebb Exp $
March 14, 2001: Add a -B option to use Vbat for Vcore1
with W83782D style chips (Abit BP6). Submitted by:
Trev Roydhouse <trev@sentry.org>
Janurary 5, 2001: Changes to allow healthdc to compile on
version without IPv6 support.
October 10, 2000: Thanks to Archie Cobbs <archie@whistle.com>
For submitting a patch for the Winbond W83627HF
October 3, 2000: IANA has assigned me an official port of 1281.
That is different for 9669 that was used origionally.
-P 9669 can be used to specify the old port number.
September 29, 2000: Thanks to Claus Assmann <ca+healthd@esmtp.org>
for another patch to allow ISA mode to work on OpenBSD.
September 14, 2000:
Change the printing of daemon error from stderr to using
syslog.
Only enable the reading of the doWarn and doFail settings
and the contents of the *_warn and *_fail scripts if
compiled with -DFULL_CONFIG or ./configure --enable-full-config.
This is because I beleive that the information might provide
information that might be useful in exploiting the machine.
September 13, 2000:
Protocol 2.0. Enables obtaining version and configuration
information from the running daemon.
September 11, 2000:
IPv6 support added to healthd and healthdc. IPv6
support also works for libwrap.
August 20, 2000: Thanks to Claus Assmann <ca+healthd@esmtp.org>
for a patch to allow ISA mode to work on OpenBSD.
Thanks to Stefan Moeding <s.moeding@ndh.net> for the
origional version of the code to allow external programs
to be run on warnings and failures. It has since then
been greatly extended.
June 5, 2000: If there was no config file in the default locatiion
healthd was exiting before -f could read a specified config
file. (thanks: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>)
April 26, 2000: Changed ReadConfigFile() & ParseOption() to not display
unknown options, instead display the line number. This prevents
the user from using healthd to display files the user doesn't have
permission to read. (thanks: Volker Stolz
<stolz@Pool.Informatik.RWTH-Aachen.DE>)
April 9, 2000: Added -c option (thanks: David McNett <nugget@distributed.net>)
March 25, 2000: Fix root exploit (thanks: Valentin Nechayev
<netch@@segfault.kiev.au>)
January 20, 2000: Added -1 and -2 for the Winbond 83781 and 83782
chips respectively (Adrian Murphy)
November 15, 1999: Added healthd.8 man file.
November 7, 1999: Added -f to override default config file.
October 29, 1999: Initial Release 0.1
1. Make sure VERSION.h has the correct version.
2. Make sure comment in healthd.8 & healthdc.8 have
the correct versions.
3. Make sure README & CHANGELOG are upto date.
/*-
* Copyright (c) 1999-2000 James E. Housley <jim@thehousleys.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: COPYRIGHT,v 1.1 2001-12-05 18:45:06 kwebb Exp $
*/
######################################################
#-
# Copyright (c) 1999-2000 James E. Housley <jim@thehousleys.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: Makefile.in,v 1.1 2001-12-05 18:45:06 kwebb Exp $
#
######################################################
#
# Source for healthd Makefile
#
# Just in case
prefix?=/usr/local
INSTALL?=@INSTALL@
INSTALL_PROGRAM?=@INSTALL_PROGRAM@
INSTALL_DATA?=@INSTALL_DATA@
DEFS=@DEFS@ -DCONFIG_FILE="\"@exec_prefix@/etc/healthd.conf\""
INCLUDES=
CC?=gcc
CPPFLAGS+=-I. @CPPFLAGS@
CFLAGS+= -Wall $(INCLUDES) $(DEFS) $(CPPFLAGS)
LDFLAGS=-s
LIBS=@LIBS@
LIBOBJS=@LIBOBJS@
GMBIOBJS=@GMBIOBJS@
RM=rm -f
.c.o:
$(CC) -c $(CFLAGS) $<
PROGRAM = healthd
all: $(PROGRAM) $(PROGRAM)c
healthd: healthd.c $(GMBIOBJS) parameters.h methods.h healthd.h VERSION.h optionTable.h
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ healthd.c $(GMBIOBJS) $(LIBS)
healthdc: healthdc.c VERSION.h @LIBOBJS@
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ healthdc.c $(LIBS) @LIBOBJS@
buildOT: buildOT.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ buildOT.c
optionTable.h: buildOT
./buildOT > optionTable.h
getaddrinfo.o: missing/getaddrinfo.c
getnameinfo.o: missing/getnameinfo.c
clean:
$(RM) *.o *.BAK *.CKP a.out *.core errs *~ $(PROGRAM) $(PROGRAM)c buildOT
real-clean: clean
$(RM) config.log config.status config.h config.cache \
Makefile optionTable.h
install-all: install install-doc
install: $(PROGRAM) $(PROGRAM)c
$(INSTALL_PROGRAM) -m 0755 -p healthd @exec_prefix@/sbin
$(INSTALL_PROGRAM) -m 0755 -p healthdc @exec_prefix@/bin
$(INSTALL_DATA) -m 644 -p healthd.conf.sample @exec_prefix@/etc
install-doc:
$(INSTALL) -c -m 444 healthd.8 @exec_prefix@/man/man8
$(INSTALL) -c -m 444 healthdc.8 @exec_prefix@/man/man8
#!/usr/bin/perl -w
#
######################################################
#-
# Copyright (c) 1999-2000 James E. Housley <jim@thehousleys.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: NotePage.pl,v 1.1 2001-12-05 18:45:06 kwebb Exp $
#
######################################################
use Socket;
$destination = "www.notepage.com";
$message = $ARGV[1];
$message =~ s/[ \n\r]/+/g;
$url = "FRM=healthd\&USER=$ARGV[0]&MSG=$message";
$length = length($url);
$string = "POST /cgi-bin/webgate.exe HTTP/1.0\nContent-type: application/x-www-form-urlencoded\nContent-length: $length\n\n$url\n\n";
$iaddr = gethostbyname($destination);
$paddr = sockaddr_in("80", $iaddr);
$proto = getprotobyname("tcp");
socket(DestSock, PF_INET, SOCK_STREAM, $proto);
connect(DestSock, $paddr);
send (DestSock, $string, 0);
close DestSock;
/*-
* Copyright (c) 1999-2000 James E. Housley <jim@thehousleys.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: PROTOCOL,v 1.1 2001-12-05 18:45:06 kwebb Exp $
*/
Version 1.0 - Origional
Command:
GET T[1-3] : Get Temperature 1, 2 or 3
GET S[1-3] : Get Fan Speed 1, 2 or 3
GET V[1-7] : Get Voltage 1, 2, 3, 4, 5, 6 or 7
Result:
A null terminated ASCII string of the value.
Command:
GTV T[1-3] : Verbose get Temperature 1, 2 or 3
GTV S[1-3] : Verbose get Fan Speed 1, 2 or 3
GTV V[1-7] : Verbose get Voltage 1, 2, 3, 4, 5, 6 or 7
Result:
A null terminated string with 5 values seperated by the '|'
character. First is a the value. Second is active, 1=active.
Third is the number of out-of-bounds readings. Forth is 1 if
a failure has been logged. Fifth is 1 if a warning has been
logged.
Unknown commands return "ERROR: Unsupported command"
Version 2.0
All of Version 1.0 plus the following.
Command:
END : Close the connectioin.
Result:
The string "Closing connection" is send and then healthd closes
the connection.
Command:
VER P : Get the protocol Version.
Result:
A null terminated ASCII string with both major and minor values.
Or an error.
Command:
VER d : Get the healthd Version.
Result:
A null terminated ASCII string with both major and minor values.
Or an error.
Command:
CFG - Get the values from the configuration file.
T[0-2] - for temperature
F[0-2] - for fan speed
V[0-6] - for voltage
ACT - for if active [yes/no]
LBL - the text description [string]
MIN - minimum value [integer/float]
MAX - maximum value [integer/float]
DOW - for doWarn [yes/no]
DOF - for doFail [yes/no]
TWarn - temperature warning command
TFail - temperature fail command
FWarn - fan warning command
FFail - fan fail command
VWarn - voltage warning command
VFail - voltage fail command
Therefore "CFG T1_ACT" returns whether Temp1 is active
And "CFG V0_DOF" returns whether Volt0 will act on failures
And "CFG FFail" returns the command executed on fan failure
Result:
Depends upon the command.
NOTE: DOW and DOF parameters not enable by default because they provide
information that might be exploitable.
NOTE: TWarn, TFail, FWarn, FFail, VWarn and VFail parameters are not
enabled by default because the provide information that might be
exploitable.
$Id: README,v 1.1 2001-12-05 18:45:06 kwebb Exp $
*_doWarn and *_doFail:
Be careful using these. Before setting these to "yes" run
the program for a while and make sure the values returned are
what is expected. If either do a "shutdown now" and you have
got it wrong, a reboot will shut off very quickly. This can be
solved by booting into single-user mode and editing the files,
but that is not fun.
PORT NUMBERS:
I started using port number 9669, because it looked nice, for
communications between healthdc and healthd. IANA has assigned
port 1281 to healthd. Starting with version 0.6.1 that will
be the port used, the can be changed with the -P <port> option.
Remotely reading healthd.conf:
Because remotely reading the scripts that are executed on failure might
reveal information that is exploitable, it is not enabled by default. To
enable reading these values remotely add --enable-full-config to the
invocation of configure.
./configure --enable-full-config
$Id: THANKS,v 1.1 2001-12-05 18:45:06 kwebb Exp $
Thanks to Archie Cobbs <archie@whistle.com>
For submitting a patch for the Winbond W83627HF
Thanks to Claus Assmann <ca+healthd@esmtp.org>
For work to allow this to compile on OpenBSD
Thanks to Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
For visually identifing the unknown ASUS "health" chip.
Thanks to Dmitry Kohmanyuk äÍÉÔÒÉÊ ëÏÈÍÁÎÀË <dk@farm.org>
For suggesting the -t option.
Thanks to David McNett <nugget@distributed.net>
For supplying patches for the -c option.
Thanks to Adrian Murphy (amurphy@gsoft.com.au)
For pointing out the the Winbond 83781D and 83782D chips have
very different negative voltage equations.
Thanks to Trev Roydhouse <trev@sentry.org>
For tracking down that the Abit BP6 M/B uses Vbat on
the W83782D chip for Vcore1
/*-
* Copyright (c) 1999-2000 James E. Housley <jim@thehousleys.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: VERSION.h,v 1.1 2001-12-05 18:45:07 kwebb Exp $
*/
#define hdVERSION "0.6.4"
#define hdPROTO "2.0"
This diff is collapsed.
This diff is collapsed.
/*
* Does the OS support SMB
*/
#undef HAVE_SMBUS
/*
* Is libwrap available
*/
#undef HAVE_LIBWRAP
/*
* Is getaddrinfo() avaliable
*/
#undef HAVE_GETADDRINFO
/*
* Is getnameinfo() avaliable
*/
#undef HAVE_GETNAMEINFO
This diff is collapsed.
This diff is collapsed.
dnl Process this file with autoconf to produce a configure script.
AC_INIT(healthd.c)
AC_CONFIG_HEADER(config.h)
dnl System type
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
dnl Checks for libraries.
AC_CHECK_LIB(wrap, hosts_access)
AC_CHECK_LIB(io, inb)
AC_CHECK_LIB(i386, i386_iopl)
dnl Architecture specific stuff.
case "$host" in
*linux*)
AC_CHECK_LIB(sensors, sensors_init, [
AC_DEFINE(HAVE_LIBSENSORS)
LIBS="$LIBS -lsensors"
],
AC_MSG_ERROR([libsensors required under linux])
)
GMBIOBJS="getMBinfo-linux.o"
;;
*bsd*)
GMBIOBJS="getMBinfo-bsd.o getMB-smb.o getMB-isa.o"
;;
*)
AC_MSG_ERROR([Don't know how to compile under $host])
;;
esac
AC_SUBST(GMBIOBJS)
AC_MSG_CHECKING([whether to enable remotely reading the full config])
AC_ARG_ENABLE(full_config,
[ --enable-full-config Enable remotely reading the full config
--disable-full-config Enable remotely reading the full config],
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
full_config=no
;;
*) AC_MSG_RESULT(yes)
AC_DEFINE(FULL_CONFIG)
full_config=yes
;;
esac ],
[ case "$enableval" in
*) AC_MSG_RESULT(no)
full_config=no
;;
esac ])
if test "$full_config" = "yes"; then
CPPFLAGS="-DFULL_CONFIG $CPPFLAGS"
fi
dnl
dnl This section to check for IPv6 was copied from
dnl raccoon-20000719a from www.kame.net
dnl ---- start ----
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable ipv6 (with ipv4) support
--disable-ipv6 Disable ipv6 support],
[ case "$enableval" in
yes)
AC_MSG_RESULT(yes)
AC_DEFINE(INET6)
ipv6=yes
;;
*)
AC_MSG_RESULT(no)
ipv6=no
;;
esac ],
AC_TRY_RUN([ /* AF_INET6 avalable check */
#include <sys/types.h>
#include <sys/socket.h>
main()
{
exit(0);
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
exit(1);
else
exit(0);
}
],
AC_MSG_RESULT(yes)
AC_DEFINE(ENABLE_IPV6)
ipv6=yes,
AC_MSG_RESULT(no)
ipv6=no,
AC_MSG_RESULT(no)
ipv6=no
))
ipv6type=unknown
ipv6lib=none
ipv6libdir=none
if test "$ipv6" = "yes"; then
AC_MSG_CHECKING([ipv6 stack type])
for i in inria kame linux toshiba v6d zeta; do
ipv6trylibc=no
case $i in
inria)
dnl http://www.kame.net/
AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef IPV6_INRIA_VERSION
yes
#endif],
[ipv6type=$i;
ipv6lib=inet6;
ipv6libdir=/usr/lib;
ipv6trylibc=yes
CPPFLAGS="-DINET6 $CPPFLAGS"])
;;
kame)
dnl http://www.kame.net/
AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef __KAME__
yes
#endif],
[ipv6type=$i;
ipv6lib=inet6;
ipv6libdir=/usr/local/v6/lib;
ipv6trylibc=yes
CPPFLAGS="-DINET6 $CPPFLAGS"])
;;
linux)
dnl http://www.v6.linux.or.jp/
if test -d /usr/inet6; then
ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/inet6/lib
CPPFLAGS="-DINET6 -I/usr/inet6/include $CPPFLAGS"
fi
;;
toshiba)
AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _TOSHIBA_INET6
yes
#endif],
[ipv6type=$i;
ipv6lib=inet6;
ipv6libdir=/usr/local/v6/lib;
CPPFLAGS="-DINET6 $CPPFLAGS"])
;;
v6d)
AC_EGREP_CPP(yes, [dnl
#include </usr/local/v6/include/sys/v6config.h>
#ifdef __V6D__
yes
#endif],
[ipv6type=$i;
ipv6lib=v6;
ipv6libdir=/usr/local/v6/lib;
CPPFLAGS="-I/usr/local/v6/include $CPPFLAGS"])
;;
zeta)
AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _ZETA_MINAMI_INET6
yes
#endif],
[ipv6type=$i;
ipv6lib=inet6;
ipv6libdir=/usr/local/v6/lib;
CPPFLAGS="-DINET6 $CPPFLAGS"])
;;
esac
if test "$ipv6type" != "unknown"; then
break
fi
done
AC_MSG_RESULT($ipv6type)
fi
if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
echo "using lib$ipv6lib for getaddrinfo"
LIBS="$LIBS -L$ipv6libdir -l$ipv6lib"
else
if test "$ipv6trylibc" = "yes"; then
echo 'using libc for getaddrinfo'
else
echo "Fatal: no $ipv6lib library found. "
echo "cannot continue. You need to fetch lib$ipv6lib.a "
echo "from appropriate ipv6 kit and compile beforehand."
exit 1
fi
fi
fi
if test "$ipv6" = "yes"; then
AC_MSG_CHECKING(for advanced API support)
AC_CACHE_VAL(racoon_cv_advapi, [dnl
AC_TRY_COMPILE([#ifndef INET6
#define INET6
#endif
#include <sys/types.h>
#include <netinet/in.h>],
[struct in6_pktinfo a;],
[racoon_cv_advapi="yes"], [racoon_cv_advapi="no"])])
AC_MSG_RESULT($racoon_cv_advapi)
if test "$racoon_cv_advapi" = yes; then
AC_DEFINE(ADVAPI)
fi
fi
AC_MSG_CHECKING(getaddrinfo bug)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <netinet/in.h>
main()
{
int passive, gaierr, inet4 = 0, inet6 = 0;
struct addrinfo hints, *ai, *aitop;
char straddr[INET6_ADDRSTRLEN], strport[16];
for (passive = 0; passive <= 1; passive++) {
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_flags = passive ? AI_PASSIVE : 0;
hints.ai_socktype = SOCK_STREAM;
if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
(void)gai_strerror(gaierr);
goto bad;
}
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_addr == NULL ||
ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
straddr, sizeof(straddr), strport, sizeof(strport),
NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
goto bad;
}
switch (ai->ai_family) {
case AF_INET:
if (strcmp(strport, "54321") != 0) {
goto bad;
}
if (passive) {
if (strcmp(straddr, "0.0.0.0") != 0) {
goto bad;
}
} else {
if (strcmp(straddr, "127.0.0.1") != 0) {
goto bad;
}
}
inet4++;
break;
case AF_INET6:
if (strcmp(strport, "54321") != 0) {
goto bad;
}
if (passive) {
if (strcmp(straddr, "::") != 0) {
goto bad;
}
} else {
if (strcmp(straddr, "::1") != 0) {
goto bad;
}
}
inet6++;
break;
case AF_UNSPEC:
goto bad;
break;
default:
/* another family support? */
break;
}
}
}
if (!(inet4 == 0 || inet4 == 2))
goto bad;
if (!(inet6 == 0 || inet6 == 2))
goto bad;
if (aitop)
freeaddrinfo(aitop);