summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2008-07-07 14:06:29 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2008-07-07 14:06:29 (GMT)
commit118829fa654f6edeb35e5dda2f6e8215bacf26ca (patch) (unidiff)
tree2ef0b33fd74d1fec16af7318acaf3f033d52ccbd
parent80e5249134411d5d8e67eb13edf7e3b92795f0ac (diff)
downloadipacct-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--AUTHORS6
-rw-r--r--ChangeLog14
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac164
-rw-r--r--src/Makefile.am4
-rw-r--r--src/ipacct.h4
-rw-r--r--src/main.c6
-rw-r--r--src/run.c5
8 files changed, 45 insertions, 160 deletions
diff --git a/AUTHORS b/AUTHORS
index 73237d8..db7f07f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1 @@
1Sergey Poznyakoff <gray@farlep.net> Sergey Poznyakoff <gray@gnu.org.ua>
2
3NOTE: ipacct is distributed with the subdirectory libpcap, which is
4 a separate package, not a part of ipacct proper. See file
5 libpcap/COPYING for details.
diff --git a/ChangeLog b/ChangeLog
index 9c7468d..c4dfba8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
12008-07-07 Sergey Poznyakoff <gray@gnu.org.ua> 12008-07-07 Sergey Poznyakoff <gray@gnu.org.ua>
2 2
3 Remove inlcuded libpcap.
4
5 * libpcap: Remove
6 * INSTALL: Remove
7 * Makefile.am (SUBDIRS): Remove libpcap
8 * configure.ac: Remove libpcap
9 Use LOG_FACILITY instead of --with-log-facility
10 * ylwrap: Remove.
11 * src/Makefile.am (ipacct_LDADD): Use -lpcap.
12 * src/ipacct.h: Do not include ip_var.h
13 * src/main.c: Do not include pcap-int.h
14 * src/run.c: Do not include pcap-int.h
15 (run): Use pcap_fileno.
16
3 * src/main.c (parse_opt): Remove leftover uses of optarg. 17 * src/main.c (parse_opt): Remove leftover uses of optarg.
4 (main): Do not use optind. 18 (main): Do not use optind.
5 19
diff --git a/Makefile.am b/Makefile.am
index 1ba1e23..4101da5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
1AUTOMAKE_OPTIONS = 1.6 readme-alpha 1AUTOMAKE_OPTIONS = 1.6 readme-alpha
2ACLOCAL_AMFLAGS = -I m4 2ACLOCAL_AMFLAGS = -I m4
3 3
4SUBDIRS=libpcap lib src m4 4SUBDIRS=lib src m4
5EXTRA_DIST=ipacct.conf.example 5EXTRA_DIST=ipacct.conf.example
6 6
diff --git a/configure.ac b/configure.ac
index 10fa942..a244400 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17# 17#
18AC_PREREQ(2.53) 18AC_PREREQ(2.53)
19AC_INIT(ipacct, 0.2, bug-ipacct@cvs.farlep.net) 19AC_INIT(ipacct, 1.0, bug-ipacct@gnu.org.ua)
20AC_CONFIG_SRCDIR(src/ipacct.h) 20AC_CONFIG_SRCDIR(src/ipacct.h)
21AC_CANONICAL_SYSTEM 21AC_CANONICAL_SYSTEM
22AM_INIT_AUTOMAKE(no-exeext) 22AM_INIT_AUTOMAKE(no-exeext)
@@ -35,11 +35,9 @@ AC_HEADER_STDC
35AC_HEADER_DIRENT 35AC_HEADER_DIRENT
36AC_HEADER_SYS_WAIT 36AC_HEADER_SYS_WAIT
37AC_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) 37AC_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)
38AC_SUBST(INCLUDES) 38AC_CHECK_HEADER(pcap.h,:,
39AC_CHECK_HEADERS(netinet/if_ether.h netinet/ip_var.h, 39 [AC_MSG_ERROR([Required header pcap.h not found])])
40 [], 40
41 [INCLUDES=-I'$(top_srcdir)/libpcap/linux-include'; break])
42
43dnl Checks for typedefs, structures, and compiler characteristics. 41dnl Checks for typedefs, structures, and compiler characteristics.
44AC_C_CONST 42AC_C_CONST
45AC_C_INLINE 43AC_C_INLINE
@@ -53,6 +51,9 @@ AC_STRUCT_TM
53dnl Check for libraries 51dnl Check for libraries
54AC_CHECK_LIB(socket, main) 52AC_CHECK_LIB(socket, main)
55AC_CHECK_LIB(nsl, main) 53AC_CHECK_LIB(nsl, main)
54AC_CHECK_LIB(pcap, pcap_init,
55 [LIBS="-lpcap $LIBS"],
56 [AC_MSG_ERROR([Required library libpcap not found])])
56 57
57dnl Checks for library functions. 58dnl Checks for library functions.
58AC_PROG_GCC_TRADITIONAL 59AC_PROG_GCC_TRADITIONAL
@@ -97,142 +98,23 @@ extern char *program_invocation_name;
97#endif]) 98#endif])
98fi 99fi
99 100
100dnl libpcap stuff
101dnl All the stuff below has been shamelessly stolen from libpcap-0.4
102dnl configure.in
103dnl
104dnl Not all versions of test support -c (character special) but it's a
105dnl better way of testing since the device might be protected. So we
106dnl check in our normal order using -r and then check the for the /dev
107dnl guys again using -c.
108dnl
109AC_SUBST(V_PCAP)
110AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
111AC_MSG_CHECKING(packet capture type)
112if test ! -z "$with_pcap" ; then
113 V_PCAP="$withval"
114elif test -r /dev/bpf0 ; then
115 V_PCAP=bpf
116elif test -r /usr/include/net/pfilt.h ; then
117 V_PCAP=pf
118elif test -r /dev/enet ; then
119 V_PCAP=enet
120elif test -r /dev/nit ; then
121 V_PCAP=snit
122elif test -r /usr/include/sys/net/nit.h ; then
123 V_PCAP=nit
124elif test -r /usr/include/net/raw.h ; then
125 V_PCAP=snoop
126elif test -r /usr/include/sys/dlpi.h ; then
127 V_PCAP=dlpi
128elif test -r /usr/include/linux/socket.h ; then
129 V_PCAP=linux
130 elif test -c /dev/bpf0 ; then # check again in case not readable
131 V_PCAP=bpf
132 elif test -c /dev/enet ; then # check again in case not readable
133 V_PCAP=enet
134 elif test -c /dev/nit ; then # check again in case not readable
135 V_PCAP=snit
136else
137 V_PCAP=null
138fi
139AC_MSG_RESULT($V_PCAP)
140
141case "$V_PCAP" in
142
143dlpi)
144 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
145 AC_MSG_CHECKING(for /dev/dlpi device)
146 if test -c /dev/dlpi ; then
147 AC_MSG_RESULT(yes)
148 AC_DEFINE(HAVE_DEV_DLPI,1,[Define this if you have /dev/dlpi])
149 else
150 AC_MSG_RESULT(no)
151 dir="/dev/dlpi"
152 AC_MSG_CHECKING(for $dir directory)
153 if test -d $dir ; then
154 AC_MSG_RESULT(yes)
155 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir",
156 [Path to pcap device])
157 else
158 AC_MSG_RESULT(no)
159 fi
160 fi
161 ;;
162
163linux)
164 AC_CHECK_HEADERS(net/if_arp.h)
165 AC_MSG_CHECKING(Linux kernel version)
166 AC_CACHE_VAL(ac_cv_linux_vers,
167 ac_cv_linux_vers=`uname -r 2>&1 | \
168 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
169 AC_MSG_RESULT($ac_cv_linux_vers)
170 if test $ac_cv_linux_vers -lt 2 ; then
171 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
172 fi
173 ;;
174
175null)
176 AC_MSG_WARN(cannot determine packet capture interface)
177 AC_MSG_WARN((see the INSTALL doc for more info))
178 ;;
179
180esac
181
182case "$target_os" in
183
184aix*)
185 AC_DEFINE(_SUN,1,[workarounds to enable certain features])
186 ;;
187
188hpux9*)
189 AC_DEFINE(HAVE_HPUX9,1,[Define this if we are on a HP-UX 9 system])
190 ;;
191
192hpux10.0*)
193 ;;
194
195hpux10.1*)
196 ;;
197
198hpux*)
199 dnl HPUX 10.20 and above is similar to HPUX 9...
200 AC_DEFINE(HAVE_HPUX10_20,1,[Define this if we are on a HP-UX 10.20 system])
201 ;;
202
203sinix*)
204 AC_MSG_CHECKING(if SINIX compiler defines sinix)
205 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
206 AC_TRY_COMPILE(
207 [],
208 [int i = sinix;],
209 ac_cv_cc_sinix_defined=yes,
210 ac_cv_cc_sinix_defined=no))
211 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
212 if test $ac_cv_cc_sinix_defined = no ; then
213 AC_DEFINE(sinix,1,[Define this if we are on a sinix system])
214 fi
215 ;;
216
217solaris*)
218 AC_DEFINE(HAVE_SOLARIS,1,[Define this if we are on a Solaris])
219 ;;
220
221linux*)
222 V_INCLS="$V_INCLS -Ilinux-include"
223 ;;
224esac
225
226AC_MSG_CHECKING(for log facility) 101AC_MSG_CHECKING(for log facility)
227log_facility="LOG_DAEMON" 102LOG_FACILITY="LOG_DAEMON"
228AC_ARG_WITH(log-facility, 103AC_ARG_VAR([LOG_FACILITY],
229 [ --with-log-facility=facility enable logging to the given facility], 104 [Default syslog facility])
230 AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval, 105if test -n "$LOG_FACILITY"; then
231 log_facility=$withval)) 106 logfacility=`echo $LOG_FACILITY | tr a-z A-Z`
232AC_DEFINE_UNQUOTED(LOGFACILITY, $log_facility, 107 case $logfacility in
108 USER|DAEMON|AUTH|AUTHPRIV|MAIL|CRON|LOCAL[[0-7]])
109 LOG_FACILITY=LOG_$logfacility;;
110 LOG_USER|LOG_DAEMON|LOG_AUTH|LOG_AUTHPRIV|LOG_MAIL|LOG_CRON|LOG_LOCAL[[0-7]])
111 LOG_FACILITY=$logfacility;;
112 *) AC_MSG_ERROR([Invalid value of LOG_FACILITY]);;
113 esac
114 fi
115AC_DEFINE_UNQUOTED(LOGFACILITY, $LOG_FACILITY,
233 [The syslog facility to be used for diagnostics]) 116 [The syslog facility to be used for diagnostics])
234AC_MSG_RESULT($log_facility) 117AC_MSG_RESULT($LOG_FACILITY)
235
236 118
237AC_OUTPUT(libpcap/Makefile lib/Makefile src/Makefile m4/Makefile Makefile) 119AC_OUTPUT(lib/Makefile src/Makefile m4/Makefile Makefile)
238 120
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
2ipacct_SOURCES = main.c run.c utils.c iputil.c bpf_dump.c cons_raw.c \ 2ipacct_SOURCES = main.c run.c utils.c iputil.c bpf_dump.c cons_raw.c \
3 cons_ether.c cons_ppp.c cons_ip.c account.c report.c \ 3 cons_ether.c cons_ppp.c cons_ip.c account.c report.c \
4 config.y list.c 4 config.y list.c
5ipacct_LDADD = ../lib/libipacct.a ../libpcap/libpcap.a 5ipacct_LDADD = ../lib/libipacct.a
6noinst_HEADERS = ipacct.h report.h list.h 6noinst_HEADERS = ipacct.h report.h list.h
7INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/libpcap @INCLUDES@ 7INCLUDES = -I$(top_srcdir)/lib
8AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" 8AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
9AM_YFLAGS = -v -t \ No newline at end of file 9AM_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 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation, 15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17/* $Id: ipacct.h,v 1.6 2005/05/20 12:55:18 gray Exp $ */ 17/* $Id: ipacct.h,v 1.7 2008/07/07 14:06:30 gray Exp $ */
18#include <sys/types.h> 18#include <sys/types.h>
19#include <sys/socket.h> 19#include <sys/socket.h>
20#include <netinet/in.h> 20#include <netinet/in.h>
21#include <netinet/in_systm.h> 21#include <netinet/in_systm.h>
22#include <netinet/ip.h> 22#include <netinet/ip.h>
23#include <netinet/ip_var.h>
24#include <netinet/udp.h> 23#include <netinet/udp.h>
25/*#include <netinet/udp_var.h>*/
26#include <net/if.h> 24#include <net/if.h>
27#include <netinet/if_ether.h> 25#include <netinet/if_ether.h>
28#include <pcap.h> 26#include <pcap.h>
diff --git a/src/main.c b/src/main.c
index 6c72c38..9ad3d7e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17/* $Id: main.c,v 1.10 2008/07/07 13:27:02 gray Exp $ */ 17/* $Id: main.c,v 1.11 2008/07/07 14:06:30 gray Exp $ */
18#if defined(HAVE_CONFIG_H) 18#if defined(HAVE_CONFIG_H)
19# include <config.h> 19# include <config.h>
20#endif 20#endif
@@ -35,7 +35,6 @@
35#include <netinet/tcp.h> 35#include <netinet/tcp.h>
36#include <getopt.h> 36#include <getopt.h>
37#include <pcap.h> 37#include <pcap.h>
38#include <pcap-int.h>
39#include <argp.h> 38#include <argp.h>
40#include <ipacct.h> 39#include <ipacct.h>
41 40
@@ -338,9 +337,6 @@ main(argc, argv)
338 if (!(callback = lookup_pcap_callback(type = pcap_datalink(pcap)))) 337 if (!(callback = lookup_pcap_callback(type = pcap_datalink(pcap))))
339 die(1, "unknown data link type 0x%x", type); 338 die(1, "unknown data link type 0x%x", type);
340 339
341 if (pcap->fd < 0)
342 die(1, "can't listen to %d", pcap->fd);
343
344 start_time = time(NULL); 340 start_time = time(NULL);
345 if (ttw) 341 if (ttw)
346 slice_interval = ttw; 342 slice_interval = ttw;
diff --git a/src/run.c b/src/run.c
index 2a58ec5..b9c5356 100644
--- a/src/run.c
+++ b/src/run.c
@@ -14,7 +14,7 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17/* $Id: run.c,v 1.1 2001/05/31 13:40:56 gray Exp $ */ 17/* $Id: run.c,v 1.2 2008/07/07 14:06:30 gray Exp $ */
18#if defined(HAVE_CONFIG_H) 18#if defined(HAVE_CONFIG_H)
19# include <config.h> 19# include <config.h>
20#endif 20#endif
@@ -25,7 +25,6 @@
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/time.h> 26#include <sys/time.h>
27#include <pcap.h> 27#include <pcap.h>
28#include <pcap-int.h>
29#include <netinet/in.h> 28#include <netinet/in.h>
30#include <string.h> 29#include <string.h>
31#include <errno.h> 30#include <errno.h>
@@ -62,7 +61,7 @@ run(p, callback)
62 struct timeval wait; 61 struct timeval wait;
63 int dumped = 0; 62 int dumped = 0;
64 63
65 pfd = p->fd; 64 pfd = pcap_fileno(p);
66 65
67 start = time(NULL); 66 start = time(NULL);
68 67

Return to:

Send suggestions and report system problems to the System administrator.