summaryrefslogtreecommitdiffstats
path: root/ulogd
diff options
context:
space:
mode:
authorlaforge <laforge>2000-11-20 11:43:22 +0000
committerlaforge <laforge>2000-11-20 11:43:22 +0000
commitc7d5ddfadc507d1cc9811229f938abe8c8004c0d (patch)
tree12125bd631ef4162c4e5eddce2e2c9929c6c5b9f /ulogd
parent58ee76c3d9db7c2b12f8b504415917afdd6abec0 (diff)
huge reorganization for 0.9
- added hashtables everywhere - no more dynamic allocation for each packet - mysql output plugin - more keys in ulogd_BASE - moved libipulog into ulogd directory - introduced autoconf
Diffstat (limited to 'ulogd')
-rw-r--r--ulogd/COPYING340
-rw-r--r--ulogd/Makefile.in38
-rw-r--r--ulogd/README41
-rw-r--r--ulogd/Rules.make.in24
-rw-r--r--ulogd/conffile/Makefile.in16
-rw-r--r--ulogd/conffile/conffile.c (renamed from ulogd/conffile.c)11
-rwxr-xr-xulogd/configure1822
-rw-r--r--ulogd/configure.in26
-rw-r--r--ulogd/doc/Makefile.in46
-rw-r--r--ulogd/doc/mysql.table55
-rw-r--r--ulogd/doc/ulogd.sgml202
-rw-r--r--ulogd/extensions/Makefile.in32
-rw-r--r--ulogd/extensions/ulogd_BASE.c141
-rw-r--r--ulogd/extensions/ulogd_LOGEMU.c38
-rw-r--r--ulogd/extensions/ulogd_MYSQL.c298
-rw-r--r--ulogd/extensions/ulogd_OPRINT.c27
-rw-r--r--ulogd/extensions/ulogd_PWSNIFF.c20
-rw-r--r--ulogd/include/ulogd/conffile.h (renamed from ulogd/conffile.h)13
-rw-r--r--ulogd/include/ulogd/ulogd.h42
-rwxr-xr-xulogd/install-sh251
-rw-r--r--ulogd/libipulog.old/Makefile.in19
-rw-r--r--ulogd/libipulog.old/include/libipulog/libipulog.h30
-rw-r--r--ulogd/libipulog.old/libipulog.c207
-rw-r--r--ulogd/libipulog.old/ulog_test.c83
-rw-r--r--ulogd/libipulog/Makefile.in19
-rw-r--r--ulogd/ulogd.c257
-rw-r--r--ulogd/ulogd.conf20
27 files changed, 3871 insertions, 247 deletions
diff --git a/ulogd/COPYING b/ulogd/COPYING
new file mode 100644
index 0000000..eeb586b
--- /dev/null
+++ b/ulogd/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ulogd/Makefile.in b/ulogd/Makefile.in
new file mode 100644
index 0000000..54a8416
--- /dev/null
+++ b/ulogd/Makefile.in
@@ -0,0 +1,38 @@
+#
+
+include @top_srcdir@/Rules.make
+CFLAGS+=-I@top_srcdir@/libipulog/include -I@top_srcdir@/conffile
+
+SUBDIRS=conffile libipulog extensions doc
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+sysconfdir=@sysconfdir@
+
+# Normally You should not need to change anything below
+
+all: recurse ulogd
+
+recurse:
+ @for d in $(SUBDIRS); do if ! make -C $$d; then exit 1; fi; done
+
+ulogd: ulogd.c $(LIBIPULOG) ulogd.h conffile/conffile.o $(LIBIPULOG)/libipulog.a
+ $(CC) $(CFLAGS) -rdynamic $(LIBS) $< conffile/conffile.o $(LIBIPULOG)/libipulog.a -o $@
+
+clean:
+# rm -f ulogd *.o extensions/*.o extensions/*.so conffile/*.o
+ rm -f ulogd ulogd.o
+ @for d in $(SUBDIRS); do if ! make -C $$d $@; then exit 1; fi; done
+
+distclean: clean
+ @for d in $(SUBDIRS); do if ! make -C $$d $@; then exit 1; fi; done
+ rm -f Makefile config.cache config.log config.status Rules.make
+
+install: all
+ @INSTALL@ -m 755 -d @libdir@/ulogd
+ @INSTALL@ -m 644 extensions/*.so @libdir@/ulogd
+ @INSTALL@ -m 755 ulogd @sbindir@/ulogd
+ @INSTALL@ -m 600 ulogd.conf @sysconfdir@/ulogd.conf
+
+doc:
+ $(MAKE) -C $@
diff --git a/ulogd/README b/ulogd/README
deleted file mode 100644
index 9c0f251..0000000
--- a/ulogd/README
+++ /dev/null
@@ -1,41 +0,0 @@
-===> CONECEPT
-
-I want to write a flexible, almost universal logging daemon for my netfilter
-ULOG target. It is not optimized in any way, the goal is to keep as simple as possible. These are my thoughts about how the architecture which is most capable of doing that:
-
-1. Interpreter lugins
-
-It should be possible to add plugins / runtime modules for new protocols, etc.
-For example the standard logging daemon provides source-ip, dest-ip,
-source-port, dest-port, etc. Logging for variuos other protocols (GRE,
-IPsec, ...) may be implemented as modules.
-
-2. Output plugins
-... describe how and where to put the information gained by logging plugins.
-The easiest way is to build a line per packet and fprint it to a file.
-Some people might want to log into a SQL database or want an output
-conforming to the intrusion detection systems communication draft from the
-ietf.
-
-
-===> DETAILS
-
-The major clue is providing a framework which is as flexible as possible.
-Nobody knows what strange network protocols are out there :) Flexibility
-depends on the communication between the output of the logging plugins
-and input of the output plugins.
-
-Rusty advised me to use some kind of type-key-value triples, but I think
-this is the total overkill and is too complicated for me to implement it
-in a reasonable short period of time. (3 hours later) Hmm... Rusty finally
-convinced me to use linked lists of type-key-value triples - and it wasn't
-that difficult.
-
-===> INSTALLATION
-
-Just copy the plugins into /usr/local/lib/ulogd and the ulogd to wherever
-You want it to be.
-
-===> QUESTIONS / COMMENTS
-
-Just drop me a note to laforge@gnumonks.org
diff --git a/ulogd/Rules.make.in b/ulogd/Rules.make.in
new file mode 100644
index 0000000..6c40d98
--- /dev/null
+++ b/ulogd/Rules.make.in
@@ -0,0 +1,24 @@
+#
+
+CC=@CC@
+CFLAGS=@CFLAGS@ @CPPFLAGS@
+CFLAGS+=$(INCIPULOG) $(INCCONFFILE)
+#CFLAGS+=@DEFS@
+#CFLAGS+=-g -DDEBUG -DDEBUG_MYSQL
+
+LIBS=@LIBS@
+
+
+# Path of libipulog (from iptables)
+LIBIPULOG=@top_srcdir@/libipulog
+#INCIPULOG=-I@top_srcdir@/libipulog/include
+
+#INCCONFFILE=-I@top_srcdir@/conffile
+
+# Names of the plugins to be compiled
+ULOGD_SL:=BASE OPRINT PWSNIFF LOGEMU
+
+# mysql output support
+ULOGD_SL+=MYSQL
+MYSQL_CFLAGS=
+MYSQL_LDFLAGS=-L/usr/lib/mysql -lmysqlclient
diff --git a/ulogd/conffile/Makefile.in b/ulogd/conffile/Makefile.in
new file mode 100644
index 0000000..b91723e
--- /dev/null
+++ b/ulogd/conffile/Makefile.in
@@ -0,0 +1,16 @@
+#
+
+include @top_srcdir@/Rules.make
+
+# Normally You should not need to change anything below
+
+all: conffile.o
+
+conffile.o: conffile.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -f conffile.o
+
+distclean:
+ rm -f Makefile
diff --git a/ulogd/conffile.c b/ulogd/conffile/conffile.c
index 04f54f2..d4efc78 100644
--- a/ulogd/conffile.c
+++ b/ulogd/conffile/conffile.c
@@ -1,7 +1,8 @@
/* config file parser functions
+ *
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
*
- * $Id: conffile.c,v 1.6 2000/09/22 06:54:33 laforge Exp $
+ * $Id: conffile.c,v 1.7 2000/11/16 17:20:52 laforge Exp $
*
* This code is distributed under the terms of GNU GPL */
@@ -16,12 +17,16 @@
#define DEBUGC(format, args...)
#endif
+/* linked list of all registered configuration directives */
static config_entry_t *config = NULL;
+/* points to config entry with error */
config_entry_t *config_errce = NULL;
+/* Filename of the config file */
static char *fname = NULL;
+/* the the next word in string */
static char *get_word(const char *string)
{
int len;
@@ -49,6 +54,7 @@ static char *get_word(const char *string)
return word;
}
+/* do we have a config directive for this name */
static int config_iskey(char *name)
{
config_entry_t *ce;
@@ -65,6 +71,7 @@ static int config_iskey(char *name)
* PUBLIC INTERFACE
***********************************************************************/
+/* register linked list of config directives with us */
int config_register_key(config_entry_t *ce)
{
config_entry_t *myentry;
@@ -81,6 +88,7 @@ int config_register_key(config_entry_t *ce)
return 0;
}
+/* register config file with us */
int config_register_file(const char *file)
{
/* FIXME: stat of file */
@@ -96,6 +104,7 @@ int config_register_file(const char *file)
return 0;
}
+/* parse config file */
int config_parse_file(int final)
{
FILE *cfile;
diff --git a/ulogd/configure b/ulogd/configure
new file mode 100755
index 0000000..290272d
--- /dev/null
+++ b/ulogd/configure
@@ -0,0 +1,1822 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=ulogd.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:527: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:556: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:586: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:637: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:669: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 680 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:711: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:716: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:744: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:806: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:860: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 868 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-ldl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:912: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 917 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:950: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldir $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 958 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -ldir"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:991: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lx $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 999 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -lx"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1033: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1048 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1065 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1082 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1113: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1118 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1143 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1161 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1182 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+for ac_hdr in fcntl.h unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1220: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1225 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1258: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1263 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1333: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1338 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:1366: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1371 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_tm=time.h
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+ cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for vprintf""... $ac_c" 1>&6
+echo "configure:1401: checking for vprintf" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1406 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vprintf(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char vprintf();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_vprintf) || defined (__stub___vprintf)
+choke me
+#else
+vprintf();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vprintf=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_vprintf=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_VPRINTF 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test "$ac_cv_func_vprintf" != yes; then
+echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
+echo "configure:1453: checking for _doprnt" >&5
+if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1458 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+_doprnt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func__doprnt=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func__doprnt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_DOPRNT 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+for ac_func in socket strerror
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1508: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1513 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "extensions/Makefile doc/Makefile conffile/Makefile libipulog/Makefile Makefile Rules.make" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"extensions/Makefile doc/Makefile conffile/Makefile libipulog/Makefile Makefile Rules.make"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/ulogd/configure.in b/ulogd/configure.in
new file mode 100644
index 0000000..e37c4b9
--- /dev/null
+++ b/ulogd/configure.in
@@ -0,0 +1,26 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(ulogd.c)
+
+dnl Checks for programs.
+AC_PROG_MAKE_SET
+AC_PROG_CC
+AC_PROG_INSTALL
+
+dnl Checks for libraries.
+AC_CHECK_LIB(dl, dlopen)
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+
+dnl Checks for library functions.
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS(socket strerror)
+
+AC_OUTPUT(extensions/Makefile doc/Makefile conffile/Makefile libipulog/Makefile Makefile Rules.make)
diff --git a/ulogd/doc/Makefile.in b/ulogd/doc/Makefile.in
new file mode 100644
index 0000000..2c8fbca
--- /dev/null
+++ b/ulogd/doc/Makefile.in
@@ -0,0 +1,46 @@
+#! /usr/bin/make
+
+LANG_DIRS:=
+
+HOWTOS:=$(wildcard *.sgml)
+HOWTOS+=$(foreach dir, $(LANG_DIRS), $(wildcard $(dir)/*.sgml))
+
+TXT_HOWTOS:=$(HOWTOS:.sgml=.txt)
+HTML_HOWTOS:=$(HOWTOS:.sgml=.html)
+PSA4_HOWTOS:=$(HOWTOS:.sgml=.a4.ps)
+PSUS_HOWTOS:=$(HOWTOS:.sgml=.letter.ps)
+
+HOWTO_FLAGS_it/=-c latin -l it
+HOWTO_FLAGS_fr/=-c latin -l fr
+
+interesting_howtos: $(TXT_HOWTOS) $(PSA4_HOWTOS)
+
+HOWTOs: $(TXT_HOWTOS) $(HTML_HOWTOS) $(PSA4_HOWTOS) $(PSUS_HOWTOS)
+
+# Remake all if Makefile changes.
+$(TXT_HOWTOS) $(HTML_HOWTOS) $(PSA4_HOWTOS) $(PSUS_HOWTOS): Makefile
+
+# Stupid sgml2* tools strip dirnames for output files. 8(
+%.txt: %.sgml
+ @echo Making $@: && cd `dirname $<` && sgml2txt --filter $(HOWTO_FLAGS_$(dir $<)) `basename $<` 2>&1 | sed "s?^<standard input>:\([0-9]*\):[^ ]* ?$<:\1:?"
+
+%.a4.dvi: %.sgml
+ @echo Making $@: && cd `dirname $<` && sgml2latex --papersize=a4 --output=dvi $(HOWTO_FLAGS_$(dir $<)) `basename $<` 2>&1 | sed "s?^<standard input>:\([0-9]*\):[^ ]* ?$<:\1:?" && mv `basename $*.dvi` `basename $*.a4.dvi`
+
+%.a4.ps: %.a4.dvi
+ @dvips -t a4 -o $@ $<
+
+%.letter.dvi: %.sgml
+ @echo Making $@: && cd `dirname $<` && sgml2latex --papersize=letter --output=dvi $(HOWTO_FLAGS_$(dir $<)) `basename $<` 2>&1 | sed "s?^<standard input>:\([0-9]*\):[^ ]* ?$<:\1:?" && mv `basename $*.dvi` `basename $*.letter.dvi`
+
+%.letter.ps: %.letter.dvi
+ @dvips -t letter -o $@ $<
+
+%.html: %.sgml
+ @echo Making $@: && cd `dirname $<` && sgml2html $(HOWTO_FLAGS_$(dir $<)) `basename $<` 2>&1 | sed "s?^<standard input>:\([0-9]*\):[^ ]* ?$<:\1:?"
+
+clean:
+ for d in . $(LANG_DIRS); do rm -f $$d/*.html $$d/*.ps $$d/*.aux $$d/*.log $$d/*.txt $$d/*~; done
+
+distclean:
+ rm -f Makefile
diff --git a/ulogd/doc/mysql.table b/ulogd/doc/mysql.table
new file mode 100644
index 0000000..bdfee71
--- /dev/null
+++ b/ulogd/doc/mysql.table
@@ -0,0 +1,55 @@
+CREATE TABLE ulog ( id INT UNSIGNED AUTO_INCREMENT UNIQUE,
+
+ raw_mac VARCHAR(80),
+
+ oob_time_sec INT UNSIGNED,
+ oob_time_usec INT UNSIGNED,
+ oob_prefix VARCHAR(32),
+ oob_mark INT UNSIGNED,
+ oob_in VARCHAR(32),
+ oob_out VARCHAR(32),
+
+ ip_saddr INT UNSIGNED,
+ ip_daddr INT UNSIGNED,
+ ip_protocol TINYINT UNSIGNED,
+ ip_tos TINYINT UNSIGNED,
+ ip_ttl TINYINT UNSIGNED,
+ ip_totlen SMALLINT UNSIGNED,
+ ip_ihl TINYINT UNSIGNED,
+ ip_csum SMALLINT UNSIGNED,
+ ip_id SMALLINT UNSIGNED,
+ ip_fragoff SMALLINT UNSIGNED,
+
+ tcp_sport SMALLINT UNSIGNED,
+ tcp_dport SMALLINT UNSIGNED,
+ tcp_seq INT UNSIGNED,
+ tcp_ackseq INT UNSIGNED,
+ tcp_window SMALLINT UNSIGNED,
+ tcp_urg TINYINT,
+ tcp_urgp SMALLINT UNSIGNED,
+ tcp_ack TINYINT,
+ tcp_psh TINYINT,
+ tcp_rst TINYINT,
+ tcp_syn TINYINT,
+ tcp_fin TINYINT,
+
+ udp_sport SMALLINT UNSIGNED,
+ udp_dport SMALLINT UNSIGNED,
+ udp_len SMALLINT UNSIGNED,
+
+ icmp_type TINYINT UNSIGNED,
+ icmp_code TINYINT UNSIGNED,
+ icmp_echoid SMALLINT UNSIGNED,
+ icmp_echoseq SMALLINT UNSIGNED,
+ icmp_gateway INT UNSIGNED,
+ icmp_fragmtu SMALLINT UNSIGNED,
+
+ pwsniff_user VARCHAR(30),
+ pwsniff_pass VARCHAR(30),
+
+ ahesp_spi INT UNSIGNED,
+
+ KEY index_id (id)
+ );
+
+
diff --git a/ulogd/doc/ulogd.sgml b/ulogd/doc/ulogd.sgml
new file mode 100644
index 0000000..26479f0
--- /dev/null
+++ b/ulogd/doc/ulogd.sgml
@@ -0,0 +1,202 @@
+<!doctype linuxdoc system>
+
+<!-- $Id$ -->
+
+<article>
+
+<title>ULOGD - the Userspace Logging Daemon</title>
+<author>Harald Welte &lt;laforge@gnumonks.org&gt</author>
+<date>Revision $Revision$, $Date$</date>
+
+<abstract>
+This is the documentation for <tt>ulogd</tt>, the Userspace logging daemon.
+ulogd makes use of the Linux 2.4 firewalling subsystem (netfilter) and the
+ULOG target for netfilter.
+</abstract>
+
+<toc>
+
+<sect>DESIGN
+
+<sect1>CONECEPT
+<p>
+I want to provide a flexible, almost universal logging daemon for my netfilter
+ULOG target. It is not optimized in any way, the goal is to keep as simple as
+possible. These are my thoughts about how the architecture which is most
+capable of doing that:
+<p>
+<descrip>
+<tag>Interpreter lugins</tag>
+It should be possible to add plugins / runtime modules for new protocols, etc.
+For example the standard logging daemon provides source-ip, dest-ip,
+source-port, dest-port, etc. Logging for variuos other protocols (GRE,
+IPsec, ...) may be implemented as modules.
+
+<tag>Output plugins</tag>
+... describe how and where to put the information gained by logging plugins.
+The easiest way is to build a line per packet and fprint it to a file.
+Some people might want to log into a SQL database or want an output
+conforming to the intrusion detection systems communication draft from the
+IETF.
+
+</descrip>
+
+<sect1>DETAILS
+<p>
+The major clue is providing a framework which is as flexible as possible.
+Nobody knows what strange network protocols are out there :) Flexibility
+depends on the communication between the output of the logging plugins
+and input of the output plugins.
+<p>
+Rusty advised me to use some kind of type-key-value triples, but I think
+this is the total overkill and is too complicated for me to implement it
+in a reasonable short period of time. (3 hours later) Hmm... Rusty finally
+convinced me to use linked lists of type-key-value triples - and it wasn't
+that difficult.
+<p>
+Another issue is, of course, performance. Up to ulogd 0.3, ulogd did several
+linked list iterations and about 30 malloc() calls _per packet_. This
+changed with the new 0.9 revision:
+<itemize>
+<item>Not a single dynamic allocation in the core during runtime.
+Everything is pre-allocated at start of ulogd to provide the highest
+possible throughput.
+<item>Hash tables in addition to the linked lists. Linked lists are only
+traversed if we really want to access each element of the list.
+</itemize>
+
+<sect>INSTALLATION
+<p>
+<sect1>Linux kernel
+<p>
+First you will need a recent 2.4.x kernel. At the time this document was
+written, 2.4.0-test11-pre5 was the latest development version. Ulogd should
+work with all kernels &gt;= 2.4.0-test4.
+
+<sect1>netfilter / iptables
+<p>
+In addition you need the latest iptables package, or even better: the latest
+CVS snapshot. A description how to obtain this is provided on the netfilter
+homepage <URL URL="http://netfilter.kernelnotes.org">.
+<p>
+ulogd is based on a special netfilter extension, called the netfilter ULOG
+target module. You have to patch this extension into your kernel, as it
+has not been integrated into the main kernel yet. To make this as easy
+as possible, netfilter provides the 'patch-o-matic' subsystem.
+<p>
+To run patch-o-matic, just type
+<tscreen><verb>
+make patch-o-matic
+</verb></tscreen>
+in the userspace directory of netfilter CVS.
+
+<sect1>ulogd
+<sect2>Recompiling the source
+<p>
+Download the ulogd package from <URL URL="http://www.gnumonks.org/ftp/pub/netfilter"> and
+untar it.
+<p>
+Run './configure' and 'make install'.
+<p>
+Copy the configuration file 'ulogd.conf' to /etc
+
+<sect2>Using a precompiled package
+<p>
+I also provide redhat-6.2 and redhat-7.0 RPM's, available at <URL URL="http://www.gnumonks.org/ftp/pub/rpms/redhat-7.0/RPMS/i386"> and <URL URL="http://www.gnumonks.org/ftp/pub/rpms/redhat-6.2/RPMS/i386">.
+<p>
+Just download the package and do the usual 'rpm -i &lt;file&gt;'.
+
+<sect>Configuration
+<sect1>netfilter
+<p>
+Just add rules using the ULOG target to your firewalling chain. A very basic
+example:
+<tscreen><verb>
+iptables -A FORWARD -j ULOG --ulog-nlgroup 32 --prefix foo
+</verb></tscreen>
+<p>
+Of course you can combine the ULOG target with the different netfilter match modules.
+For a more detailed description, have a look at the netfilter HOWTO's, available on
+the netfilter homepage.
+
+<sect1>ulogd
+<p>
+All configurable parameters of ulogd are in the configfile '/etc/ulogd.conf'
+<p>
+The following configuration parameters are available:
+<descrip>
+<tag>nlgroup</tag>
+The netlink multicast group, which ulgogd should bind to. This is the same as given with the '--ulog-nlgroup' option to iptables.
+<tag>logfile</tag>
+The main logfile, where ulogd reports any errors, warnings and other unexpected
+conditions.
+<tag>loglevel</tag>
+This specifies, how verbose the logging to logfile is. Currently defined loglevels are: 1=debug information, 3=informational messages, 5=noticable exceptional conditions, 7=error conditions, 8=fatal errors, program abort.
+<tag>plugin</tag>
+This option is followed by a filename of a ulogd plugin, which ulogd shold load upon initialization. This option may appear more than once.
+</descrip>
+
+<sect>Available plugins
+<p>
+ulogd comes with the following plugins:
+<descrip>
+<tag>ulogd_BASE.so</tag>
+Basic interpreter plugin for nfmark, timestamp, mac address, ip header, tcp header, udp header, icmp header, ah/esp header.
+<tag>ulogd_PWSNIFF.so</tag>
+Example interpreter plugin to log plaintext passwords as used with FTP and POP3. Don't blame me for writing this plugin! The protocols are inherently insecure, and there are a lot of other tools for sniffing passwords... it's just an example.
+<tag>ulogd_OPRINT.so</tag>
+A very simple output module, dumping all packets in the format
+<tscreen><verb>
+===>PACKET BOUNDARY
+key=value
+key=value
+...
+===>PACKET BOUNDARY
+...
+</verb></tscreen>
+to a file.
+<p>The module defines the following configuration directives:
+<descrip>
+<tag>dumpfile</tag>
+The filename where it should log to. The default is <tt>/var/log/ulogd.pktlog</tt>
+</descrip>
+
+<tag>ulogd_LOGEMU.so</tag>
+An output module which tries to emulate the old syslog-based LOG targed as far as possible. Logging is done to a textfile instead of syslog, though.
+<p>
+The module defines the following configuration directives:
+<descrip>
+<tag>syslogfile</tag>The filename where it should log to. The default is <tt>/var/log/ulogd.syslogemu</tt>
+</descrip>
+
+<tag>ulogd_MYSQL.so</tag>
+An output plugin for logging into a mysql database. This is only compiled if you have the mysql libraries installed, and the configure script was able to detect them. (FIXME: how to do this)
+<p>
+The plugin automagically inserts the data into the configured table; It connects to mysql during the startup phase of ulogd and obtains a list of the columns in the table. Then it tries to resolve the column names against keys of interpreter plugins. This way you can easly select which information you want to log - just by the layout of the table.
+<p>
+If, for example, your table contains a field called 'ip_saddr', ulogd will resolve this against the key 'ip.saddr' and put the ip address as 32bit unsigned integer into the table.
+<p>
+You may want to have a look at the file '<tt>doc/mysql.table</tt>' as an example table including fields to log all keys from ulogd_BASE.so. Just delete the fields you are not interested in, and create the table.
+<p>
+The module defines the following configuration directives:
+<descrip>
+<tag>mysqltable</tag>
+Name of the table to which ulogd should log
+<tag>mysqldb</tag>
+Name of the mysql database
+<tag>mysqlhost</tag>
+Name of the mysql database host
+<tag>mysqluser</tag>
+Name of the mysql user
+<tag>mysqlpass</tag>
+Password for mysql
+</descrip>
+
+</descrip>
+<sect> QUESTIONS / COMMENTS
+<p>
+All comments / questions / ... are appreciated.
+<p>
+Just drop me a note to laforge@gnumonks.org
+
+</article>
diff --git a/ulogd/extensions/Makefile.in b/ulogd/extensions/Makefile.in
new file mode 100644
index 0000000..bb185b1
--- /dev/null
+++ b/ulogd/extensions/Makefile.in
@@ -0,0 +1,32 @@
+#
+
+# Normally You should not need to change anything below
+#
+include @top_srcdir@/Rules.make
+
+CFLAGS+=-I@top_srcdir@ -I@top_srcdir@/libipulog/include -I@top_srcdir@/conffile
+SH_CFLAGS:=$(CFLAGS) -fPIC
+
+SHARED_LIBS+=$(foreach T,$(ULOGD_SL),ulogd_$(T).so)
+
+all: $(SHARED_LIBS)
+
+$(SHARED_LIBS): %.so: %_sh.o
+ ld -shared -o $@ $<
+
+%_sh.o: %.c
+ $(CC) $(SH_CFLAGS) -o $@ -c $<
+
+ulogd_MYSQL.so: ulogd_MYSQL_sh.o
+ ld -shared $(MYSQL_LDFLAGS) -o $@ $<
+
+ulogd_MYSQL_sh.o: ulogd_MYSQL.c
+ $(CC) $(MYSQL_CFLAGS) $(SH_CFLAGS) -o $@ -c $<
+
+clean:
+ rm -f $(SHARED_LIBS) *.o
+
+distclean:
+ rm -f Makefile
+
+install: all
diff --git a/ulogd/extensions/ulogd_BASE.c b/ulogd/extensions/ulogd_BASE.c
index a13d843..9d7e9b9 100644
--- a/ulogd/extensions/ulogd_BASE.c
+++ b/ulogd/extensions/ulogd_BASE.c
@@ -1,11 +1,20 @@
-/* ulogd_MAC.c, Version $Revision: 1.7 $
+/* ulogd_MAC.c, Version $Revision: 1.8 $
*
- * ulogd logging interpreter for MAC addresses, TIME, IP and TCP headers, etc.
+ * ulogd interpreter plugin for
+ * o MAC addresses
+ * o NFMARK field
+ * o TIME
+ * o Interface names
+ * o IP header
+ * o TCP header
+ * o UDP header
+ * o ICMP header
+ * o AH/ESP header
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_BASE.c,v 1.7 2000/11/16 17:20:52 laforge Exp $
+ * $Id: ulogd_BASE.c,v 1.8 2000/11/16 21:15:30 laforge Exp $
*
*/
@@ -22,7 +31,8 @@
* Raw header
***********************************************************************/
static ulog_iret_t mac_rets[1] = {
- { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_FREE, "raw.mac", NULL },
+ { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_FREE, "raw.mac",
+ { ptr: NULL } },
};
static ulog_iret_t *_interp_mac(struct ulog_interpreter *ip,
@@ -36,7 +46,7 @@ static ulog_iret_t *_interp_mac(struct ulog_interpreter *ip,
if (pkt->mac_len) {
buf = (char *) malloc(3 * pkt->mac_len + 1);
if (!buf) {
- ulogd_error("OOM!!!\n");
+ ulogd_log(ULOGD_ERROR, "OOM!!!\n");
return NULL;
}
*buf = '\0';
@@ -58,12 +68,18 @@ static ulog_iret_t *_interp_mac(struct ulog_interpreter *ip,
***********************************************************************/
static ulog_iret_t oob_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_NONE, "oob.prefix", NULL },
- { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "oob.time.sec", NULL },
- { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "oob.time.usec", NULL },
- { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "oob.mark", NULL },
- { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_NONE, "oob.in", NULL },
- { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_NONE, "oob.out", NULL },
+ { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_NONE, "oob.prefix",
+ { ptr: NULL } },
+ { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "oob.time.sec",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "oob.time.usec",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "oob.mark",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_NONE, "oob.in",
+ { ptr: NULL } },
+ { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_NONE, "oob.out",
+ { ptr: NULL } },
};
static ulog_iret_t *_interp_oob(struct ulog_interpreter *ip,
@@ -92,16 +108,26 @@ static ulog_iret_t *_interp_oob(struct ulog_interpreter *ip,
***********************************************************************/
static ulog_iret_t iphdr_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_IPADDR, ULOGD_RETF_NONE, "ip.saddr", 0 },
- { NULL, NULL, 0, ULOGD_RET_IPADDR, ULOGD_RETF_NONE, "ip.daddr", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.protocol", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.tos", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.ttl", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.totlen", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.ihl", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.csum", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.id", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.fragoff", 0 },
+ { NULL, NULL, 0, ULOGD_RET_IPADDR, ULOGD_RETF_NONE, "ip.saddr",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_IPADDR, ULOGD_RETF_NONE, "ip.daddr",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.protocol",
+ { ui8: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.tos",
+ { ui8: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.ttl",
+ { ui8: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.totlen",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ip.ihl",
+ { ui8: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.csum",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.id",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "ip.fragoff",
+ { ui16: 0 } },
};
static ulog_iret_t *_interp_iphdr(struct ulog_interpreter *ip,
@@ -138,18 +164,30 @@ static ulog_iret_t *_interp_iphdr(struct ulog_interpreter *ip,
* TCP HEADER
***********************************************************************/
static ulog_iret_t tcphdr_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.sport", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.dport", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "tcp.seq", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "tcp.ackseq", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.window", 0 },
- { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.urg", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.urgp", 0 },
- { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.ack", 0 },
- { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.psh", 0 },
- { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.rst", 0 },
- { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.syn", 0 },
- { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.fin", 0 },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.sport",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.dport",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "tcp.seq",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT32, ULOGD_RETF_NONE, "tcp.ackseq",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.window",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.urg",
+ { b: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "tcp.urgp",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.ack",
+ { b: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.psh",
+ { b: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.rst",
+ { b: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.syn",
+ { b: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_BOOL, ULOGD_RETF_NONE, "tcp.fin",
+ { b: 0 } },
};
static ulog_iret_t *_interp_tcphdr(struct ulog_interpreter *ip,
@@ -207,9 +245,12 @@ static ulog_iret_t *_interp_tcphdr(struct ulog_interpreter *ip,
* UDP HEADER
***********************************************************************/
static ulog_iret_t udphdr_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "udp.sport", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "udp.dport", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "udp.len", 0 },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "udp.sport",
+ { ui16 :0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "udp.dport",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "udp.len",
+ { ui16: 0 } },
};
static ulog_iret_t *_interp_udp(struct ulog_interpreter *ip,
@@ -238,12 +279,18 @@ static ulog_iret_t *_interp_udp(struct ulog_interpreter *ip,
***********************************************************************/
static ulog_iret_t icmphdr_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "icmp.type", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "icmp.code", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "icmp.echoid", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "icmp.echoseq", 0 },
- { NULL, NULL, 0, ULOGD_RET_IPADDR, ULOGD_RETF_NONE, "icmp.gateway", 0 },
- { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "icmp.fragmtu", 0 },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "icmp.type",
+ { ui8: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "icmp.code",
+ { ui8: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "icmp.echoid",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "icmp.echoseq",
+ { ui16: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_IPADDR, ULOGD_RETF_NONE, "icmp.gateway",
+ { ui32: 0 } },
+ { NULL, NULL, 0, ULOGD_RET_UINT16, ULOGD_RETF_NONE, "icmp.fragmtu",
+ { ui16: 0 } },
};
static ulog_iret_t *_interp_icmp(struct ulog_interpreter *ip,
@@ -290,16 +337,18 @@ static ulog_iret_t *_interp_icmp(struct ulog_interpreter *ip,
***********************************************************************/
static ulog_iret_t ahesphdr_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ahesp.spi", 0 },
+ { NULL, NULL, 0, ULOGD_RET_UINT8, ULOGD_RETF_NONE, "ahesp.spi",
+ { ui8: 0 } },
};
static ulog_iret_t *_interp_ahesp(struct ulog_interpreter *ip,
ulog_packet_msg_t *pkt)
{
- struct iphdr *iph = (struct iphdr *) pkt->payload;
+
ulog_iret_t *ret = ip->result;
- void *protoh = (u_int32_t *) (iph + iph->ihl);
#if 0
+ struct iphdr *iph = (struct iphdr *) pkt->payload;
+ void *protoh = (u_int32_t *) (iph + iph->ihl);
struct esphdr *esph = protoh;
if (iph->protocol != IPPROTO_ESP)
@@ -321,7 +370,7 @@ static ulog_interpreter_t base_ip[] = {
{ NULL, "icmp", 0, &_interp_icmp, 6, &icmphdr_rets },
{ NULL, "udp", 0, &_interp_udp, 3, &udphdr_rets },
{ NULL, "ahesp", 0, &_interp_ahesp, 1, &ahesphdr_rets },
- { NULL, "", 0, NULL, 0, { NULL } },
+ { NULL, "", 0, NULL, 0, NULL },
};
void _base_reg_ip(void)
diff --git a/ulogd/extensions/ulogd_LOGEMU.c b/ulogd/extensions/ulogd_LOGEMU.c
index 086e35e..a558aba 100644
--- a/ulogd/extensions/ulogd_LOGEMU.c
+++ b/ulogd/extensions/ulogd_LOGEMU.c
@@ -1,13 +1,14 @@
-/* ulogd_LOGEMU.c, Version $Revision: 1.4 $
+/* ulogd_LOGEMU.c, Version $Revision: 1.1 $
*
* ulogd output target for syslog logging emulation
- * this target produces a file which looks the same like the syslog-entries
+ *
+ * This target produces a file which looks the same like the syslog-entries
* of the LOG target.
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_LOGEMU.c,v 1.4 2000/09/22 06:54:33 laforge Exp $
+ * $Id: ulogd_LOGEMU.c,v 1.1 2000/11/16 21:15:30 laforge Exp $
*
*/
@@ -19,6 +20,10 @@
#include "ulogd.h"
#include "conffile.h"
+#ifndef ULOGD_LOGEMU_DEFAULT
+#define ULOGD_LOGEMU_DEFAULT "/var/log/ulogd.syslogemu"
+#endif
+
#define NIPQUAD(addr) \
((unsigned char *)&addr)[0], \
((unsigned char *)&addr)[1], \
@@ -38,7 +43,7 @@ struct intr_id {
unsigned int id;
};
-#define INTR_IDS 33
+#define INTR_IDS 34
static struct intr_id intr_ids[INTR_IDS] = {
{ "oob.prefix", 0 },
{ "oob.in", 0 },
@@ -73,11 +78,10 @@ static struct intr_id intr_ids[INTR_IDS] = {
{ "icmp.echoseq", 0 },
{ "icmp.gateway", 0 },
{ "icmp.fragmtu", 0 },
- { "ah.spi", 0 },
+ { "ahesp.spi", 0 },
};
#define GET_VALUE(x) ulogd_keyh[intr_ids[x].id].interp->result[ulogd_keyh[intr_ids[x].id].offset].value
-#define IS_VALID(x) (ulogd_keyh[intr_ids[x].id].interp->result[ulogd_keyh[intr_ids[x].id].offset].flags & ULOGD_RETF_VALID)
int _output_logemu(ulog_iret_t *res)
{
@@ -185,6 +189,7 @@ int _output_logemu(ulog_iret_t *res)
fprintf(of,"\n");
return 0;
}
+
/* get all key id's for the keys we are intrested in */
static int get_ids(void)
{
@@ -195,7 +200,9 @@ static int get_ids(void)
cur_id = &intr_ids[i];
cur_id->id = keyh_getid(cur_id->name);
if (!cur_id->id) {
- ulogd_error("Cannot resolve keyhash id for %s\n", cur_id->name);
+ ulogd_log(ULOGD_ERROR,
+ "Cannot resolve keyhash id for %s\n",
+ cur_id->name);
return 1;
}
}
@@ -203,7 +210,7 @@ static int get_ids(void)
}
static ulog_output_t logemu_op[] = {
- { NULL, "logemu", &_output_logemu },
+ { NULL, "syslogemu", &_output_logemu },
{ NULL, "", NULL },
};
@@ -219,24 +226,25 @@ static void _logemu_reg_op(void)
static config_entry_t syslogf_ce = { NULL, "syslogfile", CONFIG_TYPE_STRING,
CONFIG_OPT_NONE, 0,
- { string: "/var/log/ulogd.syslogemu" } };
+ { string: ULOGD_LOGEMU_DEFAULT } };
void _init(void)
{
-#ifdef DEBUG_LOGEMU
- of = stdout;
-#else
+ /* FIXME: error handling */
config_register_key(&syslogf_ce);
config_parse_file(0);
+#ifdef DEBUG_LOGEMU
+ of = stdout;
+#else
of = fopen(syslogf_ce.u.string, "a");
if (!of) {
- ulogd_error("ulogd_LOGEMU: can't open syslogemu: %s\n", strerror(errno));
+ ulogd_log(ULOGD_FATAL, "can't open syslogemu: %s\n",
+ strerror(errno));
exit(2);
}
#endif
if (get_ids()) {
- ulogd_error("ulogd_LOGEMU: can't resolve all keyhash id's\n");
- exit(2);
+ ulogd_log(ULOGD_ERROR, "can't resolve all keyhash id's\n");
}
_logemu_reg_op();
diff --git a/ulogd/extensions/ulogd_MYSQL.c b/ulogd/extensions/ulogd_MYSQL.c
new file mode 100644
index 0000000..3777e26
--- /dev/null
+++ b/ulogd/extensions/ulogd_MYSQL.c
@@ -0,0 +1,298 @@
+/* ulogd_MYSQL.c, Version $Revision$
+ *
+ * ulogd output plugin for logging to a MySQL database
+ *
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
+ * This software is distributed under the terms of GNU GPL
+ *
+ * $Id$
+ *
+ **/
+
+#include <stdlib.h>
+#include <string.h>
+#include <ulogd.h>
+#include <mysql/mysql.h>
+#include "ulogd.h"
+#include "conffile.h"
+
+#ifdef DEBUG_MYSQL
+#define DEBUGP(x, args...) fprintf(stderr, x, ## args)
+#else
+#define DEBUGP(x, args...)
+#endif
+
+struct _field {
+ char name[ULOGD_MAX_KEYLEN];
+ unsigned int id;
+ struct _field *next;
+};
+
+/* the database handle we are using */
+static MYSQL *dbh;
+
+/* a linked list of the fields the table has */
+static struct _field *fields;
+
+/* buffer for our insert statement */
+static char *stmt;
+
+/* pointer to the beginning of the "VALUES" part */
+static char *stmt_val;
+
+/* pointer to current inser position in statement */
+static char *stmt_ins;
+
+/* our configuration directives */
+static config_entry_t db_ce = { NULL, "mysqldb", CONFIG_TYPE_STRING,
+ CONFIG_OPT_MANDATORY, 0,
+ { } };
+
+static config_entry_t host_ce = { &db_ce, "mysqlhost", CONFIG_TYPE_STRING,
+ CONFIG_OPT_MANDATORY, 0,
+ { } };
+
+static config_entry_t user_ce = { &host_ce, "mysqluser", CONFIG_TYPE_STRING,
+ CONFIG_OPT_MANDATORY, 0,
+ { } };
+
+static config_entry_t pass_ce = { &user_ce, "mysqlpass", CONFIG_TYPE_STRING,
+ CONFIG_OPT_MANDATORY, 0,
+ { } };
+
+static config_entry_t table_ce = { &pass_ce, "mysqltable", CONFIG_TYPE_STRING,
+ CONFIG_OPT_MANDATORY, 0,
+ { } };
+
+/* is the given string a field in our table? */
+static int is_field(const char *name)
+{
+ struct _field *f;
+
+ for (f = fields; f; f = f->next) {
+ if (!strcmp(f->name, name))
+ return 1;
+ }
+ return 0;
+}
+
+/* our main output function, called by ulogd */
+static int _mysql_output(ulog_iret_t *result)
+{
+ struct _field *f;
+ ulog_iret_t *res;
+
+ stmt_ins = stmt_val;
+
+ for (f = fields; f; f = f->next) {
+ res = keyh_getres(f->id);
+
+ if (!res) {
+ ulogd_log(ULOGD_NOTICE,
+ "no result for %s ?!?\n", f->name);
+ }
+
+ if (!res || !IS_VALID((*res))) {
+ /* no result, we have to fake something */
+ sprintf(stmt_ins, "NULL,");
+ stmt_ins = stmt + strlen(stmt);
+ continue;
+ }
+
+ switch (res->type) {
+ case ULOGD_RET_INT8:
+ sprintf(stmt_ins, "%d,", res->value.i8);
+ break;
+ case ULOGD_RET_INT16:
+ sprintf(stmt_ins, "%d,", res->value.i16);
+ break;
+ case ULOGD_RET_INT32:
+ sprintf(stmt_ins, "%d,", res->value.i32);
+ break;
+ case ULOGD_RET_INT64:
+ sprintf(stmt_ins, "%ld,", res->value.i64);
+ break;
+ case ULOGD_RET_UINT8:
+ sprintf(stmt_ins, "%u,", res->value.ui8);
+ break;
+ case ULOGD_RET_UINT16:
+ sprintf(stmt_ins, "%u,", res->value.ui16);
+ break;
+ case ULOGD_RET_IPADDR:
+ case ULOGD_RET_UINT32:
+ sprintf(stmt_ins, "%u,", res->value.ui32);
+ break;
+ case ULOGD_RET_UINT64:
+ sprintf(stmt_ins, "%lu,", res->value.ui64);
+ break;
+ case ULOGD_RET_STRING:
+ *stmt_ins++ = '\'';
+ mysql_real_escape_string(dbh, stmt_ins,
+ res->value.ptr, strlen(res->value.ptr));
+ stmt_ins = stmt + strlen(stmt);
+ sprintf(stmt_ins, "',");
+ /* sprintf(stmt_ins, "'%s',", res->value.ptr); */
+ break;
+ default:
+ ulogd_log(ULOGD_NOTICE,
+ "unknown type %d for %s\n",
+ res->type, res->key);
+ break;
+ }
+ stmt_ins = stmt + strlen(stmt);
+ }
+ *(stmt_ins - 1) = ')';
+ DEBUGP("stmt=#%s#\n", stmt);
+
+ /* now we have created our statement, insert it */
+
+ if(mysql_real_query(dbh, stmt, strlen(stmt))) {
+ ulogd_log(ULOGD_ERROR, "sql error during insert: %s\n",
+ mysql_error(dbh));
+ return 1;
+ }
+
+ return 0;
+}
+
+#define MYSQL_INSERTTEMPL "insert into X (Y) values (Z)"
+#define MYSQL_VALSIZE 100
+
+/* create the static part of our insert statement */
+static int _mysql_createstmt(void)
+{
+ struct _field *f;
+ unsigned int size;
+ char buf[ULOGD_MAX_KEYLEN];
+ char *underscore;
+
+ if (stmt) {
+ ulogd_log(ULOGD_NOTICE, "createstmt called, but stmt"
+ " already existing\n");
+ return 1;
+ }
+
+ /* caclulate the size for the insert statement */
+ size = strlen(MYSQL_INSERTTEMPL) + strlen(table_ce.u.string);
+
+ for (f = fields; f; f = f->next) {
+ /* we need space for the key and a comma, as well as
+ * enough space for the values */
+ size += strlen(f->name) + 1 + MYSQL_VALSIZE;
+ }
+
+ ulogd_log(ULOGD_DEBUG, "allocating %u bytes for statement\n", size);
+
+ stmt = (char *) malloc(size);
+
+ if (!stmt) {
+ ulogd_log(ULOGD_ERROR, "OOM!\n");
+ return 1;
+ }
+
+ sprintf(stmt, "insert into %s (", table_ce.u.string);
+ stmt_val = stmt + strlen(stmt);
+
+ for (f = fields; f; f = f->next) {
+ strncpy(buf, f->name, ULOGD_MAX_KEYLEN);
+ while (underscore = strchr(buf, '.'))
+ *underscore = '_';
+ sprintf(stmt_val, "%s,", buf);
+ stmt_val = stmt + strlen(stmt);
+ }
+ *(stmt_val - 1) = ')';
+
+ sprintf(stmt_val, " values (");
+ stmt_val = stmt + strlen(stmt);
+
+ ulogd_log(ULOGD_DEBUG, "stmt='%s'\n", stmt);
+
+ return 0;
+}
+
+/* find out which columns the table has */
+static int _mysql_get_columns(const char *table)
+{
+ MYSQL_RES *result;
+ MYSQL_FIELD *field;
+ char buf[ULOGD_MAX_KEYLEN];
+ char *underscore;
+ struct _field *f;
+ int id;
+
+ if (!dbh)
+ return 1;
+
+ result = mysql_list_fields(dbh, table, NULL);
+ if (!result)
+ return 1;
+
+ while (field = mysql_fetch_field(result)) {
+
+ /* replace all underscores with dots */
+ strncpy(buf, field->name, ULOGD_MAX_KEYLEN);
+ while (underscore = strchr(buf, '_'))
+ *underscore = '.';
+
+ DEBUGP("field '%s' found: ", buf);
+
+ if (!(id = keyh_getid(buf))) {
+ DEBUGP(" no keyid!\n");
+ continue;
+ }
+
+ DEBUGP("keyid %u\n", id);
+
+ /* prepend it to the linked list */
+ f = (struct _field *) malloc(sizeof *f);
+ if (!f) {
+ ulogd_log(ULOGD_ERROR, "OOM!\n");
+ return 1;
+ }
+ strncpy(f->name, buf, ULOGD_MAX_KEYLEN);
+ f->id = id;
+ f->next = fields;
+ fields = f;
+ }
+
+ mysql_free_result(result);
+ return 0;
+}
+
+/* make connection and select database */
+static int _mysql_open_db(char *server, char *user, char *pass, char *db)
+{
+ dbh = mysql_connect(NULL, server, user, pass);
+
+ if (!dbh)
+ return 1;
+
+ mysql_select_db(dbh, db);
+ return 0;
+}
+
+static ulog_output_t _mysql_plugin = { NULL, "mysql", &_mysql_output };
+
+void _init(void)
+{
+ /* register our configfile options here */
+ config_register_key(&table_ce);
+
+ /* have the opts parsed */
+ config_parse_file(0);
+
+ if (_mysql_open_db(host_ce.u.string, user_ce.u.string,
+ pass_ce.u.string, db_ce.u.string)) {
+ ulogd_log(ULOGD_ERROR, "can't establish database connection\n");
+ return;
+ }
+
+ /* read the fieldnames to know which values to insert */
+ if (_mysql_get_columns(table_ce.u.string)) {
+ ulogd_log(ULOGD_ERROR, "unable to get mysql columns\n");
+ return;
+ }
+ _mysql_createstmt();
+ register_output(&_mysql_plugin);
+
+}
diff --git a/ulogd/extensions/ulogd_OPRINT.c b/ulogd/extensions/ulogd_OPRINT.c
index 3fa42ed..fc00b46 100644
--- a/ulogd/extensions/ulogd_OPRINT.c
+++ b/ulogd/extensions/ulogd_OPRINT.c
@@ -1,11 +1,11 @@
-/* ulogd_MAC.c, Version $Revision: 1.4 $
+/* ulogd_MAC.c, Version $Revision: 1.5 $
*
* ulogd output target for logging to a file
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_OPRINT.c,v 1.4 2000/09/22 06:54:33 laforge Exp $
+ * $Id: ulogd_OPRINT.c,v 1.5 2000/11/16 17:20:52 laforge Exp $
*
*/
@@ -15,6 +15,10 @@
#include "ulogd.h"
#include "conffile.h"
+#ifndef ULOGD_OPRINT_DEFAULT
+#define ULOGD_OPRINT_DEFAULT "/var/log/ulogd.pktlog"
+#endif
+
#define NIPQUAD(addr) \
((unsigned char *)&addr)[0], \
((unsigned char *)&addr)[1], \
@@ -42,22 +46,14 @@ int _output_print(ulog_iret_t *res)
break;
case ULOGD_RET_BOOL:
case ULOGD_RET_INT8:
- fprintf(of, "%d\n", ret->value.i8);
- break;
case ULOGD_RET_INT16:
- fprintf(of, "%d\n", ret->value.i16);
- break;
case ULOGD_RET_INT32:
- fprintf(of, "%ld\n", ret->value.i32);
+ fprintf(of, "%d\n", ret->value.i32);
break;
case ULOGD_RET_UINT8:
- fprintf(of, "%u\n", ret->value.ui8);
- break;
case ULOGD_RET_UINT16:
- fprintf(of, "%u\n", ret->value.ui16);
- break;
case ULOGD_RET_UINT32:
- fprintf(of, "%lu\n", ret->value.ui32);
+ fprintf(of, "%u\n", ret->value.ui32);
break;
case ULOGD_RET_IPADDR:
fprintf(of, "%u.%u.%u.%u\n",
@@ -72,7 +68,7 @@ int _output_print(ulog_iret_t *res)
}
static ulog_output_t base_op[] = {
- { NULL, "print", &_output_print },
+ { NULL, "oprint", &_output_print },
{ NULL, "", NULL },
};
@@ -88,7 +84,7 @@ static void _base_reg_op(void)
static config_entry_t outf_ce = { NULL, "dumpfile", CONFIG_TYPE_STRING,
CONFIG_OPT_NONE, 0,
- { string: "/var/log/ulogd.pktlog" } };
+ { string: ULOGD_OPRINT_DEFAULT } };
void _init(void)
{
#ifdef DEBUG
@@ -99,7 +95,8 @@ void _init(void)
of = fopen(outf_ce.u.string, "a");
if (!of) {
- ulogd_error("ulogd_OPRINT: can't open PKTLOG: %s\n", strerror(errno));
+ ulogd_log(ULOGD_FATAL, "can't open PKTLOG: %s\n",
+ strerror(errno));
exit(2);
}
#endif
diff --git a/ulogd/extensions/ulogd_PWSNIFF.c b/ulogd/extensions/ulogd_PWSNIFF.c
index cc0f19e..a1e7988 100644
--- a/ulogd/extensions/ulogd_PWSNIFF.c
+++ b/ulogd/extensions/ulogd_PWSNIFF.c
@@ -1,11 +1,11 @@
-/* ulogd_PWSNIFF.c, Version $Revision: 1.2 $
+/* ulogd_PWSNIFF.c, Version $Revision: 1.3 $
*
* ulogd logging interpreter for POP3 / FTP like plaintext passwords.
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_PWSNIFF.c,v 1.2 2000/09/22 06:54:33 laforge Exp $
+ * $Id: ulogd_PWSNIFF.c,v 1.3 2000/11/16 17:20:52 laforge Exp $
*
*/
@@ -17,8 +17,8 @@
#include <linux/in.h>
#include <linux/tcp.h>
-#ifdef DEBUG
-#define DEBUGP ulogd_error
+#ifdef DEBUG_PWSNIFF
+#define DEBUGP(x) ulogd_log(ULOGD_DEBUG, x)
#else
#define DEBUGP(format, args...)
#endif
@@ -96,7 +96,7 @@ static ulog_iret_t *_interp_pwsniff(ulog_interpreter_t *ip, ulog_packet_msg_t *p
ret[0].value.ptr = (char *) malloc(len+1);
ret[0].flags |= ULOGD_RETF_VALID;
if (!ret[0].value.ptr) {
- ulogd_error("_interp_pwsniff: OOM (size=%u)\n", len);
+ ulogd_log(ULOGD_ERROR, "OOM (size=%u)\n", len);
return NULL;
}
strncpy(ret[0].value.ptr, begp, len);
@@ -106,7 +106,7 @@ static ulog_iret_t *_interp_pwsniff(ulog_interpreter_t *ip, ulog_packet_msg_t *p
ret[1].value.ptr = (char *) malloc(pw_len+1);
ret[1].flags |= ULOGD_RETF_VALID;
if (!ret[1].value.ptr){
- ulogd_error("_interp_pwsniff: OOM (size=%u)\n", pw_len);
+ ulogd_log(ULOGD_ERROR, "OOM (size=%u)\n", pw_len);
return NULL;
}
strncpy(ret[1].value.ptr, pw_begp, pw_len);
@@ -117,13 +117,15 @@ static ulog_iret_t *_interp_pwsniff(ulog_interpreter_t *ip, ulog_packet_msg_t *p
}
static ulog_iret_t pwsniff_rets[] = {
- { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_FREE, "pwsniff.user", 0 },
- { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_FREE, "pwsniff.pass", 0 },
+ { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_FREE, "pwsniff.user",
+ { ptr: NULL } },
+ { NULL, NULL, 0, ULOGD_RET_STRING, ULOGD_RETF_FREE, "pwsniff.pass",
+ { ptr: NULL } },
};
static ulog_interpreter_t base_ip[] = {
{ NULL, "pwsniff", 0, &_interp_pwsniff, 2, &pwsniff_rets },
- { NULL, "", NULL },
+ { NULL, "", 0, NULL, 0, NULL },
};
void _base_reg_ip(void)
{
diff --git a/ulogd/conffile.h b/ulogd/include/ulogd/conffile.h
index 976bd44..ba16c35 100644
--- a/ulogd/conffile.h
+++ b/ulogd/include/ulogd/conffile.h
@@ -1,7 +1,8 @@
/* config file parser functions
+ *
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
*
- * $Id: conffile.h,v 1.4 2000/09/09 21:55:46 laforge Exp $
+ * $Id: conffile.h,v 1.5 2000/09/12 14:29:37 laforge Exp $
*
* This code is distributed under the terms of GNU GPL */
@@ -40,11 +41,11 @@ enum {
#define CONFIG_OPT_MULTI 0x0002
typedef struct config_entry {
- struct config_entry *next;
- char key[CONFIG_KEY_LEN];
- u_int8_t type;
- u_int8_t options;
- u_int8_t hit;
+ struct config_entry *next; /* the next one in linked list */
+ char key[CONFIG_KEY_LEN]; /* name of config directive */
+ u_int8_t type; /* type; see above */
+ u_int8_t options; /* options; see above */
+ u_int8_t hit; /* found? */
union {
char string[CONFIG_VAL_STRING_LEN];
int value;
diff --git a/ulogd/include/ulogd/ulogd.h b/ulogd/include/ulogd/ulogd.h
index 186de9e..b3468ce 100644
--- a/ulogd/include/ulogd/ulogd.h
+++ b/ulogd/include/ulogd/ulogd.h
@@ -1,15 +1,15 @@
#ifndef _ULOGD_H
#define _ULOGD_H
-/* ulogd, Version $Revision: 1.8 $
+/* ulogd, Version $Revision: 1.9 $
*
- * first try of a logging daemon for my netfilter ULOG target
- * for the linux 2.4 netfilter subsystem.
+ * userspace logging daemon for netfilter ULOG target
+ * of the linux 2.4 netfilter subsystem.
*
- * (C) 2000 by Harald Welte <laforge@sunbeam.franken.de>
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
*
* this code is released under the terms of GNU GPL
*
- * $Id: ulogd.h,v 1.8 2000/11/16 17:20:52 laforge Exp $
+ * $Id: ulogd.h,v 1.9 2000/11/16 21:15:30 laforge Exp $
*/
#include <libipulog/libipulog.h>
@@ -49,10 +49,11 @@
/* maximum length of ulogd key */
#define ULOGD_MAX_KEYLEN 32
-#define ULOGD_DEBUG 1
-#define ULOGD_NOTICE 5
-#define ULOGD_ERROR 8
-
+#define ULOGD_DEBUG 1 /* debugging information */
+#define ULOGD_INFO 3
+#define ULOGD_NOTICE 5 /* abnormal/unexpected condition */
+#define ULOGD_ERROR 7 /* error condition, requires user action */
+#define ULOGD_FATAL 8 /* fatal, program aborted */
extern FILE *logfile;
@@ -106,9 +107,16 @@ typedef struct ulog_output {
/* name of this ouput plugin */
char name[ULOGD_MAX_KEYLEN];
/* callback function */
- int* (*output)(ulog_iret_t *ret);
+ int (*output)(ulog_iret_t *ret);
} ulog_output_t;
+/* entries of the key hash */
+struct ulogd_keyh_entry {
+ ulog_interpreter_t *interp; /* interpreter for this key */
+ unsigned int offset; /* offset within interpreter */
+ const char *name; /* name of this particular key */
+};
+
/***********************************************************************
* PUBLIC INTERFACE
***********************************************************************/
@@ -124,7 +132,6 @@ ulog_iret_t *alloc_ret(const u_int16_t type, const char*);
/* write a message to the daemons' logfile */
void ulogd_log(int level, const char *message, ...);
-
/* backwards compatibility */
#define ulogd_error(format, args...) ulogd_log(ULOGD_ERROR, format, ## args)
@@ -138,15 +145,10 @@ unsigned int keyh_getid(const char *name);
ulog_iret_t *keyh_getres(unsigned int id);
/* the key hash itself */
-struct ulogd_keyh_entry ulogd_keyh[100];
-
-/* entries of the key hash */
-struct ulogd_keyh_entry {
- ulog_interpreter_t *interp; /* interpreter for this key */
- unsigned int offset; /* offset within interpreter */
- const char *name; /* name of this particular key */
-};
+struct ulogd_keyh_entry *ulogd_keyh;
+#define IS_VALID(x) (x.flags & ULOGD_RETF_VALID)
+#define SET_VALID(x) (x.flags |= ULOGD_RETF_VALID)
-#endif
+#endif /* _ULOGD_H */
diff --git a/ulogd/install-sh b/ulogd/install-sh
new file mode 100755
index 0000000..e9de238
--- /dev/null
+++ b/ulogd/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/ulogd/libipulog.old/Makefile.in b/ulogd/libipulog.old/Makefile.in
new file mode 100644
index 0000000..a3b16cb
--- /dev/null
+++ b/ulogd/libipulog.old/Makefile.in
@@ -0,0 +1,19 @@
+#
+
+include @top_srcdir@/Rules.make
+CFLAGS+=-Iinclude
+
+libipulog.a: libipulog.o
+ ld -i $< -o $@
+
+ulog_test: ulog_test.c libipulog.a
+ $(CC) $(CFLAGS) ulog_test.c libipulog.a -o ulog_test
+
+libipulog.o: libipulog.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -f ulog_test libipulog.o libipulog.a
+
+distclean: clean
+ rm Makefile
diff --git a/ulogd/libipulog.old/include/libipulog/libipulog.h b/ulogd/libipulog.old/include/libipulog/libipulog.h
new file mode 100644
index 0000000..9f920dd
--- /dev/null
+++ b/ulogd/libipulog.old/include/libipulog/libipulog.h
@@ -0,0 +1,30 @@
+#ifndef _LIBIPULOG_H
+#define _LIBIPULOG_H
+
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <asm/types.h>
+#include <linux/netlink.h>
+#include <net/if.h>
+#include <linux/netfilter_ipv4/ipt_ULOG.h>
+
+struct ipulog_handle;
+
+u_int32_t ipulog_group2gmask(u_int32_t group);
+
+struct ipulog_handle *ipulog_create_handle(u_int32_t gmask);
+
+void ipulog_destroy_handle(struct ipulog_handle *h);
+
+ssize_t ipulog_read(struct ipulog_handle *h,
+ unsigned char *buf, size_t len, int timeout);
+
+ulog_packet_msg_t *ipulog_get_packet(const unsigned char *buf);
+
+void ipulog_perror(const char *s);
+
+#endif /* _LIBULOG_H */
diff --git a/ulogd/libipulog.old/libipulog.c b/ulogd/libipulog.old/libipulog.c
new file mode 100644
index 0000000..ddfbdcd
--- /dev/null
+++ b/ulogd/libipulog.old/libipulog.c
@@ -0,0 +1,207 @@
+/*
+ * libipulog.c, $Revision: 1.5 $
+ *
+ * netfilter ULOG userspace library.
+ *
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
+ * released under the terms of GNU GPL
+ *
+ * This library is still under development, so be aware of sudden interface
+ * changes
+ *
+ * $Id: libipulog.c,v 1.5 2000/09/22 06:57:16 laforge Exp $
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <net/if.h>
+#include <libipulog/libipulog.h>
+
+struct ipulog_handle
+{
+ int fd;
+ u_int8_t blocking;
+ struct sockaddr_nl local;
+ struct sockaddr_nl peer;
+};
+
+/* internal */
+
+enum
+{
+ IPULOG_ERR_NONE = 0,
+ IPULOG_ERR_IMPL,
+ IPULOG_ERR_HANDLE,
+ IPULOG_ERR_SOCKET,
+ IPULOG_ERR_BIND,
+ IPULOG_ERR_RECVBUF,
+ IPULOG_ERR_RECV,
+ IPULOG_ERR_NLEOF,
+ IPULOG_ERR_TRUNC,
+ IPULOG_ERR_INVGR,
+};
+
+#define IPULOG_MAXERR IPULOG_ERR_INVGR
+
+static int ipulog_errno = IPULOG_ERR_NONE;
+
+struct ipulog_errmap_t
+{
+ int errcode;
+ char *message;
+} ipulog_errmap[] =
+{
+ { IPULOG_ERR_NONE, "No error" },
+ { IPULOG_ERR_IMPL, "Not implemented yet" },
+ { IPULOG_ERR_HANDLE, "Unable to create netlink handle" },
+ { IPULOG_ERR_SOCKET, "Unable to create netlink socket" },
+ { IPULOG_ERR_BIND, "Unable to bind netlink socket" },
+ { IPULOG_ERR_RECVBUF, "Receive buffer size invalid" },
+ { IPULOG_ERR_RECV, "Receive buffer size invalid" },
+ { IPULOG_ERR_NLEOF, "Received EOF on netlink socket" },
+ { IPULOG_ERR_TRUNC, "Receive message truncated" },
+ { IPULOG_ERR_INVGR, "Invalid group specified" },
+};
+
+static ssize_t ipulog_netlink_recvfrom(const struct ipulog_handle *h,
+ unsigned char *buf, size_t len)
+{
+ int addrlen, status;
+ struct nlmsghdr *nlh;
+
+ if (len < sizeof(struct nlmsgerr)) {
+ ipulog_errno = IPULOG_ERR_RECVBUF;
+ return -1;
+ }
+ addrlen = sizeof(h->peer);
+ status = recvfrom(h->fd, buf, len, 0, (struct sockaddr *)&h->peer,
+ &addrlen);
+ if (status < 0)
+ {
+ ipulog_errno = IPULOG_ERR_RECV;
+ return status;
+ }
+ if (addrlen != sizeof (h->peer))
+ {
+ ipulog_errno = IPULOG_ERR_RECV;
+ return -1;
+ }
+ if (status == 0)
+ {
+ ipulog_errno = IPULOG_ERR_NLEOF;
+ return -1;
+ }
+ nlh = (struct nlmsghdr *)buf;
+ if (nlh->nlmsg_flags & MSG_TRUNC || nlh->nlmsg_len > status)
+ {
+ ipulog_errno = IPULOG_ERR_TRUNC;
+ return -1;
+ }
+ return status;
+}
+
+static char *ipulog_strerror(int errcode)
+{
+ if (errcode < 0 || errcode > IPULOG_MAXERR)
+ errcode = IPULOG_ERR_IMPL;
+ return ipulog_errmap[errcode].message;
+}
+
+
+/* public */
+
+/* convert a netlink group (1-32) to a group_mask suitable for create_handle */
+u_int32_t ipulog_group2gmask(u_int32_t group)
+{
+ if (group < 1 || group > 32)
+ {
+ ipulog_errno = IPULOG_ERR_INVGR;
+ return 0;
+ }
+ return (1 << (group - 1));
+}
+
+/* create a ipulog handle for the reception of packets sent to gmask */
+struct ipulog_handle *ipulog_create_handle(unsigned int gmask)
+{
+ struct ipulog_handle *h;
+ int status;
+
+ h = (struct ipulog_handle *) malloc(sizeof(struct ipulog_handle));
+ if (h == NULL)
+ {
+ ipulog_errno = IPULOG_ERR_HANDLE;
+ return NULL;
+ }
+ memset(h, 0, sizeof(struct ipulog_handle));
+ h->fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_NFLOG);
+ if (h->fd == -1)
+ {
+ ipulog_errno = IPULOG_ERR_SOCKET;
+ close(h->fd);
+ free(h);
+ return NULL;
+ }
+ memset(&h->local, 0, sizeof(struct sockaddr_nl));
+ h->local.nl_family = AF_NETLINK;
+ h->local.nl_pid = getpid();
+ h->local.nl_groups = gmask;
+ status = bind(h->fd, (struct sockaddr *)&h->local, sizeof(h->local));
+ if (status == -1)
+ {
+ ipulog_errno = IPULOG_ERR_BIND;
+ close(h->fd);
+ free(h);
+ return NULL;
+ }
+ memset(&h->peer, 0, sizeof(struct sockaddr_nl));
+ h->peer.nl_family = AF_NETLINK;
+ h->peer.nl_pid = 0;
+ h->peer.nl_groups = gmask;
+
+ return h;
+}
+
+/* destroy a ipulog handle */
+void ipulog_destroy_handle(struct ipulog_handle *h)
+{
+ close(h->fd);
+ free(h);
+}
+
+#if 0
+int ipulog_set_mode()
+{
+}
+#endif
+
+/* do a BLOCKING read on an ipulog handle */
+ssize_t ipulog_read(struct ipulog_handle *h, unsigned char *buf,
+ size_t len, int timeout)
+{
+ return ipulog_netlink_recvfrom(h, buf, len);
+}
+
+/* get a pointer to the actual start of the ipulog packet,
+ use this to strip netlink header */
+ulog_packet_msg_t *ipulog_get_packet(const unsigned char *buf)
+{
+ return NLMSG_DATA((struct nlmsghdr *) buf);
+}
+
+/* print a human readable description of the last error to stderr */
+void ipulog_perror(const char *s)
+{
+ if (s)
+ fputs(s, stderr);
+ else
+ fputs("ERROR", stderr);
+ if (ipulog_errno)
+ fprintf(stderr, ": %s", ipulog_strerror(ipulog_errno));
+ if (errno)
+ fprintf(stderr, ": %s", strerror(errno));
+ fputc('\n', stderr);
+}
+
diff --git a/ulogd/libipulog.old/ulog_test.c b/ulogd/libipulog.old/ulog_test.c
new file mode 100644
index 0000000..771dab6
--- /dev/null
+++ b/ulogd/libipulog.old/ulog_test.c
@@ -0,0 +1,83 @@
+/* ulog_test, $Revision: 1.3 $
+ *
+ * small testing program for libipulog, part of the netfilter ULOG target
+ * for the linux 2.4 netfilter subsystem.
+ *
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
+ *
+ * this code is released under the terms of GNU GPL
+ *
+ * $Id: ulog_test.c,v 1.3 2000/09/22 06:57:16 laforge Exp $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libipulog/libipulog.h>
+
+#define MYBUFSIZ 2048
+
+/* prints some logging about a single packet */
+void handle_packet(ulog_packet_msg_t *pkt)
+{
+ unsigned char *p;
+ int i;
+
+ printf("Hook=%u Mark=%lu len=%d ",
+ pkt->hook, pkt->mark, pkt->data_len);
+ if (strlen(pkt->prefix))
+ printf("Prefix=%s ", pkt->prefix);
+
+ if (pkt->mac_len)
+ {
+ printf("mac=");
+ p = pkt->mac;
+ for (i = 0; i < pkt->mac_len; i++, p++)
+ printf("%02x%c", *p, i==pkt->mac_len-1 ? ' ':':');
+ }
+ printf("\n");
+
+}
+
+int main(int argc, char *argv[])
+{
+ struct ipulog_handle *h;
+ unsigned char* buf;
+ size_t len;
+ ulog_packet_msg_t *upkt;
+ int i;
+
+ if (argc != 4) {
+ fprintf(stderr, "Usage: %s count group timeout\n", argv[0]);
+ exit(1);
+ }
+
+ /* allocate a receive buffer */
+ buf = (unsigned char *) malloc(MYBUFSIZ);
+
+ /* create ipulog handle */
+ h = ipulog_create_handle(ipulog_group2gmask(atoi(argv[2])));
+ if (!h)
+ {
+ /* if some error occurrs, print it to stderr */
+ ipulog_perror(NULL);
+ exit(1);
+ }
+
+ alarm(atoi(argv[3]));
+
+ /* loop receiving packets and handling them over to handle_packet */
+ for (i = 0; i < atoi(argv[1]); i++) {
+ len = ipulog_read(h, buf, BUFSIZ, 1);
+ if (len < 0) {
+ ipulog_perror("ulog_test: short read");
+ exit(1);
+ }
+ upkt = ipulog_get_packet(buf);
+ printf("%d: ", len);
+ handle_packet(upkt);
+ }
+
+ /* just to give it a cleaner look */
+ ipulog_destroy_handle(h);
+ return 0;
+}
diff --git a/ulogd/libipulog/Makefile.in b/ulogd/libipulog/Makefile.in
new file mode 100644
index 0000000..a3b16cb
--- /dev/null
+++ b/ulogd/libipulog/Makefile.in
@@ -0,0 +1,19 @@
+#
+
+include @top_srcdir@/Rules.make
+CFLAGS+=-Iinclude
+
+libipulog.a: libipulog.o
+ ld -i $< -o $@
+
+ulog_test: ulog_test.c libipulog.a
+ $(CC) $(CFLAGS) ulog_test.c libipulog.a -o ulog_test
+
+libipulog.o: libipulog.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -f ulog_test libipulog.o libipulog.a
+
+distclean: clean
+ rm Makefile
diff --git a/ulogd/ulogd.c b/ulogd/ulogd.c
index a60cf5f..55ed931 100644
--- a/ulogd/ulogd.c
+++ b/ulogd/ulogd.c
@@ -1,13 +1,13 @@
-/* ulogd, Version $Revision: 1.11 $
+/* ulogd, Version $Revision: 1.12 $
*
- * first try of a logging daemon for my netfilter ULOG target
- * for the linux 2.4 netfilter subsystem.
+ * userspace logging daemon for the netfilter ULOG target
+ * of the linux 2.4 netfilter subsystem.
*
- * (C) 2000 by Harald Welte <laforge@sunbeam.franken.de>
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
*
* this code is released under the terms of GNU GPL
*
- * $Id: ulogd.c,v 1.11 2000/11/16 17:20:52 laforge Exp $
+ * $Id: ulogd.c,v 1.12 2000/11/16 21:15:30 laforge Exp $
*/
#include <stdio.h>
@@ -22,6 +22,7 @@
#include "conffile.h"
#include "ulogd.h"
+/* Size of the netlink receive buffer */
#define MYBUFSIZ 2048
#ifdef DEBUG
@@ -31,9 +32,6 @@
#endif
/* default config parameters, if not changed in configfile */
-#ifndef ULOGD_PLUGINDIR_DEFAULT
-#define ULOGD_PLUGINDIR_DEFAULT "/usr/local/lib/ulogd"
-#endif
#ifndef ULOGD_LOGFILE_DEFAULT
#define ULOGD_LOGFILE_DEFAULT "/var/log/ulogd.log"
#endif
@@ -48,6 +46,8 @@
FILE *logfile = NULL;
+int loglevel = 1;
+
/* linked list for all registered interpreters */
static ulog_interpreter_t *ulogd_interpreters;
@@ -55,11 +55,26 @@ static ulog_interpreter_t *ulogd_interpreters;
static ulog_output_t *ulogd_outputs;
/***********************************************************************
- * INTERPRETER AND KEY HASH FUNCTIONS
+ * INTERPRETER AND KEY HASH FUNCTIONS (new in 0.9)
***********************************************************************/
+/* We keep hashtables of interpreters and registered keys. The hash-tables
+ * are allocated dynamically at program load time. You may control the
+ * allocation granularity of both hashes (i.e. the amount of hashtable
+ * entries are allocated at one time) through modification of the constants
+ * INTERH_ALLOC_GRAN and KEYH_ALLOC_GRAN
+ */
+
+/* allocation granularith */
+#define INTERH_ALLOC_GRAN 5
+
/* hashtable for all registered interpreters */
-static ulog_interpreter_t *ulogd_interh[100];
+static ulog_interpreter_t **ulogd_interh;
+
+/* current hashtable size */
+static unsigned int ulogd_interh_ids_alloc;
+
+/* total number of registered ids */
static unsigned int ulogd_interh_ids;
/* allocate a new interpreter id and write it into the interpreter struct */
@@ -68,12 +83,28 @@ static unsigned int interh_allocid(ulog_interpreter_t *ip)
unsigned int id;
id = ++ulogd_interh_ids;
+
+ if (id >= ulogd_interh_ids_alloc) {
+ if (!ulogd_interh)
+ ulogd_interh = (ulog_interpreter_t **)
+ malloc(INTERH_ALLOC_GRAN *
+ sizeof(ulog_interpreter_t));
+ else
+ ulogd_interh = (ulog_interpreter_t **)
+ realloc(ulogd_interh,
+ (INTERH_ALLOC_GRAN +
+ ulogd_interh_ids_alloc) *
+ sizeof(ulog_interpreter_t));
+
+ ulogd_interh_ids_alloc += INTERH_ALLOC_GRAN;
+ }
+
ip->id = id;
ulogd_interh[id] = ip;
return id;
}
-/* get interpreter d by name */
+/* get interpreter id by name */
unsigned int interh_getid(const char *name)
{
int i;
@@ -90,11 +121,21 @@ static void interh_dump(void)
int i;
for (i = 1; i <= ulogd_interh_ids; i++)
- printf("ulogd_interh[%d] = %s\n", i, (ulogd_interh[i])->name);
+ ulogd_log(ULOGD_DEBUG, "ulogd_interh[%d] = %s\n",
+ i, (ulogd_interh[i])->name);
}
-struct ulogd_keyh_entry ulogd_keyh[100];
+/* key hash allocation granularity */
+#define KEYH_ALLOC_GRAN 20
+
+/* hash table for key ids */
+struct ulogd_keyh_entry *ulogd_keyh;
+
+/* current size of the hashtable */
+static unsigned int ulogd_keyh_ids_alloc;
+
+/* total number of registered keys */
static unsigned int ulogd_keyh_ids;
/* allocate a new key_id */
@@ -105,6 +146,30 @@ static unsigned int keyh_allocid(ulog_interpreter_t *ip, unsigned int offset,
id = ++ulogd_keyh_ids;
+ if (id >= ulogd_keyh_ids_alloc) {
+ if (!ulogd_keyh) {
+ ulogd_keyh = (struct ulogd_keyh_entry *)
+ malloc(KEYH_ALLOC_GRAN *
+ sizeof(struct ulogd_keyh_entry));
+ if (!ulogd_keyh) {
+ ulogd_log(ULOGD_ERROR, "OOM!\n");
+ return 0;
+ }
+ } else {
+ ulogd_keyh = (struct ulogd_keyh_entry *)
+ realloc(ulogd_keyh, (KEYH_ALLOC_GRAN
+ +ulogd_keyh_ids_alloc) *
+ sizeof(struct ulogd_keyh_entry));
+
+ if (!ulogd_keyh) {
+ ulogd_log(ULOGD_ERROR, "OOM!\n");
+ return 0;
+ }
+ }
+
+ ulogd_keyh_ids_alloc += KEYH_ALLOC_GRAN;
+ }
+
ulogd_keyh[id].interp = ip;
ulogd_keyh[id].offset = offset;
ulogd_keyh[id].name = name;
@@ -112,6 +177,7 @@ static unsigned int keyh_allocid(ulog_interpreter_t *ip, unsigned int offset,
return id;
}
+/* dump the keyhash to standard output */
static void keyh_dump(void)
{
int i;
@@ -120,7 +186,6 @@ static void keyh_dump(void)
for (i = 1; i <= ulogd_keyh_ids; i++)
printf("ulogd_keyh[%d] = %s:%d\n", i, ulogd_keyh[i].interp->name,
ulogd_keyh[i].offset);
-
}
/* get keyid by name */
@@ -135,23 +200,37 @@ unsigned int keyh_getid(const char *name)
}
/* get key name by keyid */
-inline char *keyh_getname(unsigned int id)
+char *keyh_getname(unsigned int id)
{
+ if (id > ulogd_keyh_ids) {
+ ulogd_log(ULOGD_NOTICE,
+ "keyh_getname called with invalid id%u\n", id);
+ return NULL;
+ }
+
return ulogd_keyh[id].interp->name;
}
+/* get result for given key id. does not check if result valid */
ulog_iret_t *keyh_getres(unsigned int id)
{
ulog_iret_t *ret;
- ret = &ulogd_keyh[id].interp->result[ulogd_keyh[id].offset];
+ if (id > ulogd_keyh_ids) {
+ ulogd_log(ULOGD_NOTICE,
+ "keyh_getres called with invalid id %d\n", id);
+ return NULL;
+ }
- if (ret->flags & ULOGD_RETF_VALID)
- return ret;
+ ret = &ulogd_keyh[id].interp->result[ulogd_keyh[id].offset];
- return NULL;
+ return ret;
}
+/***********************************************************************
+ * INTERPRETER MANAGEMENT
+ ***********************************************************************
+
/* try to lookup a registered interpreter for a given name */
static ulog_interpreter_t *find_interpreter(const char *name)
{
@@ -172,32 +251,44 @@ void register_interpreter(ulog_interpreter_t *me)
/* check if we already have an interpreter with this name */
if (find_interpreter(me->name)) {
- ulogd_error("interpreter `%s' already registered\n",
- me->name);
- exit(1);
+ ulogd_log(ULOGD_NOTICE,
+ "interpreter `%s' already registered\n", me->name);
+ return;
}
- ulogd_log(ULOGD_NOTICE, "registering interpreter `%s'\n", me->name);
+ ulogd_log(ULOGD_INFO, "registering interpreter `%s'\n", me->name);
/* allocate a new interpreter id for it */
- interh_allocid(me);
+ if (!interh_allocid(me)) {
+ ulogd_log(ULOGD_ERROR, "unable to obtain interh_id for "
+ "interpreter '%s'\n", me->name);
+ return;
+ }
/* - allocate one keyh_id for each result of this interpreter
* - link the elements to each other */
for (i = 0; i < me->key_num; i++) {
- keyh_allocid(me, i, me->result[i].key);
+ if (!keyh_allocid(me, i, me->result[i].key)) {
+ ulogd_log(ULOGD_ERROR, "unable to obtain keyh_id "
+ "for interpreter %s, key %d", me->name,
+ me->result[i].key);
+ continue;
+ }
if (i != me->key_num - 1)
me->result[i].next = &me->result[i+1];
}
+ /* all work done, we can prepend the new interpreter to the list */
if (ulogd_interpreters)
me->result[me->key_num - 1].next = &ulogd_interpreters->result[0];
-
- /* all work done, we can prepend the new interpreter to the list */
me->next = ulogd_interpreters;
ulogd_interpreters = me;
}
+/***********************************************************************
+ * OUTPUT MANAGEMENT
+ ***********************************************************************
+
/* try to lookup a registered output plugin for a given name */
static ulog_output_t *find_output(const char *name)
{
@@ -215,7 +306,7 @@ static ulog_output_t *find_output(const char *name)
void register_output(ulog_output_t *me)
{
if (find_output(me->name)) {
- ulogd_error("output `%s' already registered\n",
+ ulogd_log(ULOGD_NOTICE, "output `%s' already registered\n",
me->name);
exit(1);
}
@@ -224,18 +315,9 @@ void register_output(ulog_output_t *me)
ulogd_outputs = me;
}
-/* allocate a new ulog_iret_t. Called by interpreter plugins */
-ulog_iret_t *alloc_ret(const u_int16_t type, const char* key)
-{
- ulog_iret_t *ptr = NULL;
-
- ptr = (ulog_iret_t *) malloc(sizeof(ulog_iret_t));
- memset(ptr, 0, sizeof(ulog_iret_t));
- strcpy(ptr->key, key);
- ptr->type = type;
-
- return ptr;
-}
+/***********************************************************************
+ * MAIN PROGRAM
+ ***********************************************************************
/* log message to the logfile */
void ulogd_log(int level, const char *format, ...)
@@ -245,6 +327,10 @@ void ulogd_log(int level, const char *format, ...)
time_t tm;
FILE *outfd;
+ /* log only messages which have level at least as high as loglevel */
+ if (level < loglevel)
+ return;
+
if (logfile)
outfd = logfile;
else
@@ -255,13 +341,13 @@ void ulogd_log(int level, const char *format, ...)
tm = time(NULL);
timestr = ctime(&tm);
timestr[strlen(timestr)-1] = '\0';
- fprintf(outfd, "%s <%1.1d>", timestr, level);
+ fprintf(outfd, "%s <%1.1d> %s:%d ", timestr, level, __FILE__, __LINE__);
vfprintf(outfd, format, ap);
va_end(ap);
}
-/* this should pass the result(s) to one or more registered output plugins,
- * but is currently only printing them out */
+
+/* propagate results to all registered output plugins */
static void propagate_results(ulog_iret_t *ret)
{
ulog_output_t *p;
@@ -284,8 +370,6 @@ static void clean_results(ulog_iret_t *ret)
}
}
-#define IS_VALID(x) (x.flags & ULOGD_RETF_VALID)
-
/* call all registered interpreters and hand the results over to
* propagate_results */
static void handle_packet(ulog_packet_msg_t *pkt)
@@ -299,7 +383,7 @@ static void handle_packet(ulog_packet_msg_t *pkt)
for (i = 1; i <= ulogd_interh_ids; i++) {
ip = ulogd_interh[i];
/* call interpreter */
- if (ret = ((ip)->interp)(ip, pkt)) {
+ if ((ret = ((ip)->interp)(ip, pkt))) {
/* create references for result linked-list */
for (j = 0; j < ip->key_num; j++) {
if (IS_VALID(ip->result[j])) {
@@ -313,34 +397,17 @@ static void handle_packet(ulog_packet_msg_t *pkt)
clean_results(ulogd_interpreters->result);
}
-/* silly plugin loader to dlopen() all available plugins */
-static void load_plugins(char *dir)
+/* plugin loader to dlopen() a plugins */
+static int load_plugin(char *file)
{
- DIR *ldir;
- struct dirent *dent;
- char *fname;
-
- ldir = opendir(dir);
- if (ldir) {
- fname = (char *) malloc(NAME_MAX + strlen(dir)
- + 3);
- for (dent = readdir(ldir); dent; dent = readdir(ldir)) {
- if (strncmp(dent->d_name,"ulogd", 5) == 0) {
- DEBUGP("load_plugins: %s\n", dent->d_name);
- sprintf(fname, "%s/%s", dir, dent->d_name);
- if (!dlopen(fname, RTLD_NOW))
- ulogd_error("load_plugins: %s\n", dlerror());
- }
- }
- free(fname);
- } else
- ulogd_error("No plugin directory: %s\n", dir);
-
- interh_dump();
- keyh_dump();
-
+ if (!dlopen(file, RTLD_NOW)) {
+ ulogd_log(ULOGD_ERROR, "load_plugins: %s\n", dlerror());
+ return 1;
+ }
+ return 0;
}
+/* open the logfile */
static int logfile_open(const char *name)
{
logfile = fopen(name, "a");
@@ -352,6 +419,7 @@ static int logfile_open(const char *name)
return 0;
}
+/* wrapper to handle conffile error codes */
static int parse_conffile(int final)
{
int err;
@@ -363,17 +431,21 @@ static int parse_conffile(int final)
return 0;
break;
case -ERROPEN:
- ulogd_error("ERROR: unable to open configfile: %s\n",
- ULOGD_CONFIGFILE);
+ ulogd_log(ULOGD_ERROR,
+ "unable to open configfile: %s\n",
+ ULOGD_CONFIGFILE);
break;
case -ERRMAND:
- ulogd_error("ERROR: mandatory option not found\n");
+ ulogd_log(ULOGD_ERROR,
+ "mandatory option not found\n");
break;
case -ERRMULT:
- ulogd_error("ERROR: option occurred more than once\n");
+ ulogd_log(ULOGD_ERROR,
+ "option occurred more than once\n");
break;
case -ERRUNKN:
- ulogd_error("ERROR: unknown config key\n");
+ ulogd_log(ULOGD_ERROR,
+ "unknown config key\n");
/* config_errce->key); */
break;
}
@@ -381,27 +453,29 @@ static int parse_conffile(int final)
}
+/* configuration directives of the main program */
static config_entry_t logf_ce = { NULL, "logfile", CONFIG_TYPE_STRING,
CONFIG_OPT_NONE, 0,
{ string: ULOGD_LOGFILE_DEFAULT } };
-
-static config_entry_t pldir_ce = { NULL, "plugindir", CONFIG_TYPE_STRING,
- CONFIG_OPT_NONE, 0,
- { string: ULOGD_PLUGINDIR_DEFAULT } };
-static config_entry_t nlgroup_ce = { NULL, "nlgroup", CONFIG_TYPE_INT,
+static config_entry_t plugin_ce = { &logf_ce, "plugin", CONFIG_TYPE_CALLBACK,
+ CONFIG_OPT_MULTI, 0,
+ { parser: &load_plugin } };
+
+static config_entry_t nlgroup_ce = { &plugin_ce, "nlgroup", CONFIG_TYPE_INT,
CONFIG_OPT_NONE, 0,
{ value: ULOGD_NLGROUP_DEFAULT } };
+
+static config_entry_t loglevel_ce = { &nlgroup_ce, "loglevel", CONFIG_TYPE_INT,
+ CONFIG_OPT_NONE, 0,
+ { value: 1 } };
+
static int init_conffile(char *file)
{
if (config_register_file(file))
return 1;
- /* link them together */
- logf_ce.next = &pldir_ce;
- pldir_ce.next = &nlgroup_ce;
-
- config_register_key(&logf_ce);
+ config_register_key(&loglevel_ce);
/* parse config file the first time (for logfile name, ...) */
return parse_conffile(0);
@@ -415,18 +489,24 @@ int main(int argc, char* argv[])
ulog_packet_msg_t *upkt;
if (init_conffile(ULOGD_CONFIGFILE)) {
+ ulogd_log(ULOGD_FATAL, "parse_conffile error\n");
exit(1);
}
logfile_open(logf_ce.u.string);
- load_plugins(pldir_ce.u.string);
/* parse config file the second time (for plugin options) */
if (parse_conffile(1)) {
- ulogd_error("ERROR during second parse_conffile\n");
+ ulogd_log(ULOGD_FATAL, "parse_conffile\n");
exit(1);
}
+#ifdef DEBUG
+ /* dump key and interpreter hash */
+ interh_dump();
+ keyh_dump();
+#endif
+
/* allocate a receive buffer */
buf = (unsigned char *) malloc(MYBUFSIZ);
@@ -434,6 +514,7 @@ int main(int argc, char* argv[])
h = ipulog_create_handle(ipulog_group2gmask(nlgroup_ce.u.value));
if (!h) {
/* if some error occurrs, print it to stderr */
+ ulogd_log(ULOGD_FATAL, "unable to create ipulogd handle\n");
ipulog_perror(NULL);
exit(1);
}
diff --git a/ulogd/ulogd.conf b/ulogd/ulogd.conf
index 27f0394..f27c990 100644
--- a/ulogd/ulogd.conf
+++ b/ulogd/ulogd.conf
@@ -1,9 +1,17 @@
-# which netlink multicast group ulogd should listen to
+# netlink multicast group (the same as the iptables --ulog-nlgroup param)
nlgroup 32
-
-# logfile
+# logfile for status messages
logfile /var/log/ulogd.log
-
-# dumpfile for ulogd_OPRINT.so
+# loglevel: notice, warnings, error and fatal
+loglevel 5
+# ulogd_OPRINT.so: file for packet dumping
dumpfile /var/log/ulogd.pktlog
-
+# ulogd_MYSQL.so: database information
+mysqltable ulog
+mysqlpass hotline
+mysqluser laforge
+mysqldb ulogd
+mysqlhost localhost
+# plugins: first load BASE interpreter, then syslog emulation
+plugin /usr/local/lib/ulogd/ulogd_BASE.so
+plugin /usr/local/lib/ulogd/ulogd_LOGEMU.so