octo@leeloo:~/collectd $ svn merge -r773:777 branches/collectd-3.9 trunk
authorocto <octo>
Thu, 1 Jun 2006 20:53:20 +0000 (20:53 +0000)
committerocto <octo>
Thu, 1 Jun 2006 20:53:20 +0000 (20:53 +0000)
1  2 
ChangeLog
collectd.spec
configure.in
debian/changelog
src/liboping/liboping.c

diff --combined ChangeLog
+++ b/ChangeLog
@@@ -1,18 -1,15 +1,25 @@@
 +      * The `disk' plugin has been ported to Darwin.
 +      * The `battery' plugin should work on many Apple computers now.
 +      * The `traffic' plugin can now ignore certain interfaces. Also,
 +        statistics for sent/received packets and errors have been added.
 +
+ 2006-06-01, Version 3.9.3
+       * Fixed the ping-plugin under FreeBSD and Mac OS X. Potentially other
+         operating systems also profit from the changes, but I wasn't able to
+         check that.
+       * Changed the build system to find the netinet-includes under FreeBSD
+         and therefore successfully build the `liboping' library there.
  2006-05-09, Version 3.9.2
        * Applied a patch to the `liboping' library. Due to a bug in the
          sequence checking the `ping' plugin stopped working after
          approximately 7.6 days.
  
 +2006-05-09, Version 3.8.5
 +      * Applied a patch to the `liboping' library. Due to a bug in the
 +        sequence checking the `ping' plugin stopped working after
 +        approximately 7.6 days.
 +
  2006-04-21, Version 3.9.1
        * Build issues with Solaris and possible other architectures have been
          resolved.
@@@ -20,7 -17,7 +27,7 @@@
          been resolved.
        * A bug in the `ping' plugin has been fixed. Sorry folks.
  
 -2006-04-15, Version 3.9.0
 +2006-04-02, Version 3.9.0
        * A plugin to monitor the Apache webserver has been added.
          <http://httpd.apache.org/>
        * A plugin to collect statistics about virtual servers using VServer.
diff --combined collectd.spec
@@@ -1,6 -1,6 +1,6 @@@
  Summary:      Statistics collection daemon for filling RRD files.
  Name:           collectd
- Version:      3.9.0
+ Version:      3.9.3
  Release:      1
  Source:               http://collectd.org/files/%{name}-%{version}.tar.gz
  License:      GPL
@@@ -101,12 -101,12 +101,15 @@@ rm -rf $RPM_BUILD_ROO
  %attr(0444,root,root) %{_libdir}/%{name}/sensors.so*
  
  %changelog
+ * Tue Jun 01 2006 Florian octo Forster <octo@verplant.org> 3.9.3-1
+ - New upstream version
  * Tue May 09 2006 Florian octo Forster <octo@verplant.org> 3.9.2-1
  - New upstream version
  
 +* Tue May 09 2006 Florian octo Forster <octo@verplant.org> 3.8.5-1
 +- New upstream version
 +
  * Fri Apr 21 2006 Florian octo Forster <octo@verplant.org> 3.9.1-1
  - New upstream version
  
diff --combined configure.in
@@@ -1,5 -1,5 +1,5 @@@
  dnl Process this file with autoconf to produce a configure script.
- AC_INIT(collectd, 3.9.2)
+ AC_INIT(collectd, 3.9.3)
  AC_CONFIG_SRCDIR(src/collectd.c)
  AC_CONFIG_HEADERS(src/config.h)
  AM_INIT_AUTOMAKE(dist-bzip2)
@@@ -54,11 -54,17 +54,17 @@@ AC_CHECK_HEADERS(netinet/in_systm.h, []
  [#if HAVE_STDINT_H
  # include <stdint.h>
  #endif
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
  ])
  AC_CHECK_HEADERS(netinet/in.h, [], [],
  [#if HAVE_STDINT_H
  # include <stdint.h>
  #endif
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
  #if HAVE_NETINET_IN_SYSTM_H
  # include <netinet/in_systm.h>
  #endif
@@@ -67,6 -73,9 +73,9 @@@ AC_CHECK_HEADERS(netinet/ip.h, [], []
  [#if HAVE_STDINT_H
  # include <stdint.h>
  #endif
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
  #if HAVE_NETINET_IN_SYSTM_H
  # include <netinet/in_systm.h>
  #endif
@@@ -78,6 -87,9 +87,9 @@@ AC_CHECK_HEADERS(netinet/ip_icmp.h, []
  [#if HAVE_STDINT_H
  # include <stdint.h>
  #endif
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
  #if HAVE_NETINET_IN_SYSTM_H
  # include <netinet/in_systm.h>
  #endif
@@@ -92,6 -104,9 +104,9 @@@ AC_CHECK_HEADERS(netinet/ip_var.h, [], 
  [#if HAVE_STDINT_H
  # include <stdint.h>
  #endif
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
  #if HAVE_NETINET_IN_SYSTM_H
  # include <netinet/in_systm.h>
  #endif
@@@ -174,10 -189,6 +189,10 @@@ AC_CHECK_HEADERS(IOKit/ps/IOPowerSource
  ])
  AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
  
 +# For the `disk' plugin
 +AC_CHECK_HEADERS(IOKit/IOBSD.h)
 +AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
 +
  # For load module
  AC_CHECK_HEADERS(sys/loadavg.h)
  
@@@ -373,7 -384,7 +388,7 @@@ if test "x$fu_cv_getmntent2" = "xyes"; 
  fi
  
  # Check for structures
 -AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_obytes],
 +AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
        [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
        [],
        [
        #include <sys/socket.h>
        #include <net/if.h>
        ])
 -AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_bytes],
 +AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
        [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
        [],
        [
@@@ -587,9 -598,6 +602,9 @@@ AC_CHECK_LIB(IOKit, IOServiceGetMatchin
  AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
  AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
  
 +with_libstatgrab="yes"
 +with_libdevstat="no"
 +with_libkvm="no"
  AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
  [
        if test "x$withval" != "xno" -a "x$withval" != "xyes"
  ])
  if test "x$with_libstatgrab" = "xyes"
  then
 -      AC_CHECK_LIB(devstat, getdevs)
 -      AC_CHECK_LIB(kvm, kvm_getargv)
 -      AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (libstatgrab not found)"])
 +      AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
  fi
  if test "x$with_libstatgrab" = "xyes"
  then
  fi
  if test "x$with_libstatgrab" = "xyes"
  then
 +      AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
 +      AC_CHECK_LIB(kvm, kvm_getargv, [with_libkvm="yes"],     [with_libkvm="no"])
 +fi
 +if test "x$with_libstatgrab" = "xyes"
 +then
        collect_libstatgrab=1
  else
        collect_libstatgrab=0
@@@ -629,8 -634,6 +644,8 @@@ f
  AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
        [Wether or not to use statgrab library])
  AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
 +AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT,  test "x$with_libdevstat"  = "xyes")
 +AM_CONDITIONAL(BUILD_WITH_LIBKVM,      test "x$with_libkvm"      = "xyes")
  
  AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
  [
@@@ -815,12 -818,10 +830,12 @@@ m4_divert_once([HELP_ENABLE], 
  collectd features:])
  AC_COLLECTD([debug],     [enable],  [feature], [debugging])
  AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
 +AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
  
  m4_divert_once([HELP_ENABLE], [
  collectd modules:])
  AC_COLLECTD([apache],    [disable], [module], [Apache httpd statistics])
 +AC_COLLECTD([apcups],    [disable], [module], [Statistics of UPSes by APC])
  AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
  AC_COLLECTD([battery],   [disable], [module], [battery statistics])
  AC_COLLECTD([cpu],       [disable], [module], [cpu usage statistics])
@@@ -844,6 -845,222 +859,6 @@@ AC_COLLECTD([users],     [disable], [mo
  AC_COLLECTD([vserver],   [disable], [module], [vserver statistics])
  AC_COLLECTD([wireless],  [disable], [module], [wireless link statistics])
  
 -#m4_divert_once([HELP_ENABLE], [
 -#collectd modules:])
 -#AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
 -#if test "x$enable_cpu" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
 -#     then
 -#             enable_cpu="yes"
 -#     else
 -#             enable_cpu="no"
 -#     fi
 -#fi
 -#if test "x$enable_cpu" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
 -
 -#AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
 -#if test "x$enable_cpufreq" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux"
 -#     then
 -#             enable_cpufreq="yes"
 -#     else
 -#             enable_cpufreq="no"
 -#     fi
 -#fi
 -#if test "x$enable_cpufreq" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
 -
 -#AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
 -#if test "x$enable_disk" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
 -#     then
 -#             enable_disk="yes"
 -#     else
 -#             enable_disk="no"
 -#     fi
 -#fi
 -#if test "x$enable_disk" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
 -
 -#AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
 -#if test "x$enable_hddtemp" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
 -
 -#AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
 -#if test "x$enable_load" != "xno"
 -#then
 -#     if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
 -#     then
 -#             enable_load="yes"
 -#     else
 -#             enable_load="no"
 -#     fi
 -#fi
 -#if test "x$enable_load" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
 -
 -#AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
 -#if test "x$enable_memory" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
 -#     then
 -#             enable_memory="yes"
 -#     else
 -#             enable_memory="no"
 -#     fi
 -#fi
 -#if test "x$enable_memory" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
 -
 -#AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
 -#if test "x$enable_nfs" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux"
 -#     then
 -#             enable_nfs="yes"
 -#     else
 -#             enable_nfs="no"
 -#     fi
 -#fi
 -#if test "x$enable_nfs" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
 -
 -#AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
 -#if test "x$enable_ping" != "xno"
 -#then
 -#     enable_ping="yes"
 -#fi
 -#if test "x$enable_ping" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
 -
 -#AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
 -#if test "x$enable_processes" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux" 
 -#     then
 -#             enable_processes="yes"
 -#     else
 -#             enable_processes="no"
 -#     fi
 -#fi
 -#if test "x$enable_processes" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
 -
 -##AC_COLLECTD([quota],     [enable],  [module], [quota statistics (experimental)])
 -
 -#AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
 -#if test "x$enable_sensors" != "xno"
 -#then
 -#     if test "x$with_lm_sensors" = "xyes"
 -#     then
 -#             enable_sensors="yes"
 -#     else
 -#             enable_sensors="no"
 -#     fi
 -#fi
 -#if test "x$enable_sensors" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
 -
 -#AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
 -#if test "x$enable_serial" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux"
 -#     then
 -#             enable_serial="yes"
 -#     else
 -#             enable_serial="no"
 -#     fi
 -#fi
 -#if test "x$enable_serial" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
 -
 -#AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
 -#if test "x$enable_swap" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
 -#     then
 -#             enable_swap="yes"
 -#     else
 -#             enable_swap="no"
 -#     fi
 -#fi
 -#if test "x$enable_swap" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
 -
 -#AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
 -#if test "x$enable_tape" != "xno"
 -#then
 -#     if test "x$with_kstat" = "xyes"
 -#     then
 -#             enable_tape="yes"
 -#     else
 -#             enable_tape="no"
 -#     fi
 -#fi
 -#if test "x$enable_tape" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
 -
 -#AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
 -#if test "x$enable_traffic" != "xno"
 -#then
 -#     if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
 -#     then
 -#             enable_traffic="yes"
 -#     else
 -#             enable_traffic="no"
 -#     fi
 -#fi
 -#if test "x$enable_traffic" = "xno"
 -#then
 -#     AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
 -#fi
 -#AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
 -
 -#AC_COLLECTD([users],     [disable], [module], [user count statistics])
 -
  AC_OUTPUT(Makefile src/libconfig/Makefile src/liboping/Makefile src/Makefile)
  
  cat <<EOF;
@@@ -866,7 -1083,6 +881,7 @@@ Configuration
  
    Modules:
      apache  . . . . . . $enable_apache
 +    apcups  . . . . . . $enable_apcups
      apple_sensors . . . $enable_apple_sensors
      battery . . . . . . $enable_battery
      cpu . . . . . . . . $enable_cpu
diff --combined debian/changelog
@@@ -1,15 -1,15 +1,21 @@@
+ collectd (3.9.3) unstable; urgency=low
+   * New upstream version 
+  -- Florian Forster <octo@leeloo.home.verplant.org>  Thu,  1 Jun 2006 22:41:55 +0200
  collectd (3.9.2-1) unstable; urgency=low
  
    * New upstream version
  
   -- Florian Forster <octo@verplant.org>  Tue,  9 May 2006 11:12:00 +0200
  
 +collectd (3.8.5-1) unstable; urgency=low
 +
 +  * New upstream version
 +
 + -- Florian Forster <octo@verplant.org>  Tue,  9 May 2006 10:56:00 +0200
 +
  collectd (3.9.1-1) unstable; urgency=low
  
    * New upstream version
diff --combined src/liboping/liboping.c
  # define dprintf(...) /**/
  #endif
  
 +#define PING_ERRMSG_LEN 256
 +
  #define PING_DATA "Florian Forster <octo@verplant.org> http://verplant.org/"
  
 +struct pinghost
 +{
 +      char                    *hostname;
 +      struct sockaddr_storage *addr;
 +      socklen_t                addrlen;
 +      int                      addrfamily;
 +      int                      fd;
 +      int                      ident;
 +      int                      sequence;
 +      struct timeval          *timer;
 +      double                   latency;
 +
 +      struct pinghost         *next;
 +};
 +
 +struct pingobj
 +{
 +      double      timeout;
 +      int         ttl;
 +      int         addrfamily;
 +
 +      char        errmsg[PING_ERRMSG_LEN];
 +
 +      pinghost_t *head;
 +};
 +
  /*
   * private (static) functions
   */
 +static void ping_set_error (pingobj_t *obj, const char *function,
 +              const char *message)
 +{
 +      snprintf (obj->errmsg, PING_ERRMSG_LEN, "%s: %s", function, message);
 +      obj->errmsg[PING_ERRMSG_LEN - 1] = '\0';
 +}
 +
  static int ping_timeval_add (struct timeval *tv1, struct timeval *tv2,
                struct timeval *res)
  {
@@@ -423,10 -388,7 +423,10 @@@ static int ping_receive_all (pingobj_t 
                ptr->latency = -1.0;
  
        if (gettimeofday (&nowtime, NULL) == -1)
 +      {
 +              ping_set_error (obj, "gettimeofday", strerror (errno));
                return (-1);
 +      }
  
        /* Set up timeout */
        timeout.tv_sec = (time_t) obj->timeout;
                        break;
  
                if (gettimeofday (&nowtime, NULL) == -1)
 +              {
 +                      ping_set_error (obj, "gettimeofday", strerror (errno));
                        return (-1);
 +              }
  
                if (ping_timeval_sub (&endtime, &nowtime, &timeout) == -1)
                        break;
                status = select (max_readfds + 1, &readfds, NULL, NULL, &timeout);
  
                if (gettimeofday (&nowtime, NULL) == -1)
 +              {
 +                      ping_set_error (obj, "gettimeofday", strerror (errno));
                        return (-1);
 +              }
                
                if ((status == -1) && (errno == EINTR))
                {
   * +-> ping_send_one_ipv4                                                    *
   * `-> ping_send_one_ipv6                                                    *
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 -ssize_t ping_sendto (pinghost_t *ph, const void *buf, size_t buflen)
 +static ssize_t ping_sendto (pinghost_t *ph, const void *buf, size_t buflen)
  {
        ssize_t ret;
  
@@@ -758,11 -714,6 +758,11 @@@ static void ping_free (pinghost_t *ph
  /*
   * public methods
   */
 +const char *ping_get_error (pingobj_t *obj)
 +{
 +      return (obj->errmsg);
 +}
 +
  pingobj_t *ping_construct (void)
  {
        pingobj_t *obj;
@@@ -900,7 -851,6 +900,7 @@@ int ping_host_add (pingobj_t *obj, cons
        if ((ph->hostname = strdup (host)) == NULL)
        {
                dprintf ("Out of memory!\n");
 +              ping_set_error (obj, "strdup", strerror (errno));
                ping_free (ph);
                return (-1);
        }
        if ((ai_return = getaddrinfo (host, NULL, &ai_hints, &ai_list)) != 0)
        {
                dprintf ("getaddrinfo failed\n");
 +              ping_set_error (obj, "getaddrinfo",
 +                              (ai_return == EAI_SYSTEM)
 +                              ? strerror (errno)
 +                              : gai_strerror (ai_return));
                ping_free (ph);
                return (-1);
        }
  
 +      if (ai_list == NULL)
 +              ping_set_error (obj, "getaddrinfo", "No hosts returned");
 +
        for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
        {
                ph->fd = -1;
                        si->sin_port   = htons (ph->ident);
                        si->sin_addr.s_addr = htonl (INADDR_ANY);
  
 +                      ai_ptr->ai_socktype = SOCK_RAW;
                        ai_ptr->ai_protocol = IPPROTO_ICMP;
                }
                else if (ai_ptr->ai_family == AF_INET6)
                        si->sin6_port   = htons (ph->ident);
                        si->sin6_addr   = in6addr_any;
  
 +                      ai_ptr->ai_socktype = SOCK_RAW;
                        ai_ptr->ai_protocol = IPPROTO_ICMPV6;
                }
                else
                {
 -                      dprintf ("Unknown `ai_family': %i\n", ai_ptr->ai_family);
 +                      char errmsg[PING_ERRMSG_LEN];
 +
 +                      snprintf (errmsg, PING_ERRMSG_LEN, "Unknown `ai_family': %i", ai_ptr->ai_family);
 +                      errmsg[PING_ERRMSG_LEN - 1] = '\0';
 +
 +                      dprintf (errmsg);
 +                      ping_set_error (obj, "getaddrinfo", errmsg);
                        continue;
                }
  
                if (ph->fd == -1)
                {
                        dprintf ("socket: %s\n", strerror (errno));
 +                      ping_set_error (obj, "socket", strerror (errno));
                        continue;
                }
  
+ #if 0
                if (bind (ph->fd, (struct sockaddr *) &sockaddr, sockaddr_len) == -1)
                {
                        dprintf ("bind: %s\n", strerror (errno));
 +                      ping_set_error (obj, "bind", strerror (errno));
                        close (ph->fd);
                        ph->fd = -1;
                        continue;
                }
+ #endif
  
                assert (sizeof (struct sockaddr_storage) >= ai_ptr->ai_addrlen);
                memset (ph->addr, '\0', sizeof (struct sockaddr_storage));
@@@ -1022,10 -957,7 +1024,10 @@@ int ping_host_remove (pingobj_t *obj, c
        }
  
        if (cur == NULL)
 +      {
 +              ping_set_error (obj, "ping_host_remove", "Host not found");
                return (-1);
 +      }
  
        if (pre == NULL)
                obj->head = cur->next;