diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-07-07 14:06:29 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-07-07 14:06:29 +0000 |
commit | 118829fa654f6edeb35e5dda2f6e8215bacf26ca (patch) | |
tree | 2ef0b33fd74d1fec16af7318acaf3f033d52ccbd | |
parent | 80e5249134411d5d8e67eb13edf7e3b92795f0ac (diff) | |
download | ipacct-118829fa654f6edeb35e5dda2f6e8215bacf26ca.tar.gz ipacct-118829fa654f6edeb35e5dda2f6e8215bacf26ca.tar.bz2 |
Remove inlcuded libpcap.
* libpcap: Remove
* INSTALL: Remove
* Makefile.am (SUBDIRS): Remove libpcap
* configure.ac: Remove libpcap
Use LOG_FACILITY instead of --with-log-facility
Raise version no. to 1.0.
* ylwrap: Remove.
* src/Makefile.am (ipacct_LDADD): Use -lpcap.
* src/ipacct.h: Do not include ip_var.h
* src/main.c: Do not include pcap-int.h
* src/run.c: Do not include pcap-int.h
(run): Use pcap_fileno.
* AUTHORS: Update
* ylwrap, INSTALL: Remove.
-rw-r--r-- | AUTHORS | 6 | ||||
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 164 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/ipacct.h | 4 | ||||
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | src/run.c | 5 |
8 files changed, 45 insertions, 160 deletions
@@ -1,5 +1 @@ -Sergey Poznyakoff <gray@farlep.net> - -NOTE: ipacct is distributed with the subdirectory libpcap, which is - a separate package, not a part of ipacct proper. See file - libpcap/COPYING for details. +Sergey Poznyakoff <gray@gnu.org.ua> @@ -1,5 +1,19 @@ 2008-07-07 Sergey Poznyakoff <gray@gnu.org.ua> + Remove inlcuded libpcap. + + * libpcap: Remove + * INSTALL: Remove + * Makefile.am (SUBDIRS): Remove libpcap + * configure.ac: Remove libpcap + Use LOG_FACILITY instead of --with-log-facility + * ylwrap: Remove. + * src/Makefile.am (ipacct_LDADD): Use -lpcap. + * src/ipacct.h: Do not include ip_var.h + * src/main.c: Do not include pcap-int.h + * src/run.c: Do not include pcap-int.h + (run): Use pcap_fileno. + * src/main.c (parse_opt): Remove leftover uses of optarg. (main): Do not use optind. diff --git a/Makefile.am b/Makefile.am index 1ba1e23..4101da5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = 1.6 readme-alpha ACLOCAL_AMFLAGS = -I m4 -SUBDIRS=libpcap lib src m4 +SUBDIRS=lib src m4 EXTRA_DIST=ipacct.conf.example diff --git a/configure.ac b/configure.ac index 10fa942..a244400 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # AC_PREREQ(2.53) -AC_INIT(ipacct, 0.2, bug-ipacct@cvs.farlep.net) +AC_INIT(ipacct, 1.0, bug-ipacct@gnu.org.ua) AC_CONFIG_SRCDIR(src/ipacct.h) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(no-exeext) @@ -35,11 +35,9 @@ AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h malloc.h sys/ioccom.h sys/sockio.h getopt.h) -AC_SUBST(INCLUDES) -AC_CHECK_HEADERS(netinet/if_ether.h netinet/ip_var.h, - [], - [INCLUDES=-I'$(top_srcdir)/libpcap/linux-include'; break]) - +AC_CHECK_HEADER(pcap.h,:, + [AC_MSG_ERROR([Required header pcap.h not found])]) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE @@ -53,6 +51,9 @@ AC_STRUCT_TM dnl Check for libraries AC_CHECK_LIB(socket, main) AC_CHECK_LIB(nsl, main) +AC_CHECK_LIB(pcap, pcap_init, + [LIBS="-lpcap $LIBS"], + [AC_MSG_ERROR([Required library libpcap not found])]) dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL @@ -97,142 +98,23 @@ extern char *program_invocation_name; #endif]) fi -dnl libpcap stuff -dnl All the stuff below has been shamelessly stolen from libpcap-0.4 -dnl configure.in -dnl -dnl Not all versions of test support -c (character special) but it's a -dnl better way of testing since the device might be protected. So we -dnl check in our normal order using -r and then check the for the /dev -dnl guys again using -c. -dnl -AC_SUBST(V_PCAP) -AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE]) -AC_MSG_CHECKING(packet capture type) -if test ! -z "$with_pcap" ; then - V_PCAP="$withval" -elif test -r /dev/bpf0 ; then - V_PCAP=bpf -elif test -r /usr/include/net/pfilt.h ; then - V_PCAP=pf -elif test -r /dev/enet ; then - V_PCAP=enet -elif test -r /dev/nit ; then - V_PCAP=snit -elif test -r /usr/include/sys/net/nit.h ; then - V_PCAP=nit -elif test -r /usr/include/net/raw.h ; then - V_PCAP=snoop -elif test -r /usr/include/sys/dlpi.h ; then - V_PCAP=dlpi -elif test -r /usr/include/linux/socket.h ; then - V_PCAP=linux -elif test -c /dev/bpf0 ; then # check again in case not readable - V_PCAP=bpf -elif test -c /dev/enet ; then # check again in case not readable - V_PCAP=enet -elif test -c /dev/nit ; then # check again in case not readable - V_PCAP=snit -else - V_PCAP=null -fi -AC_MSG_RESULT($V_PCAP) - -case "$V_PCAP" in - -dlpi) - AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) - AC_MSG_CHECKING(for /dev/dlpi device) - if test -c /dev/dlpi ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DEV_DLPI,1,[Define this if you have /dev/dlpi]) - else - AC_MSG_RESULT(no) - dir="/dev/dlpi" - AC_MSG_CHECKING(for $dir directory) - if test -d $dir ; then - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", - [Path to pcap device]) - else - AC_MSG_RESULT(no) - fi - fi - ;; - -linux) - AC_CHECK_HEADERS(net/if_arp.h) - AC_MSG_CHECKING(Linux kernel version) - AC_CACHE_VAL(ac_cv_linux_vers, - ac_cv_linux_vers=`uname -r 2>&1 | \ - sed -n -e '$s/.* //' -e '$s/\..*//p'`) - AC_MSG_RESULT($ac_cv_linux_vers) - if test $ac_cv_linux_vers -lt 2 ; then - AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info) - fi - ;; - -null) - AC_MSG_WARN(cannot determine packet capture interface) - AC_MSG_WARN((see the INSTALL doc for more info)) - ;; - -esac - -case "$target_os" in - -aix*) - AC_DEFINE(_SUN,1,[workarounds to enable certain features]) - ;; - -hpux9*) - AC_DEFINE(HAVE_HPUX9,1,[Define this if we are on a HP-UX 9 system]) - ;; - -hpux10.0*) - ;; - -hpux10.1*) - ;; - -hpux*) - dnl HPUX 10.20 and above is similar to HPUX 9... - AC_DEFINE(HAVE_HPUX10_20,1,[Define this if we are on a HP-UX 10.20 system]) - ;; - -sinix*) - AC_MSG_CHECKING(if SINIX compiler defines sinix) - AC_CACHE_VAL(ac_cv_cc_sinix_defined, - AC_TRY_COMPILE( - [], - [int i = sinix;], - ac_cv_cc_sinix_defined=yes, - ac_cv_cc_sinix_defined=no)) - AC_MSG_RESULT($ac_cv_cc_sinix_defined) - if test $ac_cv_cc_sinix_defined = no ; then - AC_DEFINE(sinix,1,[Define this if we are on a sinix system]) - fi - ;; - -solaris*) - AC_DEFINE(HAVE_SOLARIS,1,[Define this if we are on a Solaris]) - ;; - -linux*) - V_INCLS="$V_INCLS -Ilinux-include" - ;; -esac - AC_MSG_CHECKING(for log facility) -log_facility="LOG_DAEMON" -AC_ARG_WITH(log-facility, - [ --with-log-facility=facility enable logging to the given facility], - AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval, - log_facility=$withval)) -AC_DEFINE_UNQUOTED(LOGFACILITY, $log_facility, +LOG_FACILITY="LOG_DAEMON" +AC_ARG_VAR([LOG_FACILITY], + [Default syslog facility]) +if test -n "$LOG_FACILITY"; then + logfacility=`echo $LOG_FACILITY | tr a-z A-Z` + case $logfacility in + USER|DAEMON|AUTH|AUTHPRIV|MAIL|CRON|LOCAL[[0-7]]) + LOG_FACILITY=LOG_$logfacility;; + LOG_USER|LOG_DAEMON|LOG_AUTH|LOG_AUTHPRIV|LOG_MAIL|LOG_CRON|LOG_LOCAL[[0-7]]) + LOG_FACILITY=$logfacility;; + *) AC_MSG_ERROR([Invalid value of LOG_FACILITY]);; + esac +fi +AC_DEFINE_UNQUOTED(LOGFACILITY, $LOG_FACILITY, [The syslog facility to be used for diagnostics]) -AC_MSG_RESULT($log_facility) - +AC_MSG_RESULT($LOG_FACILITY) -AC_OUTPUT(libpcap/Makefile lib/Makefile src/Makefile m4/Makefile Makefile) +AC_OUTPUT(lib/Makefile src/Makefile m4/Makefile Makefile) diff --git a/src/Makefile.am b/src/Makefile.am index 46bbc49..34104d6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,8 @@ sbin_PROGRAMS = ipacct ipacct_SOURCES = main.c run.c utils.c iputil.c bpf_dump.c cons_raw.c \ cons_ether.c cons_ppp.c cons_ip.c account.c report.c \ config.y list.c -ipacct_LDADD = ../lib/libipacct.a ../libpcap/libpcap.a +ipacct_LDADD = ../lib/libipacct.a noinst_HEADERS = ipacct.h report.h list.h -INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/libpcap @INCLUDES@ +INCLUDES = -I$(top_srcdir)/lib AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" AM_YFLAGS = -v -t
\ No newline at end of file diff --git a/src/ipacct.h b/src/ipacct.h index df8869d..406dd90 100644 --- a/src/ipacct.h +++ b/src/ipacct.h @@ -14,15 +14,13 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: ipacct.h,v 1.6 2005/05/20 12:55:18 gray Exp $ */ +/* $Id: ipacct.h,v 1.7 2008/07/07 14:06:30 gray Exp $ */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> -#include <netinet/ip_var.h> #include <netinet/udp.h> -/*#include <netinet/udp_var.h>*/ #include <net/if.h> #include <netinet/if_ether.h> #include <pcap.h> @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: main.c,v 1.10 2008/07/07 13:27:02 gray Exp $ */ +/* $Id: main.c,v 1.11 2008/07/07 14:06:30 gray Exp $ */ #if defined(HAVE_CONFIG_H) # include <config.h> #endif @@ -35,7 +35,6 @@ #include <netinet/tcp.h> #include <getopt.h> #include <pcap.h> -#include <pcap-int.h> #include <argp.h> #include <ipacct.h> @@ -338,9 +337,6 @@ main(argc, argv) if (!(callback = lookup_pcap_callback(type = pcap_datalink(pcap)))) die(1, "unknown data link type 0x%x", type); - if (pcap->fd < 0) - die(1, "can't listen to %d", pcap->fd); - start_time = time(NULL); if (ttw) slice_interval = ttw; @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: run.c,v 1.1 2001/05/31 13:40:56 gray Exp $ */ +/* $Id: run.c,v 1.2 2008/07/07 14:06:30 gray Exp $ */ #if defined(HAVE_CONFIG_H) # include <config.h> #endif @@ -25,7 +25,6 @@ #include <sys/types.h> #include <sys/time.h> #include <pcap.h> -#include <pcap-int.h> #include <netinet/in.h> #include <string.h> #include <errno.h> @@ -62,7 +61,7 @@ run(p, callback) struct timeval wait; int dumped = 0; - pfd = p->fd; + pfd = pcap_fileno(p); start = time(NULL); |