Commit 3ffddbee authored by Markus Koschany's avatar Markus Koschany

Imported Upstream version 1.0~pre4

parent c56389dd
Change log for iftop
$Id: ChangeLog,v 1.41 2014/01/01 15:49:53 pdw Exp $
$Id: ChangeLog,v 1.42 2014/01/19 20:32:50 pdw Exp $
Attributions apply to all preceding items up to the next blank line.
Unattributed items are by Paul Warren and Chris Lightfoot.
......@@ -14,6 +14,8 @@ Unattributed items are by Paul Warren and Chris Lightfoot.
Andreas Schwab <schwab@linux-m68k.org>
* Minor fixes to the man page
* Man page documentation of -t mode.
* Compile time warning fixes.
Markus Koschany <apo@gambaru.de>
* Added text output mode (-t option)
......@@ -67,6 +69,9 @@ Unattributed items are by Paul Warren and Chris Lightfoot.
* Avoid an assertion failure if an "invalid" (as in outside of IPv4 or IPv6)
address family is encountered (Red Hat bugs #839750, #847124, #868065, #961236
and #1007434)
* enable building iftop with more recent versions of autoconf/automake
* patch to remove compile time warnings
* Fix to avoid system call in text mode wherever possible.
Robert Scheck <robert@fedoraproject.org>
* Attempt to detect if interface is actually up when doing autodetection.
......
Installation instructions for iftop
$Id: INSTALL,v 1.3 2002/11/04 12:54:16 chris Exp $
$Id: INSTALL,v 1.4 2014/01/19 20:11:39 pdw Exp $
iftop is now autoconf/automake-enabled. You should be able to build it on
......@@ -11,13 +11,3 @@ such systems, you may want to use the --with-resolver=ares configure option to
build a version of iftop which uses the ARES asynchronous DNS library for name
resolution. An alternative is to use --with-resolver=netdb_1thread, which will
make iftop run only one name resolution thread. This is not recommended.
On some systems (notably Red Hat Linux) the libpcap header files are installed
under /usr/include/pcap; on these systems, you should manually specify this
when running configure, like this:
$ CPPFLAGS=-I/usr/include/pcap ./configure
For historical interest, the old iftop makefile is included in Makefile.OLD.
#
# Makefile:
# Makefile for iftop.
#
# $Id: Makefile.OLD,v 1.2 2007/03/03 16:01:45 pdw Exp $
#
VERSION = 0.11pre1
# C compiler to use.
#CC = gcc
# Give the location of pcap.h here:
CFLAGS += -I/usr/include/pcap -g
# CFLAGS += -I/usr/pkg/include
# CFLAGS += -pg -a
# Give the location of libpcap here if it's not in one of the standard
# directories:
# LDFLAGS += -L/usr/local/lib
# LDFLAGS += -pg -a
# Do you want to use curses or ncurses? Probably ncurses, unless curses
# is ncurses on your machine.
# CURSES = -lncurses
#CURSES = -lcurses
#
# Name resolution. Sensible systems have gethostbyaddr_r, which is reentrant
# and can be called from several threads of a multithreaded program. Other
# systems don't, or their implementations don't work ([cough] FreeBSD). For
# these you can use gethostbyaddr (not recommended, since then only one thread
# can resolve a name at once), libresolv (not recommended and may not work
# depending on which header files you have), or ares, an asynchronous DNS
# resolution library from
# ftp://athena-dist.mit.edu/pub/ATHENA/ares/
# For systems without a working gethostbyaddr_r, this is recommended.
#
# Leave exactly one of these uncommented, or comment all of them out if you
# don't care about name resolution at all.
#
CFLAGS += -DUSE_GETHOSTBYADDR_R
#CFLAGS += -DUSE_GETHOSTBYADDR
#CFLAGS += -DUSE_LIBRESOLV
#CFLAGS += -DUSE_ARES
#
# On some machines, gethostbyaddr_r returns int; on others, struct hostent*.
# Comment out this line if you are using one of the latter.
#
#CFLAGS += -DGETHOSTBYADD_R_RETURNS_INT
#
# Uncomment if you are using libresolv.
#
#LDLIBS += -lresolv # or /usr/lib/libresolv.a on Linux?
#
# Uncomment if you are using ares.
#
#LDLIBS += -lares
# ... and uncomment these if your libares is in an unusual place.
#CFLAGS += -I/software/include
#LDFLAGS += -L/software/lib
#
# Solaris needs a library to make sockets go and lacks inet_aton.
#
#LDLIBS += -lsocket -lnsl
CFLAGS += -DFAKE_INET_ATON
# PREFIX specifies the base directory for the installation.
PREFIX = /usr/local
#PREFIX = /software
# BINDIR is where the binary lives relative to PREFIX (no leading /).
BINDIR = sbin
# MANDIR is where the manual page goes.
MANDIR = man
#MANDIR = share/man # FHS-ish
# You shouldn't need to change anything below this point.
CFLAGS += -g -Wall "-DIFTOP_VERSION=\"$(VERSION)\""
LDFLAGS += -g #-pthread
LDLIBS += -lpcap $(CURSES) -lm -lpthread
COMMON_SRCS = addr_hash.c hash.c ns_hash.c util.c sorted_list.c\
options.c serv_hash.c threadprof.c screenfilter.c cfgfile.c stringmap.c addrs_ioctl.c
IFTOP_ONLY_SRCS = iftop.c ui.c stringmap.c
IFTOPDUMP_ONLY_SRCS = iftop-dump.c counter_hash.c
SRCS = $(COMMON_SRCS) $(IFTOPDUMP_ONLY_SRCS) $(IFTOP_ONLY_SRCS)
IFTOP_SRCS = $(IFTOP_ONLY_SRCS) $(COMMON_SRCS)
IFTOPDUMP_SRCS = $(IFTOPDUMP_ONLY_SRCS) $(COMMON_SRCS)
HDRS = addr_hash.h hash.h iftop.h ns_hash.h resolver.h sorted_list.h ui.h options.h sll.h\
serv_hash.h threadprof.h ether.h ip.h tcp.h screenfilter.h token.h llc.h \
extract.h ethertype.h
TXTS = README CHANGES INSTALL TODO iftop.8 COPYING
SPECFILE = iftop.spec iftop.spec.in
IFTOP_OBJS = $(IFTOP_SRCS:.c=.o)
IFTOPDUMP_OBJS = $(IFTOPDUMP_SRCS:.c=.o)
iftop: $(IFTOP_OBJS) Makefile
$(CC) $(LDFLAGS) -o $@ $(IFTOP_OBJS) $(LDLIBS)
iftop-dump: $(IFTOPDUMP_OBJS) Makefile
$(CC) $(LDFLAGS) -o $@ $(IFTOPDUMP_OBJS) $(LDLIBS)
#integers.h: integers
# ./integers
install: iftop
install -D iftop $(PREFIX)/$(BINDIR)/iftop
install -D iftop.8 $(PREFIX)/$(MANDIR)/man8/iftop.8
uninstall:
rm -f $(PREFIX)/$(BINDIR)/iftop $(PREFIX)/$(MANDIR)/man8/iftop.8
%.o: %.c Makefile
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *~ *.o core iftop iftop.spec
tarball: depend $(SRCS) $(HDRS) $(TXTS) $(SPECFILE)
mkdir iftop-$(VERSION)
set -e ; for i in Makefile depend $(SRCS) $(HDRS) $(TXTS) $(SPECFILE) ; do cp $$i iftop-$(VERSION)/$$i ; done
tar cvf - iftop-$(VERSION) | gzip --best > iftop-$(VERSION).tar.gz
rm -rf iftop-$(VERSION)
tags :
etags *.c *.h
depend: $(SRCS)
$(CPP) $(CFLAGS) -MM $(SRCS) > depend
nodepend:
rm -f depend
iftop.spec: iftop.spec.in Makefile
sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec
include depend
......@@ -7,7 +7,7 @@
# it.
# -- Chris Lightfoot
#
# $Id: Makefile.am,v 1.12 2014/01/01 14:37:31 pdw Exp $
# $Id: Makefile.am,v 1.13 2014/01/19 20:11:39 pdw Exp $
#
sbin_PROGRAMS = iftop
......@@ -41,7 +41,7 @@ iftop.cat: iftop.8
(echo -e ".pl 1100i" ; cat iftop.8 ; echo ".pl \n(nlu+10") | groff -Tascii -man > iftop.cat
iftop.spec: iftop.spec.in configure.in
sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec
sed 's/__VERSION__/$(PACKAGE_VERSION)/' < iftop.spec.in > iftop.spec
## These need to be distributed along with configure:
......
......@@ -23,7 +23,7 @@
# it.
# -- Chris Lightfoot
#
# $Id: Makefile.am,v 1.12 2014/01/01 14:37:31 pdw Exp $
# $Id: Makefile.am,v 1.13 2014/01/19 20:11:39 pdw Exp $
#
......@@ -103,7 +103,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/config/config.sub \
$(top_srcdir)/config/install-sh $(top_srcdir)/config/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
......@@ -382,7 +382,7 @@ iftop_SOURCES = addr_hash.c edline.c hash.c iftop.c ns_hash.c \
# util.c \
# addrs_ioctl.c addrs_dlpi.c dlcommon.c \
# stringmap.c cfgfile.c
noinst_HEADERS = addr_hash.h ether.h ethertype.h extract.h hash.h iftop.h \
noinst_HEADERS = addr_hash.h addrs_ioctl.h ether.h ethertype.h extract.h hash.h iftop.h \
integers.h ip.h llc.h ns_hash.h options.h resolver.h \
screenfilter.h serv_hash.h sll.h sorted_list.h tcp.h \
threadprof.h token.h ui_common.h ui.h tui.h dlcommon.h stringmap.h \
......@@ -391,7 +391,7 @@ noinst_HEADERS = addr_hash.h ether.h ethertype.h extract.h hash.h iftop.h \
man_MANS = iftop.8
SUBDIRS = config
EXTRA_DIST = bootstrap README ChangeLog AUTHORS COPYING INSTALL TODO \
Makefile.OLD $(man_MANS) iftop.cat iftop.spec
$(man_MANS) iftop.cat iftop.spec
MAINTERCLEANFILES = Makefile.in aclocal.m4 configure configuration.h.in \
stamp-h.in iftop.spec
......@@ -1012,8 +1012,8 @@ uninstall-man: uninstall-man8
iftop.cat: iftop.8
(echo -e ".pl 1100i" ; cat iftop.8 ; echo ".pl \n(nlu+10") | groff -Tascii -man > iftop.cat
iftop.spec: iftop.spec.in configure.in
sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec
iftop.spec: iftop.spec.in configure.ac
sed 's/__VERSION__/$(PACKAGE_VERSION)/' < iftop.spec.in > iftop.spec
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
......
......@@ -731,35 +731,6 @@ else
fi
])
# -*- Autoconf -*-
# Obsolete and "removed" macros, that must however still report explicit
# error messages when used, to smooth transition.
#
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
AC_DEFUN([AM_CONFIG_HEADER],
[AC_DIAGNOSE([obsolete],
['$0': this macro is obsolete.
You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
AC_CONFIG_HEADERS($@)])
AC_DEFUN([AM_PROG_CC_STDC],
[AC_PROG_CC
am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
AC_DIAGNOSE([obsolete],
['$0': this macro is obsolete.
You should simply use the 'AC][_PROG_CC' macro instead.
Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
but upon 'ac_cv_prog_cc_stdc'.])])
AC_DEFUN([AM_C_PROTOTYPES],
[AC_FATAL([automatic de-ANSI-fication support has been removed])])
AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
......
......@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "addr_hash.h"
#include "hash.h"
#include "iftop.h"
......
......@@ -90,28 +90,23 @@ get_addrs_ioctl(char *interface, char if_hw_addr[], struct in_addr *if_ip_addr,
sysctlparam[5] = if_nametoindex(interface);
if (sysctlparam[5] == 0) {
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
goto ENDHWADDR;
}
if (sysctl(sysctlparam, 6, NULL, &needed, NULL, 0) < 0) {
else if (sysctl(sysctlparam, 6, NULL, &needed, NULL, 0) < 0) {
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
goto ENDHWADDR;
}
if ((buf = malloc(needed)) == NULL) {
else if ((buf = malloc(needed)) == NULL) {
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
goto ENDHWADDR;
}
if (sysctl(sysctlparam, 6, buf, &needed, NULL, 0) < 0) {
else if (sysctl(sysctlparam, 6, buf, &needed, NULL, 0) < 0) {
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
free(buf);
goto ENDHWADDR;
}
msghdr = (struct if_msghdr *) buf;
memcpy(if_hw_addr, LLADDR((struct sockaddr_dl *)(buf + sizeof(struct if_msghdr) - sizeof(struct if_data) + sizeof(struct if_data))), 6);
free(buf);
got_hw_addr = 1;
ENDHWADDR:
1; /* compiler whines if there is a label at the end of a block...*/
else {
msghdr = (struct if_msghdr *) buf;
memcpy(if_hw_addr, LLADDR((struct sockaddr_dl *)(buf + sizeof(struct if_msghdr) - sizeof(struct if_data) + sizeof(struct if_data))), 6);
free(buf);
got_hw_addr = 1;
}
}
#else
fprintf(stderr, "Cannot obtain hardware address on this platform\n");
......
/*
* iftop.h:
*
*/
#ifndef __ADDRS_IOCTL_H_ /* include guard */
#define __ADDRS_IOCTL_H_
int
get_addrs_ioctl(char *interface, char if_hw_addr[], struct in_addr *if_ip_addr, struct in6_addr *if_ip6_addr);
#endif /* __ADDRS_IOCTL_H_ */
......@@ -8,6 +8,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include "stringmap.h"
#include "iftop.h"
......@@ -169,7 +170,6 @@ int config_get_int(const char *directive, int *value) {
* failure, or 0 if no value was found. */
int config_get_float(const char *directive, float *value) {
stringmap S;
item *I;
char *s, *t;
if (!value) return -1;
......@@ -245,7 +245,5 @@ void config_set_string(const char *directive, const char* s) {
}
int read_config(char *file, int whinge_on_error) {
void* o;
return read_config_file(file, whinge_on_error);
}
......@@ -20,6 +20,8 @@ int config_get_bool(const char *directive);
int config_get_int(const char *directive, int *value);
int config_get_float(const char *directive, float *value);
int config_init();
void config_set_string(const char *directive, const char* s);
int config_get_enum(const char *directive, config_enumeration_type *enumeration, int *value);
......
/* config.h.in. Generated from configure.in by autoheader. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* 7-argument gethostbyaddr_r returns struct hostent* */
#undef GETHOSTBYADDR_R_RETURNS_HOSTENT_P
......@@ -42,6 +42,9 @@
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
......@@ -81,12 +84,15 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* The iftop version number */
#undef IFTOP_VERSION
/* Enable default promiscuous mode to capture outgoing packets */
#undef NEED_PROMISCUOUS_FOR_OUTGOING
......
......@@ -90,7 +90,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
mkinstalldirs compile config.guess config.sub depcomp \
install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
dnl
dnl configure.in:
dnl configure.ac:
dnl Autoconf input for iftop.
dnl
dnl I hate autoconf with a passion. It's an utter pain to write these bloody
......@@ -7,7 +7,7 @@ dnl things and even once you have you find yourself testing for more and more
dnl special cases. But that's OK. Paul is going to maintain it :)
dnl -- Chris Lightfoot
dnl
dnl $Id: configure.in,v 1.34 2014/01/01 15:22:48 pdw Exp $
dnl $Id: configure.ac,v 1.2 2014/01/19 20:28:31 pdw Exp $
dnl
dnl To regenerate everything from source, do:
dnl autoheader
......@@ -17,21 +17,19 @@ dnl autoconf
dnl Now you should have good sources to make into a tarball and distribute.
dnl ./configure (perhaps with some arguments)
dnl make
dnl Tested with Automake 1.4 and autoconf 2.59.
dnl Tested with automake 1.9.6-1.14 and autoconf 2.59-2.69.
dnl
dnl Boilerplate configuration
dnl
AC_INIT(iftop.c)
AC_INIT([iftop], [1.0pre4], [pdw@ex-parrot.com], [iftop], [http://www.ex-parrot.com/pdw/iftop/])
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(iftop, "1.0pre3")
AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE
dnl Make sure we have a C compiler....
AC_PROG_CC
......@@ -74,7 +72,7 @@ dnl Fairly generic checks.
dnl
dnl Checks for system headers.
AC_CHECK_HEADERS(sys/ioctl.h sys/time.h sys/sockio.h unistd.h)
AC_CHECK_HEADERS([sgtty.h sys/ioctl.h sys/time.h sys/sockio.h termio.h termios.h unistd.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
......@@ -107,7 +105,7 @@ dnl
for type in u_int8_t u_int16_t u_int32_t ; do
AC_MSG_CHECKING([size of $type])
AC_RUN_IFELSE([
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <sys/types.h>
#include <stdio.h>
int main() {
......@@ -117,7 +115,7 @@ int main() {
fprintf(f, "%d\n", sizeof($1));
exit(0);
}
], [
])], [
x=`cat conftestval`
eval "size_$type=$x"
AC_MSG_RESULT([$x])
......@@ -206,13 +204,13 @@ dnl whether it works so we can support cross-compilation.
if test x$resolver = xnetdb ; then
AC_MSG_CHECKING([how to call gethostbyaddr_r])
dnl Try 7 arguments returning a struct hostent*.
AC_LINK_IFELSE(AC_LANG_SOURCE([`cat config/hostentp_ghba_r.c`]),
AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/hostentp_ghba_r.c`])],
[AC_MSG_RESULT([7 args])
ghba_args=8
AC_DEFINE(GETHOSTBYADDR_R_RETURNS_HOSTENT_P, 1,
[7-argument gethostbyaddr_r returns struct hostent*])], [
dnl Try 8 arguments returning an int.
AC_LINK_IFELSE(AC_LANG_SOURCE([`cat config/int_ghba_r.c`]),
AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/int_ghba_r.c`])],
[AC_MSG_RESULT([8 args, int return])
ghba_args=8
AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT, 1,
......@@ -235,7 +233,7 @@ if test x$resolver = xnetdb ; then
testfile=hostentp_ghba_r
fi
AC_MSG_CHECKING(gethostbyaddr_r usability)
AC_RUN_IFELSE([`cat config/$testfile.c`],
AC_RUN_IFELSE([AC_LANG_SOURCE([`cat config/$testfile.c`])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
resolver=guess],
......@@ -387,7 +385,7 @@ for flag in "" -mt -pthread -thread ; do
CFLAGS="$oldCFLAGS $flag"
for lib in "" -lpthread "-lpthread -lposix4" ; do
LIBS="$oldLIBS $lib"
AC_LINK_IFELSE(AC_LANG_SOURCE([`cat config/pthread.c`]), [
AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/pthread.c`])], [
foundthrlib=$lib
foundthrflag=$flag
thrfail=0
......@@ -407,7 +405,7 @@ fi
AC_MSG_RESULT([CFLAGS=$foundthrflag and LIBS=$foundthrlib])
AC_MSG_CHECKING([POSIX threads usability])
AC_RUN_IFELSE([`cat config/pthread.c`],
AC_RUN_IFELSE([AC_LANG_SOURCE([`cat config/pthread.c`])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR(
[it fails. We probably guessed the wrong CFLAGS.])],
......@@ -444,7 +442,7 @@ AC_SUBST(ac_aux_dir)
AC_OUTPUT(Makefile config/Makefile)
if echo $VERSION | grep 'pre' ; then
if echo $PACKAGE_VERSION | grep 'pre' > /dev/null ; then
AC_MSG_WARN([
******************************************************************************
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Summary: iftop - display bandwidth usage on an interface by host
Name: iftop
Version: 1.0pre3
Version: 1.0pre4
Release: 1
Source: http://www.ex-parrot.com/~pdw/iftop/%{name}-%{version}.tar.gz
URL: http://www.ex-parrot.com/~pdw/iftop/
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment