[PATCH 0/3] fix and cleanups
by Vitezslav Samel
Vitezslav Samel (3):
hostmon(): fix: remove TokenRing check
remove LINK_PLIP
hostmon(): change series of if() into switch()
src/hostmon.c | 167 +++++++++++++++++++++++---------------------------------
src/othptab.c | 8 +--
src/packet.c | 2 +-
src/tcptable.c | 3 +-
4 files changed, 73 insertions(+), 107 deletions(-)
--
1.7.8.4
12 years
[REBASED][PATCH 0/2] iptraf-ng: cleanup 2
by Vitezslav Samel
*** BLURB HERE ***
Vitezslav Samel (2):
remove unneeded extern definitions
remove unused tcptimeout.h include file
src/Makefile.am | 1 -
src/hostmon.c | 2 --
src/itrafmon.c | 4 ----
src/promisc.c | 2 --
src/rvnamed.c | 3 ---
src/tcptimeout.h | 7 -------
6 files changed, 0 insertions(+), 19 deletions(-)
delete mode 100644 src/tcptimeout.h
--
1.7.8.4
12 years
[PATCH 0/3] iptraf-ng: fixes
by Vitezslav Samel
Vitezslav Samel (3):
getpacket(): do not return negative value as packet size in case of error
getpacket(): workaround select() bug
getpacket(): fix recvfrom() when interrupted
src/packet.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
--
1.7.8.4
12 years
[PATCH 00/13] iptraf-ng: cleanup
by Vitezslav Samel
Mark functions unused in other module as static.
Vitezslav Samel (13):
hostmon.c: make some functions static
instances.c: make some functions static
ipfrag.c: make some functions static
iptraf.c: make some functions static
itrafmon.c: make some functions static
options.c: make some functions static
othptab.c: make some functions static
parseproto.c: make some functions static
pktsize.c: make some functions static
revname.c: make some functions static
rvnamed.c: make some functions static
serv.c: make some functions static
tcptable.c: make some functions static
src/hostmon.c | 59 +++++++++++++++++++++-------------------
src/instances.c | 2 +-
src/ipfrag.c | 12 ++++----
src/ipfrag.h | 12 --------
src/iptraf.c | 18 ++++++------
src/itrafmon.c | 57 ++++++++++++++++++++------------------
src/options.c | 18 ++++++------
src/othptab.c | 2 +-
src/othptab.h | 2 -
src/parseproto.c | 2 +-
src/pktsize.c | 12 +++++---
src/revname.c | 2 +-
src/rvnamed.c | 16 +++++-----
src/serv.c | 80 +++++++++++++++++++++++++++++------------------------
src/serv.h | 8 -----
src/tcptable.c | 20 +++++++------
16 files changed, 159 insertions(+), 163 deletions(-)
--
1.7.8.4
12 years
[PATCH 0/2] iptraf-ng: cleanup 2
by Vitezslav Samel
Vitezslav Samel (2):
remove unneeded extern definitions
remove unused tcptimeout.h include file
src/Makefile.am | 1 -
src/hostmon.c | 2 --
src/itrafmon.c | 4 ----
src/promisc.c | 2 --
src/rvnamed.c | 3 ---
src/tcptimeout.h | 7 -------
6 files changed, 0 insertions(+), 19 deletions(-)
delete mode 100644 src/tcptimeout.h
--
1.7.8.4
12 years
[PATCH] build: use Makefile instead of autotools machinery
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
.gitignore | 29 ++----
GEN-VERSION-FILE | 39 ++++++++
Makefile | 279 +++++++++++++++++++++++++++++++++++++++++++++++++++++
Makefile.am | 29 ------
autogen.sh | 3 -
config.mak.in | 26 +++++
configure.ac | 283 ++++++++++++++++++++++++++++++++++++++++++------------
gen-version | 23 -----
src/Makefile.am | 132 -------------------------
src/deskman.c | 5 +-
src/iptraf.c | 5 +-
11 files changed, 574 insertions(+), 279 deletions(-)
create mode 100755 GEN-VERSION-FILE
create mode 100644 Makefile
delete mode 100644 Makefile.am
delete mode 100755 autogen.sh
create mode 100644 config.mak.in
delete mode 100755 gen-version
delete mode 100644 src/Makefile.am
diff --git a/.gitignore b/.gitignore
index 3fee939..9ab498e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,30 +26,15 @@ cscope.*
ncscope.*
# autotools
-*/.deps/
-*/.libs/
-Makefile
-Makefile.in
-m4/
-missing
-configure
-configure.scan
-autom4te.cache/
-config.guess
-config.log
-config.h
-config.h.in
-config.rpath
-config.status
-config.sub
-aclocal.m4
-autoscan.log
-depcomp
-install-sh
-stamp-h1
+/configure
+/autom4te.cache/
+/config.log
+/config.mak.append
+/config.mak.autogen
+/config.status
# misc
*~
\#*#
/iptraf-ng.spec
-version
+VERSION-FILE
diff --git a/GEN-VERSION-FILE b/GEN-VERSION-FILE
new file mode 100755
index 0000000..652bc25
--- /dev/null
+++ b/GEN-VERSION-FILE
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+GVF=VERSION-FILE
+DEF_VER=1.1.1
+LF='
+'
+
+# First see if there is a version file (included in release tarballs),
+# then try git-describe, then default.
+if test -f version
+then
+ VN=$(cat version) || VN="$DEF_VER"
+elif test -d .git -o -f .git &&
+ VN=$(git describe --tags --match "[0-9]*" --abbrev=4 HEAD 2>/dev/null) &&
+ case "$VN" in
+ *$LF*) (exit 1) ;;
+ [0-9]*)
+ git update-index -q --refresh
+ test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty"
+ esac
+then
+ VN=$(echo "$VN" | sed -e 's/-/./g');
+else
+ VN="$DEF_VER"
+fi
+
+
+VN=$(expr "$VN" : v*'\(.*\)')
+
+if test -r $GVF
+then
+ VC=$(sed -e 's/^IPTRAF_VERSION = //' <$GVF)
+else
+ VC=unset
+fi
+test "$VN" = "$VC" || {
+ echo >&2 "IPTRAF_VERSION = $VN"
+ echo "IPTRAF_VERSION = $VN" >$GVF
+}
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4c21468
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,279 @@
+# The default target of this Makefile is...
+all::
+
+# Define V=1 to have a more verbose compile.
+#
+# Define NO_NCURSES if not linking with ncurses.
+
+
+VERSION-FILE:
+ @$(SHELL_PATH) ./GEN-VERSION-FILE
+-include VERSION-FILE
+
+CFLAGS = -g -O2 -Wall -W -std=gnu99 -pedantic
+LDFLAGS =
+ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
+ALL_LDFLAGS = $(LDFLAGS)
+STRIP ?= strip
+
+prefix = $(HOME)
+bindir_relative = bin
+bindir = $(prefix)/$(bindir_relative)
+mandir = $(prefix)/share/man
+sharedir = $(prefix)/share
+localedir = $(sharedir)/locale
+lib = lib
+man8dir = $(mandir)/man8
+
+# DESTDIR=
+pathsep = :
+
+export prefix bindir sharedir sysconfdir gitwebdir localedir
+
+CC = cc
+RM = rm -f
+INSTALL = install
+RPMBUILD = rpmbuild
+TAR = tar
+
+### --- END CONFIGURATION SECTION ---
+
+
+# Those must not be GNU-specific; they are shared with perl/ which may
+# be built by a different compiler. (Note that this is an artifact now
+# but it still might be nice to keep that distinction.)
+BASIC_CFLAGS = -I. -Isrc/
+BASIC_LDFLAGS =
+
+# Guard against environment variables
+obj-h :=
+obj-c :=
+revname-c =
+revname-h =
+
+
+ALL_PROGRAMS =
+
+# Empty...
+EXTRA_PROGRAMS =
+
+ALL_PROGRAMS += src/iptraf-ng src/rvnamed-ng
+
+ifndef SHELL_PATH
+ SHELL_PATH = /bin/sh
+endif
+
+obj-h += src/tui/input.h
+obj-h += src/tui/labels.h
+obj-h += src/tui/listbox.h
+obj-h += src/tui/menurt.h
+obj-h += src/tui/msgboxes.h
+obj-h += src/tui/winops.h
+obj-h += src/tui/tui.h
+obj-h += src/iptraf-ng-compat.h
+obj-h += src/parse-options.h
+obj-h += src/strbuf.h
+obj-h += src/packet.h
+obj-h += src/tcptable.h
+obj-h += src/othptab.h
+obj-h += src/ifstats.h
+obj-h += src/deskman.h
+obj-h += src/hostmon.h
+obj-h += src/fltedit.h
+obj-h += src/cidr.h
+obj-h += src/fltselect.h
+obj-h += src/ipfilter.h
+obj-h += src/fltmgr.h
+obj-h += src/ipfrag.h
+obj-h += src/serv.h
+obj-h += src/servname.h
+obj-h += src/instances.h
+obj-h += src/timer.h
+obj-h += src/ifaces.h
+obj-h += src/error.h
+obj-h += src/revname.h
+obj-h += src/log.h
+obj-h += src/pktsize.h
+obj-h += src/landesc.h
+obj-h += src/dirs.h
+obj-h += src/getpath.h
+obj-h += src/isdntab.h
+obj-h += src/bar.h
+obj-h += src/options.h
+obj-h += src/promisc.h
+obj-h += src/parseproto.h
+obj-h += src/addproto.h
+obj-h += src/tcptimeout.h
+obj-h += src/arphdr.h
+obj-h += src/externs.h
+obj-h += src/attrs.h
+obj-h += src/fltdefs.h
+obj-h += src/logvars.h
+obj-h += src/list.h
+
+obj-c += src/tui/input.o
+obj-c += src/tui/labels.o
+obj-c += src/tui/listbox.o
+obj-c += src/tui/menurt.o
+obj-c += src/tui/msgboxes.o
+obj-c += src/tui/txbox.o
+obj-c += src/tui/winops.o
+obj-c += src/error.o
+obj-c += src/log.o
+obj-c += src/getpath.o
+obj-c += src/bar.o
+obj-c += src/parseproto.o
+obj-c += src/fltselect.o
+obj-c += src/ipfilter.o
+obj-c += src/fltmgr.o
+obj-c += src/ipfrag.o
+obj-c += src/serv.o
+obj-c += src/servname.o
+obj-c += src/instances.o
+obj-c += src/timer.o
+obj-c += src/revname.o
+obj-c += src/pktsize.o
+obj-c += src/landesc.o
+obj-c += src/isdntab.o
+obj-c += src/options.o
+obj-c += src/promisc.o
+obj-c += src/ifaces.o
+obj-c += src/usage.o
+obj-c += src/iptraf.o
+obj-c += src/itrafmon.o
+obj-c += src/wrapper.o
+obj-c += src/parse-options.o
+obj-c += src/strbuf.o
+obj-c += src/packet.o
+obj-c += src/tcptable.o
+obj-c += src/othptab.o
+obj-c += src/ifstats.o
+obj-c += src/detstats.o
+obj-c += src/deskman.o
+obj-c += src/hostmon.o
+obj-c += src/fltedit.o
+obj-c += src/cidr.o
+
+-include config.mak.autogen
+-include config.mak
+
+ifndef sysconfdir
+ifeq ($(prefix),/usr)
+sysconfdir = /etc
+else
+sysconfdir = etc
+endif
+endif
+
+
+ifndef NO_NCURSES
+ BASIC_LDFLAGS += -lncurses -lpanel -ltinfo
+endif
+
+QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1 =
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ QUIET_CC = @echo ' ' CC $@;
+ QUIET_LINK = @echo ' ' LINK $@;
+ QUIET_GEN = @echo ' ' GEN $@;
+ QUIET_SUBDIR0 = +@subdir=
+ QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
+ $(MAKE) $(PRINT_DIR) -C $$subdir
+ export V
+ export QUIET_GEN
+ export QUIET_BUILT_IN
+endif
+endif
+
+
+DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
+sbindir_SQ = $(subst ','\'',$(sbindir))
+
+ALL_CFLAGS += $(BASIC_CFLAGS)
+ALL_LDFLAGS += $(BASIC_LDFLAGS)
+
+export TAR INSTALL DESTDIR SHELL_PATH
+
+### Build rules
+
+SHELL = $(SHELL_PATH)
+
+#all:: shell_compatibility_test
+#please_set_SHELL_PATH_to_a_more_modern_shell:
+# @$$(:)
+#shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
+
+
+all:: $(ALL_PROGRAMS)
+$(ALL_PROGRAMS): $(obj-c) src/rvnamed.c
+ $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ \
+ $(obj-c) $(ALL_LDFLAGS)
+$(obj-c): %.o: %.c
+ $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
+
+configure: configure.ac
+ $(QUIET_GEN)$(RM) $@ $<+ && \
+ sed -e 's/@@IPTRAF_VERSION@@/$(IPTRAF_VERSION)/g' \
+ $< > $<+ && \
+ autoconf -o $@ $<+ && \
+ $(RM) $<+
+
+
+### Maintainer's dist rules
+
+iptraf-ng.spec: iptraf-ng.spec.in
+ sed -e 's/@@IPTRAF_VERSION@@/$(IPTRAF_VERSION)/g' < $< > $@+
+ mv $@+ $@
+
+IPTRAF_TARNAME = iptraf-ng-$(IPTRAF_VERSION)
+dist: iptraf-ng.spec configure
+ @mkdir -p $(IPTRAF_TARNAME)
+ @cp iptraf-ng.spec configure $(IPTRAF_TARNAME)
+ @cp --parents `git ls-files` $(IPTRAF_TARNAME)
+ @echo $(IPTRAF_VERSION) > $(IPTRAF_TARNAME)/version
+ $(TAR) cf $(IPTRAF_TARNAME).tar $(IPTRAF_TARNAME)
+ @$(RM) -rf $(IPTRAF_TARNAME)
+ gzip -f -9 $(IPTRAF_TARNAME).tar
+
+rpm: dist
+ $(RPMBUILD) \
+ --define "_source_filedigest_algorithm md5" \
+ --define "_binary_filedigest_algorithm md5" \
+ -ta $(IPTRAF_TARNAME).tar.gz
+
+
+## TODO: use asciidoc to generate mans
+
+### Installation rules
+install: all
+ @echo $(DESTDIR_SQ)$(man8dir)
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sbindir_SQ)'
+ $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(sbindir_SQ)'
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
+ $(INSTALL) -m 644 src/iptraf-ng.8 $(DESTDIR)$(man8dir)
+ $(INSTALL) -m 644 src/rvnamed-ng.8 $(DESTDIR)$(man8dir)
+
+### Cleaning rules
+
+distclean: clean
+ $(RM) configure
+
+clean:
+ $(RM) src/*.o src/tui/*.o
+ $(RM) $(ALL_PROGRAMS)
+ $(RM) -r autom4te.cache
+ $(RM) *.spec
+ $(RM) $(IPTRAF_TARNAME).tar.gz
+ $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
+ $(RM) VERSION-FILE
+
+.PHONY: clean distclean all install
+
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index a6ecaa9..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-SUBDIRS = src
-
-AM_MAKEFLAGS = -rR --no-print-directory
-
-EXTRA_DIST = Documentation CHANGES FAQ LICENSE RELEASE-NOTES version
-
-RPM_DIRS = --define "_sourcedir `pwd`" \
- --define "_rpmdir `pwd`" \
- --define "_specdir `pwd`" \
- --define "_builddir `pwd`" \
- --define "_srcrpmdir `pwd`"
-
-rpm:
- ./gen-version
- autoconf --force
- $(MAKE) dist
- rpmbuild $(RPM_DIRS) -ba iptraf-ng.spec
-
-srpm:
- ./gen-version
- autoconf --force
- $(MAKE) dist
- rpmbuild $(RPM_DIRS) -bs iptraf-ng.spec
-
-# value for overriding from command line
-# e.g: make scratch-build DIST=f15
-DIST=rawhide
-scratch-build: srpm
- koji build --scratch dist-$(DIST) `make srpm | grep Wrote | cut -d' ' -f2`
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index f81ae2b..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-./gen-version
-autoreconf --install --force
-rm -rf autom4te.cache
diff --git a/config.mak.in b/config.mak.in
new file mode 100644
index 0000000..593a757
--- /dev/null
+++ b/config.mak.in
@@ -0,0 +1,26 @@
+# git Makefile configuration, included in main Makefile
+# @configure_input@
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+TAR = @TAR@
+#INSTALL = @INSTALL@ # needs install-sh or install.sh in sources
+
+prefix = @prefix@
+bindir = @bindir@
+sbindir = @sbindir@
+datarootdir = @datarootdir@
+sysconfdir = @sysconfdir@
+
+mandir=@mandir@
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+export mandir
+export srcdir VPATH
+
+ASCIIDOC7=@ASCIIDOC7@
+NO_NCURSES=@NO_NCURSES@
diff --git a/configure.ac b/configure.ac
index 399c0e7..accfc44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,69 +1,224 @@
-AC_INIT([iptraf-ng],
- m4_esyscmd([cat ./version]),
- [iptraf-ng(a)fedorahosted.org])
-
-AC_CONFIG_HEADERS([config.h])
-
-dnl checks for system type
-AC_CANONICAL_HOST
-AC_DEFINE_UNQUOTED([PLATFORM], "${host}", [Define to platform])
-
-AM_INIT_AUTOMAKE([-Wall -Werror foreign silent-rules])
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-AC_PROG_CC
-AC_LANG_C
-AC_HEADER_STDC
-
-dnl checks for libraries ncurses[5,6]
-dnl removed ncursesw[5,6]; iptraf-ng does not use it
-AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
-AC_CHECK_PROG([ncurses6_config], [ncurses6-config], [yes])
-
-if test "x$ncurses6_config" = "xyes"; then
- libncurses_CFLAGS=$("ncurses6-config" --cflags)
- libncurses_LIBS=$("ncurses6-config" --libs)
-elif test "x$ncurses5_config" = "xyes"; then
- libncurses_CFLAGS=$("ncurses5-config" --cflags)
- libncurses_LIBS=$("ncurses5-config" --libs)
-else
- AC_MSG_ERROR([Install ncurses5-dev or ncurses6-dev])
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([iptraf-ng], [@@IPTRAF_VERSION@@], [iptraf-ng(a)fedorahosted.org])
+
+AC_CONFIG_SRCDIR([src/iptraf.c])
+
+config_file=config.mak.autogen
+config_append=config.mak.append
+config_in=config.mak.in
+
+echo "# ${config_append}. Generated by configure." > "${config_append}"
+
+
+## Definitions of macros
+# CONF_APPEND_LINE(LINE)
+# --------------------------
+# Append LINE to file ${config_append}
+AC_DEFUN([CONF_APPEND_LINE],
+[echo "$1" >> "${config_append}"])# CONF_APPEND_LINE
+#
+# ARG_SET_PATH(PROGRAM)
+# -------------------------
+# Provide --with-PROGRAM=PATH option to set PATH to PROGRAM
+# Optional second argument allows setting NO_PROGRAM=YesPlease if
+# --without-PROGRAM version used.
+AC_DEFUN([ARG_SET_PATH],
+[AC_ARG_WITH([$1],
+ [AS_HELP_STRING([--with-$1=PATH],
+ [provide PATH to $1])],
+ [CONF_APPEND_PATH($1,$2)],[])
+])# ARG_SET_PATH
+#
+# CONF_APPEND_PATH(PROGRAM)
+# ------------------------------
+# Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH
+# Used by ARG_SET_PATH(PROGRAM)
+# Optional second argument allows setting NO_PROGRAM=YesPlease if
+# --without-PROGRAM is used.
+AC_DEFUN([CONF_APPEND_PATH],
+[PROGRAM=m4_toupper($1); \
+if test "$withval" = "no"; then \
+ if test -n "$2"; then \
+ m4_toupper($1)_PATH=$withval; \
+ AC_MSG_NOTICE([Disabling use of ${PROGRAM}]); \
+ CONF_APPEND_LINE(NO_${PROGRAM}=YesPlease); \
+ CONF_APPEND_LINE(${PROGRAM}_PATH=); \
+ else \
+ AC_MSG_ERROR([You cannot use git without $1]); \
+ fi; \
+else \
+ if test "$withval" = "yes"; then \
+ AC_MSG_WARN([You should provide path for --with-$1=PATH]); \
+ else \
+ m4_toupper($1)_PATH=$withval; \
+ AC_MSG_NOTICE([Setting m4_toupper($1)_PATH to $withval]); \
+ CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \
+ fi; \
+fi; \
+]) # CONF_APPEND_PATH
+#
+# PARSE_WITH(PACKAGE)
+# -----------------------
+# For use in AC_ARG_WITH action-if-found, for packages default ON.
+# * Set NO_PACKAGE=YesPlease for --without-PACKAGE
+# * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH
+# * Unset NO_PACKAGE for --with-PACKAGE without ARG
+AC_DEFUN([PARSE_WITH],
+[PACKAGE=m4_toupper($1); \
+if test "$withval" = "no"; then \
+ m4_toupper(NO_$1)=YesPlease; \
+elif test "$withval" = "yes"; then \
+ m4_toupper(NO_$1)=; \
+else \
+ m4_toupper(NO_$1)=; \
+ m4_toupper($1)DIR=$withval; \
+ AC_MSG_NOTICE([Setting m4_toupper($1)DIR to $withval]); \
+ CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \
+fi \
+])# PARSE_WITH
+#
+# PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT)
+# ---------------------
+# Set VAR to the value specied by --with-WITHNAME.
+# No verification of arguments is performed, but warnings are issued
+# if either 'yes' or 'no' is specified.
+# HELP_TEXT is presented when --help is called.
+# This is a direct way to allow setting variables in the Makefile.
+AC_DEFUN([PARSE_WITH_SET_MAKE_VAR],
+[AC_ARG_WITH([$1],
+ [AS_HELP_STRING([--with-$1=VALUE], $3)],
+ if test -n "$withval"; then \
+ if test "$withval" = "yes" -o "$withval" = "no"; then \
+ AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
+ [a value for $1 ($2). Maybe you do...?]); \
+ fi; \
+ \
+ AC_MSG_NOTICE([Setting $2 to $withval]); \
+ CONF_APPEND_LINE($2=$withval); \
+ fi)])# PARSE_WITH_SET_MAKE_VAR
+
+dnl
+dnl CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
+dnl -----------------------------------------
+dnl Similar to AC_CHECK_FUNC, but on systems that do not generate
+dnl warnings for missing prototypes (e.g. FreeBSD when compiling without
+dnl -Wall), it does not work. By looking for function definition in
+dnl libraries, this problem can be worked around.
+AC_DEFUN([CHECK_FUNC],[AC_CHECK_FUNC([$1],[
+ AC_SEARCH_LIBS([$1],,
+ [$2],[$3])
+],[$3])])
+
+dnl
+dnl STASH_FLAGS(BASEPATH_VAR)
+dnl -----------------------------
+dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running
+dnl tests that may want to take user settings into account.
+AC_DEFUN([STASH_FLAGS],[
+if test -n "$1"; then
+ old_CPPFLAGS="$CPPFLAGS"
+ old_LDFLAGS="$LDFLAGS"
+ CPPFLAGS="-I$1/include $CPPFLAGS"
+ LDFLAGS="-L$1/$lib $LDFLAGS"
fi
+])
-libpanel_LIBS="-lpanel"
-
-AC_SUBST([libncurses_CFLAGS])
-AC_SUBST([libncurses_LIBS])
-AC_SUBST([libpanel_LIBS])
-
-dnl checks for header files
-AC_CHECK_HEADERS([arpa/inet.h])
-AC_CHECK_HEADERS([fcntl.h])
-AC_CHECK_HEADERS([limits.h])
-AC_CHECK_HEADERS([malloc.h])
-AC_CHECK_HEADERS([netdb.h])
-AC_CHECK_HEADERS([netinet/in.h])
-AC_CHECK_HEADERS([sys/ioctl.h])
-AC_CHECK_HEADERS([sys/socket.h])
-AC_CHECK_HEADERS([sys/time.h])
-AC_CHECK_HEADERS([locale.h])
-
-dnl checks for types
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_TYPE_UINT32_T
-AC_TYPE_UINT8_T
-
-dnl checks for library functions
-AC_FUNC_FORK
-AC_FUNC_MALLOC
-
-regular_CFLAGS="-W -Wall -std=gnu99 -pedantic"
-AC_SUBST([regular_CFLAGS])
-
-AC_CONFIG_FILES([
- Makefile
- src/Makefile
+dnl
+dnl UNSTASH_FLAGS(BASEPATH_VAR)
+dnl -----------------------------
+dnl Restore the stashed *FLAGS values.
+AC_DEFUN([UNSTASH_FLAGS],[
+if test -n "$1"; then
+ CPPFLAGS="$old_CPPFLAGS"
+ LDFLAGS="$old_LDFLAGS"
+fi
])
+## Site configuration related to programs (before tests)
+## --with-PACKAGE[=ARG] and --without-PACKAGE
+#
+# Set lib to alternative name of lib directory (e.g. lib64)
+AC_ARG_WITH([lib],
+ [AS_HELP_STRING([--with-lib=ARG],
+ [ARG specifies alternative name for lib directory])],
+ [if test "$withval" = "no" || test "$withval" = "yes"; then \
+ AC_MSG_WARN([You should provide name for --with-lib=ARG]); \
+else \
+ lib=$withval; \
+ AC_MSG_NOTICE([Setting lib to '$lib']); \
+ CONF_APPEND_LINE(lib=$withval); \
+fi; \
+],[])
+
+if test -z "$lib"; then
+ AC_MSG_NOTICE([Setting lib to 'lib' (the default)])
+ lib=lib
+fi
+
+#
+# Define NO_CURL if you do not have curl installed. git-http-pull and
+# git-http-push are not built, and you cannot use http:// and https://
+# transports.
+#
+# Define CURLDIR=/foo/bar if your curl header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+AC_ARG_WITH(ncurses,
+AS_HELP_STRING([--with-ncurses],[support http(s):// transports (default is YES)])
+AS_HELP_STRING([], [ARG can be also prefix for curl library and headers]),
+PARSE_WITH(ncurses))
+
+
+## Checks for programs.
+AC_MSG_NOTICE([CHECKS for programs])
+#
+AC_PROG_CC([cc gcc])
+AC_C_INLINE
+case $ac_cv_c_inline in
+ inline | yes | no) ;;
+ *) AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
+esac
+#AC_PROG_INSTALL # needs install-sh or install.sh in sources
+AC_CHECK_TOOLS(AR, [gar ar], :)
+AC_CHECK_PROGS(TAR, [gtar tar])
+
+AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
+if test -n "$ASCIIDOC"; then
+ AC_MSG_CHECKING([for asciidoc version])
+ asciidoc_version=`$ASCIIDOC --version 2>/dev/null`
+ case "${asciidoc_version}" in
+ asciidoc' '7*)
+ ASCIIDOC7=YesPlease
+ AC_MSG_RESULT([${asciidoc_version} > 7])
+ ;;
+ asciidoc' '8*)
+ ASCIIDOC7=
+ AC_MSG_RESULT([${asciidoc_version}])
+ ;;
+ *)
+ ASCIIDOC7=
+ AC_MSG_RESULT([${asciidoc_version} (unknown)])
+ ;;
+ esac
+fi
+AC_SUBST(ASCIIDOC7)
+
+## Checks for libraries.
+AC_MSG_NOTICE([CHECKS for libraries])
+
+if test -z "$NO_NCURSES"; then
+STASH_FLAGS($NCURSESSDIR)
+AC_CHECK_LIB([ncurses], [initscr],
+[NO_NCURSES=],
+[NO_NCURSES=YesPlease])
+UNSTASH_FLAGS($NCURSESDIR)
+AC_SUBST(NO_NCURSES)
+fi
+
+CFLAGS="$CFLAGS -W -Wall -std=gnu99 -pedantic"
+
+## Output files
+AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
AC_OUTPUT
diff --git a/gen-version b/gen-version
deleted file mode 100755
index ad45916..0000000
--- a/gen-version
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-DEF_VER=1.1.1
-LF='
-'
-
-if test -d .git -o -f .git &&
- VN=$(git describe --tags --match "[0-9]*" --abbrev=4 HEAD 2>/dev/null) &&
- case "$VN" in
- *$LF*) (exit 1) ;;
- [0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty"
- esac
-then
- VN=$(echo "$VN" | sed -e 's/-/./g');
-else
- VN="$DEF_VER"
-fi
-
-sed -e "s/@@IPTRAF_VERSION@@/$VN/g" < iptraf-ng.spec.in > iptraf-ng.spec
-
-echo -n $VN > version
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index dff039d..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,132 +0,0 @@
-# -*- Makefile -*-
-
-AM_CFLAGS = ${regular_CFLAGS}
-
-sbin_PROGRAMS = iptraf-ng rvnamed-ng
-
-NULL =
-TUI_C =
-TUI_H =
-LIB_H =
-LIB_C =
-
-TUI_H += tui/input.h
-TUI_H += tui/labels.h
-TUI_H += tui/listbox.h
-TUI_H += tui/menurt.h
-TUI_H += tui/msgboxes.h
-TUI_H += tui/winops.h
-TUI_H += tui/tui.h
-
-TUI_C += tui/input.c
-TUI_C += tui/labels.c
-TUI_C += tui/listbox.c
-TUI_C += tui/menurt.c
-TUI_C += tui/msgboxes.c
-TUI_C += tui/txbox.c
-TUI_C += tui/winops.c
-
-LIB_H += iptraf-ng-compat.h
-LIB_H += parse-options.h
-LIB_H += strbuf.h
-LIB_H += packet.h
-LIB_H += tcptable.h
-LIB_H += othptab.h
-LIB_H += ifstats.h
-LIB_H += deskman.h
-LIB_H += hostmon.h
-LIB_H += fltedit.h
-LIB_H += cidr.h
-LIB_H += fltselect.h
-LIB_H += ipfilter.h
-LIB_H += fltmgr.h
-LIB_H += ipfrag.h
-LIB_H += serv.h
-LIB_H += servname.h
-LIB_H += instances.h
-LIB_H += timer.h
-LIB_H += ifaces.h
-LIB_H += error.h
-LIB_H += revname.h
-LIB_H += log.h
-LIB_H += pktsize.h
-LIB_H += landesc.h
-LIB_H += dirs.h
-LIB_H += getpath.h
-LIB_H += isdntab.h
-LIB_H += bar.h
-LIB_H += options.h
-LIB_H += promisc.h
-LIB_H += parseproto.h
-LIB_H += addproto.h
-LIB_H += tcptimeout.h
-LIB_H += arphdr.h
-LIB_H += externs.h
-LIB_H += attrs.h
-LIB_H += fltdefs.h
-LIB_H += logvars.h
-LIB_H += list.h
-
-LIB_C += error.c
-LIB_C += log.c
-LIB_C += getpath.c
-LIB_C += bar.c
-LIB_C += parseproto.c
-LIB_C += fltselect.c
-LIB_C += ipfilter.c
-LIB_C += fltmgr.c
-LIB_C += ipfrag.c
-LIB_C += serv.c
-LIB_C += servname.c
-LIB_C += instances.c
-LIB_C += timer.c
-LIB_C += revname.c
-LIB_C += pktsize.c
-LIB_C += landesc.c
-LIB_C += isdntab.c
-LIB_C += options.c
-LIB_C += promisc.c
-LIB_C += ifaces.c
-LIB_C += usage.c
-LIB_C += iptraf.c
-LIB_C += itrafmon.c
-LIB_C += wrapper.c
-LIB_C += parse-options.c
-LIB_C += strbuf.c
-LIB_C += packet.c
-LIB_C += tcptable.c
-LIB_C += othptab.c
-LIB_C += ifstats.c
-LIB_C += detstats.c
-LIB_C += deskman.c
-LIB_C += hostmon.c
-LIB_C += fltedit.c
-LIB_C += cidr.c
-
-iptraf_ng_SOURCES = \
- $(TUI_C) $(TUI_H) \
- $(LIB_C) $(LIB_H) \
- $(NULL)
-
-iptraf_ng_CPPFLAGS = ${AM_CPPFLAGS}
-iptraf_ng_CFLAGS = ${AM_CFLAGS} ${libncurses_CFLAGS}
-iptraf_ng_LDADD = $(libncurses_LIBS) $(libpanel_LIBS)
-
-man_MANS = iptraf-ng.8 rvnamed-ng.8
-
-rvnamed_ng_SOURCES = rvnamed.c rvnamed.h getpath.c dirs.h getpath.h
-rvnamed_ng_CPPFLAGS = ${AM_CPPFLAGS}
-rvnamed_ng_CFLAGS = ${AM_CFLAGS} ${libncurses_CFLAGS}
-
-EXTRA_DIST = $(man_MANS)
-
-CHECKFLAGS= -Wuninitialized -Wshadow -Wold-initializer -Wno-transparent-union -Wno-return-void
-SPARSE = sparse
-
-TESTS = \
- $(TUI_C) $(TUI_H) \
- $(LIB_C) $(LIB_H) \
- $(NULL)
-
-TESTS_ENVIRONMENT = \
- $(SPARSE) $(CHECKFLAGS) $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(AM_CFLAGS) ${libncurses_CFLAGS}
diff --git a/src/deskman.c b/src/deskman.c
index 34cb094..4d9e393 100644
--- a/src/deskman.c
+++ b/src/deskman.c
@@ -21,7 +21,6 @@ details.
#include "deskman.h"
-#include "../config.h"
/* Attribute variables */
int STDATTR;
@@ -96,9 +95,9 @@ void about(void)
tx_colorwin(win);
tx_box(win, ACS_VLINE, ACS_HLINE);
wattrset(win, STDATTR);
- mvwprintw(win, 1, 2, PACKAGE);
+// mvwprintw(win, 1, 2, PACKAGE);
mvwprintw(win, 2, 2, "An IP Network Statistics Utility");
- mvwprintw(win, 3, 2, "Version %s", VERSION);
+// mvwprintw(win, 3, 2, "Version %s", VERSION);
mvwprintw(win, 5, 2, "Written by Gerard Paul Java");
mvwprintw(win, 6, 2, "Copyright (c) Gerard Paul Java 1997-2004");
mvwprintw(win, 8, 2, "This program is open-source software released");
diff --git a/src/iptraf.c b/src/iptraf.c
index a068285..d5c5962 100644
--- a/src/iptraf.c
+++ b/src/iptraf.c
@@ -40,8 +40,6 @@ details.
#include "parse-options.h"
-#include "../config.h"
-
#define WITHALL 1
#define WITHOUTALL 0
@@ -163,9 +161,10 @@ void program_interface(struct OPTIONS *options)
loadaddports(&ports);
+#if 0 /* fixit */
attrset(STATUSBARATTR);
mvprintw(LINES - 1, 1, PLATFORM);
-
+#endif
tx_initmenu(&menu, 15, 35, (LINES - 16) / 2, (COLS - 35) / 2, BOXATTR,
STDATTR, HIGHATTR, BARSTDATTR, BARHIGHATTR, DESCATTR);
--
1.7.9.3
12 years
[PATCH 0/2] iptraf-ng: fixes
by Vitezslav Samel
Vitezslav Samel (2):
hostmon.c: hostmon(): sll_protocol is already in host byte order
hostmon.c: hostmon(): count IPv6 as IP protocol too
src/hostmon.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
--
1.7.8.4
12 years
[PATCH 0/2] iptraf-ng: fix
by Vitezslav Samel
In these days, when network adapters have many offloading facilities,
we can receive packet with length bigger than MTU. So pass the MSG_TRUNC
flag to the recvfrom() function (it gives us the on-wire length even if
the buffer is not big enough).
First 256B of the packet is enough to have all the needed
information about packet (we need packet headers only and
not its data).
Vitezslav Samel (2):
packet.c: getpacket(): get total on-wire length of packet
packet.c: getpacket(): capture first 256B of the packet only
src/packet.c | 2 +-
src/packet.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
1.7.8.4
12 years
[PATCH 0/8] iptraf-ng: cleanup
by Vitezslav Samel
Move logging functions to files wher they belong. In log.c should be
only functions which operate on log files.
Vitezslav Samel (8):
move writedstatlog() from log.c to detstats.c
move writegstatlog() from log.c to ifstats.c
move writeutslog() from log.c to serv.c
move writeethlog() from log.c to hostmon.c
move write_size_log() from log.c to pktsize.c
move writeothplog() from log.c to othptab.c
move writetcplog() and write_tcp_unclosed() from log.c to tcptable.c
remove unused includes and defines
src/detstats.c | 134 +++++++++++++++++-
src/hostmon.c | 70 +++++++++-
src/ifstats.c | 47 ++++++-
src/log.c | 436 +-------------------------------------------------------
src/log.h | 3 +
src/othptab.c | 54 +++++++-
src/pktsize.c | 25 +++-
src/serv.c | 73 +++++++++-
src/tcptable.c | 46 ++++++-
src/tcptable.h | 5 +
10 files changed, 434 insertions(+), 459 deletions(-)
--
1.7.8.4
12 years
Iptraf and 10GBE adapters
by Walter Zimmer
Dear Iptraf Community!
I'm currently trying to monitor the amount of data flowing over
an Intel 82599EB 10GBE Ethernet adapter, which uses the ixgbe driver.
Iptraf shows me a rate of 25 MBytes per second, whereas dstat
shows about 120 MBytes/sec, which also fits other observations.
The adaptor uses TCP segment offloading where the interface gets
complete 64k chunks of data despite the MTU of 1500, so I think
iptraf might have an issue with calculating the byte rate correctly.
Or might it be some counter wrapping issue? I remember that figure
where the 10GBE counters might wrap every 1.6 seconds, which would
not match with the iptraf update rate of 5 seconds. On the other hand,
we don't have that much traffic here.
Any help would be greatly appreciated, as I would really like to use
iptraf because it is so easy to use.
Regards,
Walter
--
Walter Zimmer
German Aerospace Center (DLR)
Earth Observation Center (EOC)
Remote Sensing Technology Institute (IMF)
Department Atmospheric Processors (AP)
Oberpfaffenhofen
82234 Wessling
Tel.: +49 (8153) 28 1492
Fax: +49 (8153) 28 1446
email: walter.zimmer(a)dlr.de
Internet: http://www.dlr.de/eoc
12 years