Added HAVE_IFADDRS_H Disable IPv6 support is ifaddrs.h is not available.

* configure.in: Added HAVE_IFADDRS_H
	* sysdeps/linux/netload.c: (glibtop_get_netload_s): Disable IPv6
	support is ifaddrs.h is not available.

	Closes #149376.
This commit is contained in:
Benoît Dejean
2004-08-09 08:02:54 +00:00
parent bce095739f
commit ab2881a412
3 changed files with 20 additions and 2 deletions

View File

@@ -1,3 +1,11 @@
2004-08-09 Benoît Dejean <tazforever@dlfp.org>
* configure.in: Added HAVE_IFADDRS_H
* sysdeps/linux/netload.c: (glibtop_get_netload_s): Disable IPv6
support is ifaddrs.h is not available.
Closes #149376.
2004-08-09 Benoît Dejean <tazforever@dlfp.org>
* configure.in: Added -gnu89 to CFLAGS.

View File

@@ -148,6 +148,11 @@ else
AC_MSG_ERROR([libgtop requires the popt development libraries])
fi
AC_CHECK_HEADER(ifaddrs.h, [HAVE_IFADDRS_H=yes], [HAVE_IFADDRS_H=no])
if test x$HAVE_IFADDRS_H = xyes ; then
AC_DEFINE(HAVE_IFADDRS_H, 1, [defined if you have ifaddrs.h])
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE

View File

@@ -47,7 +47,9 @@
#include <linux/udp.h>
#endif
/* IPV6 */
#ifdef HAVE_IFADDRS_H
/* needed for IPV6 support */
#include <ifaddrs.h>
@@ -56,7 +58,8 @@
(((((__const uint8_t *) (a))[0] & 0xff) == 0x3f \
|| (((__const uint8_t *) (a))[0] & 0xff) == 0x20))
#endif
/* IPV6 */
#endif /* HAVE_IFADDRS_H */
#define _GLIBTOP_IP_FW_ACCTIN 0x1000 /* Account incoming packets only. */
#define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing packets only. */
@@ -374,6 +377,7 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
fclose (f);
#ifdef HAVE_IFADDRS_H
/* IPv6 */
{
struct ifaddrs *ifa0, *ifr6;
@@ -421,4 +425,5 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
free_ipv6:
freeifaddrs(ifa0);
} /* IPV6 */
#endif /* HAVE_IFADDRS_H */
}