From 889c8ccde1e0ebca799c0eb8d796ff1062d8d54c Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org" Date: Sun, 9 Oct 2005 15:34:09 +0000 Subject: hopefully the last renaming effort --- _log/COPYING | 339 ---------------- _log/Makefile.am | 13 - _log/autogen.sh | 18 - _log/configure.in | 67 ---- _log/depcomp | 479 ----------------------- _log/include/Makefile.am | 3 - _log/include/libnfnetlink_log/Makefile.am | 3 - _log/include/libnfnetlink_log/libipulog.h | 69 ---- _log/include/libnfnetlink_log/libnfnetlink_log.h | 47 --- _log/src/Makefile.am | 15 - _log/src/libipulog_compat.c | 226 ----------- _log/src/libnfnetlink_log.c | 323 --------------- _log/utils/Makefile.am | 15 - _log/utils/nfulnl_test.c | 155 -------- _log/utils/ulog_test.c | 87 ---- 15 files changed, 1859 deletions(-) delete mode 100644 _log/COPYING delete mode 100644 _log/Makefile.am delete mode 100755 _log/autogen.sh delete mode 100644 _log/configure.in delete mode 100755 _log/depcomp delete mode 100644 _log/include/Makefile.am delete mode 100644 _log/include/libnfnetlink_log/Makefile.am delete mode 100644 _log/include/libnfnetlink_log/libipulog.h delete mode 100644 _log/include/libnfnetlink_log/libnfnetlink_log.h delete mode 100644 _log/src/Makefile.am delete mode 100644 _log/src/libipulog_compat.c delete mode 100644 _log/src/libnfnetlink_log.c delete mode 100644 _log/utils/Makefile.am delete mode 100644 _log/utils/nfulnl_test.c delete mode 100644 _log/utils/ulog_test.c diff --git a/_log/COPYING b/_log/COPYING deleted file mode 100644 index a43ea21..0000000 --- a/_log/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, 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 - - Appendix: 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. - - - Copyright (C) 19yy - - 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., 675 Mass Ave, Cambridge, MA 02139, 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. - - , 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/_log/Makefile.am b/_log/Makefile.am deleted file mode 100644 index c8ece6e..0000000 --- a/_log/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 - -INCLUDES =$(all_includes) -I$(top_srcdir)/include -I${KERNELDIR} -SUBDIRS = include src utils -LINKOPTS = -lnfnetlink - -EXTRA_DIST = $(man_MANS) - -man_MANS = #nfnetlink_log.3 nfnetlink_log.7 - -$(OBJECTS): libtool -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status --recheck diff --git a/_log/autogen.sh b/_log/autogen.sh deleted file mode 100755 index 19da869..0000000 --- a/_log/autogen.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -run () -{ - echo "running: $*" - eval $* - - if test $? != 0 ; then - echo "error: while running '$*'" - exit 1 - fi -} - -run aclocal-1.6 -#run autoheader -run libtoolize -f -run automake-1.6 -a -run autoconf diff --git a/_log/configure.in b/_log/configure.in deleted file mode 100644 index 40e9189..0000000 --- a/_log/configure.in +++ /dev/null @@ -1,67 +0,0 @@ -dnl Process this file with autoconf to create configure. - -AC_INIT - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE(libnfnetlink_log, 0.0.10) - -AC_PROG_CC -AM_PROG_LIBTOOL -AC_PROG_INSTALL -AC_PROG_LN_S - -AC_SUBST(LIBTOOL_DEPS) - -case $target in -*-*-linux*) ;; -*) AC_MSG_ERROR([Linux only, dude!]);; -esac - -AC_CHECK_LIB([nfnetlink], [nfnl_listen]) - - - -dnl-------------------------------- - -AC_DEFUN([NF_KERNEL_SOURCE],[ - - if test "$with_kernel" = ""; then - KERNEL="`uname -r`" - else - KERNEL="$with_kernel" - fi - - THIS_PREFIX="" - for i in "/lib/modules/$KERNEL/build/include" "$KERNEL" "$KERNEL/include" "/usr/src/linux-$KERNEL" "/usr/src/kernel-$KERNEL" "/usr/src/linux-headers-$KERNEL" "/usr/src/kernel-headers-$KERNEL" - do - AC_MSG_CHECKING([Looking for kernel source or headers in $i]) - if test -r "$i/linux/config.h" - then - THIS_PREFIX="$i" - AC_MSG_RESULT([found]) - break - fi - AC_MSG_RESULT([ ]) - done - if test -r "$THIS_PREFIX/linux/config.h" ; then - AC_SUBST(KERNELDIR,[$THIS_PREFIX]) - AC_MSG_RESULT([found]) - else - AC_MSG_ERROR([not found $THIS_PREFIX]) - fi - - # somehow add this as an include path -]) - -AC_ARG_WITH(kernel, - AC_HELP_STRING([--with-kernel=DIR], - [ Show location of kernel source. Default is to use uname -r and look in /lib/modules/KERNEL/build/include. ]), - NF_KERNEL_SOURCE($with_kernel),NF_KERNEL_SOURCE()) - -dnl-------------------------------- - - -dnl Output the makefile -AC_OUTPUT(Makefile src/Makefile include/Makefile include/libnfnetlink_log/Makefile utils/Makefile) - diff --git a/_log/depcomp b/_log/depcomp deleted file mode 100755 index edb5d38..0000000 --- a/_log/depcomp +++ /dev/null @@ -1,479 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000, 2003 Free Software Foundation, Inc. - -# 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, 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/_log/include/Makefile.am b/_log/include/Makefile.am deleted file mode 100644 index f454d1d..0000000 --- a/_log/include/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ - -SUBDIRS = libnfnetlink_log - diff --git a/_log/include/libnfnetlink_log/Makefile.am b/_log/include/libnfnetlink_log/Makefile.am deleted file mode 100644 index ea4bfc0..0000000 --- a/_log/include/libnfnetlink_log/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ - -pkginclude_HEADERS = libnfnetlink_log.h libipulog.h - diff --git a/_log/include/libnfnetlink_log/libipulog.h b/_log/include/libnfnetlink_log/libipulog.h deleted file mode 100644 index 0278862..0000000 --- a/_log/include/libnfnetlink_log/libipulog.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _LIBIPULOG_H -#define _LIBIPULOG_H - -#include -#include -#include - -/* FIXME: glibc sucks */ -#ifndef MSG_TRUNC -#define MSG_TRUNC 0x20 -#endif - -#define ULOG_MAC_LEN 80 -#define ULOG_PREFIX_LEN 32 -#define ULOG_IFNAMSIZ 16 - -/* Format of the ULOG packets passed through netlink */ -typedef struct ulog_packet_msg { - unsigned long mark; - long timestamp_sec; - long timestamp_usec; - unsigned int hook; - char indev_name[ULOG_IFNAMSIZ]; - char outdev_name[ULOG_IFNAMSIZ]; - size_t data_len; - char prefix[ULOG_PREFIX_LEN]; - unsigned char mac_len; - unsigned char mac[ULOG_MAC_LEN]; - unsigned char payload[0]; -} ulog_packet_msg_t; - -struct ipulog_handle; -extern int ipulog_errno; - -u_int32_t ipulog_group2gmask(u_int32_t group); - -struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, u_int32_t rmem); - -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(struct ipulog_handle *h, - const unsigned char *buf, - size_t len); - -char *ipulog_strerror(int errcode); - -void ipulog_perror(const char *s); - -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, - IPULOG_ERR_INVNL, -}; -#define IPULOG_MAXERR IPULOG_ERR_INVNL - - -#endif /* _LIBIPULOG_H */ diff --git a/_log/include/libnfnetlink_log/libnfnetlink_log.h b/_log/include/libnfnetlink_log/libnfnetlink_log.h deleted file mode 100644 index 707bba8..0000000 --- a/_log/include/libnfnetlink_log/libnfnetlink_log.h +++ /dev/null @@ -1,47 +0,0 @@ -/* libnfnetlink_log.h: Header file for the Netfilter Userspace Log library. - * - * (C) 2005 by Harald Welte - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - */ - -#ifndef __LIBNFNETLINK_LOG_H -#define __LIBNFNETLINK_LOG_H - -#include -#include - -struct nfulnl_handle; -struct nfulnl_g_handle; - -extern int nfulnl_errno; - -extern struct nfnl_handle *nfulnl_nfnlh(struct nfulnl_handle *h); -extern int nfulnl_fd(struct nfulnl_handle *h); - -typedef int nfulnl_callback(struct nfulnl_g_handle *gh, struct nfgenmsg *nfmsg, - struct nfattr *nfa[], void *data); - - -extern struct nfulnl_handle *nfulnl_open(void); -extern int nfulnl_close(struct nfulnl_handle *h); - -extern int nfulnl_bind_pf(struct nfulnl_handle *h, u_int16_t pf); -extern int nfulnl_unbind_pf(struct nfulnl_handle *h, u_int16_t pf); - -extern struct nfulnl_g_handle *nfulnl_bind_group(struct nfulnl_handle *h, - u_int16_t num); -extern int nfulnl_unbind_group(struct nfulnl_g_handle *gh); - -extern int nfulnl_set_mode(struct nfulnl_g_handle *gh, - u_int8_t mode, unsigned int len); -extern int nfulnl_set_timeout(struct nfulnl_g_handle *gh, u_int32_t timeout); -extern int nfulnl_set_qthresh(struct nfulnl_g_handle *gh, u_int32_t qthresh); -extern int nfulnl_set_nlbufsiz(struct nfulnl_g_handle *gh, u_int32_t nlbufsiz); - -extern int nfulnl_callback_register(struct nfulnl_g_handle *gh, - nfulnl_callback *cb, void *data); -extern int nfulnl_handle_packet(struct nfulnl_handle *h, char *buf, int len); - -#endif /* __LIBNFNETLINK_LOG_H */ diff --git a/_log/src/Makefile.am b/_log/src/Makefile.am deleted file mode 100644 index 9593d92..0000000 --- a/_log/src/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -#AUTOMAKE_OPTIONS = no-dependencies foreign - -#EXTRA_DIST = $(man_MANS) acinclude.m4 - -INCLUDES = $(all_includes) -I$(top_srcdir)/include -I${KERNELDIR} -AM_CFLAGS=-fPIC -Wall -LIBS= - -lib_LTLIBRARIES = libnfnetlink_log.la libnfnetlink_log_libipulog.la - -libnfnetlink_log_la_LDFLAGS = -Wc,-nostartfiles -libnfnetlink_log_la_SOURCES = libnfnetlink_log.c - -libnfnetlink_log_libipulog_la_LDFLAGS = -Wc,-nostartfiles -libnfnetlink_log_libipulog_la_SOURCES = libipulog_compat.c diff --git a/_log/src/libipulog_compat.c b/_log/src/libipulog_compat.c deleted file mode 100644 index a0675ec..0000000 --- a/_log/src/libipulog_compat.c +++ /dev/null @@ -1,226 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* private */ -#define PAYLOAD_SIZE 0xffff - - -struct ipulog_handle -{ - struct nfulnl_handle *nfulh; - struct nfulnl_g_handle *nful_gh; - struct nlmsghdr *last_nlh; -#if 0 - int fd; - u_int8_t blocking; - struct sockaddr_nl local; - struct sockaddr_nl peer; -#endif - struct ulog_packet_msg upmsg; /* has to be last in structure */ -}; - -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, "Error during netlink receive" }, - { IPULOG_ERR_NLEOF, "Received EOF on netlink socket" }, - { IPULOG_ERR_TRUNC, "Receive message truncated" }, - { IPULOG_ERR_INVGR, "Invalid group specified" }, - { IPULOG_ERR_INVNL, "Invalid netlink message" }, -}; - -/* obviously this only finds the highest group in the mask */ -static unsigned int gmask2group(unsigned int gmask) -{ - int bit; - - for (bit = sizeof(gmask)*4 -1; bit >= 0; bit--) { - if (gmask & (1 << bit)) - return bit+1; - } - return 0; -} - - - -/* public */ - -int ipulog_errno = IPULOG_ERR_NONE; - -char *ipulog_strerror(int errcode) -{ - if (errcode < 0 || errcode > IPULOG_MAXERR) - errcode = IPULOG_ERR_IMPL; - return ipulog_errmap[errcode].message; -} - -/* 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(u_int32_t gmask, - u_int32_t rcvbufsize) -{ - int rv; - struct ipulog_handle *h; - unsigned int group = gmask2group(gmask); - - h = (struct ipulog_handle *) malloc(sizeof(*h)+PAYLOAD_SIZE); - if (! h) { - ipulog_errno = IPULOG_ERR_HANDLE; - return NULL; - } - memset(h, 0, sizeof(*h)); - h->nfulh = nfulnl_open(); - if (!h->nfulh) - goto out_free; - - /* bind_pf returns EEXIST if we are already registered */ - rv = nfulnl_bind_pf(h->nfulh, AF_INET); - if (rv < 0 && rv != -EEXIST) - goto out_free; - - h->nful_gh = nfulnl_bind_group(h->nfulh, group); - if (!h->nful_gh) - goto out_free; - - return h; - -out_free: - ipulog_errno = IPULOG_ERR_HANDLE; - free(h); - return NULL; -} - -void ipulog_destroy_handle(struct ipulog_handle *h) -{ - nfulnl_unbind_group(h->nful_gh); - nfulnl_close(h->nfulh); - free(h); -} - -ulog_packet_msg_t *ipulog_get_packet(struct ipulog_handle *h, - const unsigned char *buf, - size_t len) -{ - struct nlmsghdr *nlh; - struct nfattr *tb[NFULA_MAX]; - struct nfulnl_msg_packet_hdr *hdr; - - if (!h->last_nlh) { - printf("first\n"); - nlh = nfnl_get_msg_first(nfulnl_nfnlh(h->nfulh), buf, len); - }else { -next_msg: printf("next\n"); - nlh = nfnl_get_msg_next(nfulnl_nfnlh(h->nfulh), buf, len); - } - h->last_nlh = nlh; - - if (!nlh) - return NULL; - - nfnl_parse_attr(tb, NFULA_MAX, NFM_NFA(NLMSG_DATA(nlh)), - NFM_PAYLOAD(nlh)); - - if (!tb[NFULA_PACKET_HDR-1]) - goto next_msg; - - /* now build the fake ulog_packet_msg */ - hdr = NFA_DATA(tb[NFULA_PACKET_HDR-1]); - h->upmsg.hook = hdr->hook; - - if (tb[NFULA_MARK-1]) - h->upmsg.mark = ntohl(*(u_int32_t *)NFA_DATA(tb[NFULA_MARK-1])); - else - h->upmsg.mark = 0; - - if (tb[NFULA_TIMESTAMP]) { - /* FIXME: 64bit network-to-host */ - h->upmsg.timestamp_sec = h->upmsg.timestamp_usec = 0; - } else - h->upmsg.timestamp_sec = h->upmsg.timestamp_usec = 0; - - if (tb[NFULA_IFINDEX_INDEV-1]) { - /* FIXME: ifindex lookup */ - h->upmsg.indev_name[0] = '\0'; - } else - h->upmsg.indev_name[0] = '\0'; - - if (tb[NFULA_IFINDEX_OUTDEV-1]) { - /* FIXME: ifindex lookup */ - h->upmsg.outdev_name[0] = '\0'; - } else - h->upmsg.outdev_name[0] = '\0'; - - if (tb[NFULA_HWADDR-1]) { - struct nfulnl_msg_packet_hw *phw = NFA_DATA(tb[NFULA_HWADDR-1]); - h->upmsg.mac_len = ntohs(phw->hw_addrlen); - memcpy(h->upmsg.mac, phw->hw_addr, 8); - } else - h->upmsg.mac_len = 0; - - if (tb[NFULA_PREFIX-1]) { - int plen = NFA_PAYLOAD(tb[NFULA_PREFIX-1]); - if (ULOG_PREFIX_LEN < plen) - plen = ULOG_PREFIX_LEN; - memcpy(h->upmsg.prefix, NFA_DATA(tb[NFULA_PREFIX-1]), plen); - h->upmsg.prefix[ULOG_PREFIX_LEN-1] = '\0'; - } - - if (tb[NFULA_PAYLOAD-1]) { - memcpy(h->upmsg.payload, NFA_DATA(tb[NFULA_PAYLOAD-1]), - NFA_PAYLOAD(tb[NFULA_PAYLOAD-1])); - h->upmsg.data_len = NFA_PAYLOAD(tb[NFULA_PAYLOAD-1]); - } else - h->upmsg.data_len = 0; - - return &h->upmsg; -} - -ssize_t ipulog_read(struct ipulog_handle *h, unsigned char *buf, - size_t len, int timeout) -{ - /* 'timeout' was never implemented in the original libipulog, - * so we don't bother emulating it */ - return nfnl_recv(nfulnl_nfnlh(h->nfulh), buf, len); -} - -/* 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/_log/src/libnfnetlink_log.c b/_log/src/libnfnetlink_log.c deleted file mode 100644 index ee27156..0000000 --- a/_log/src/libnfnetlink_log.c +++ /dev/null @@ -1,323 +0,0 @@ -/* libnfqnetlink.c: generic library for access to nf_queue - * - * (C) 2005 by Harald Welte - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation - * - * 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 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct nfulnl_handle -{ - struct nfnl_handle nfnlh; - struct nfulnl_g_handle *gh_list; -}; - -struct nfulnl_g_handle -{ - struct nfulnl_g_handle *next; - struct nfulnl_handle *h; - u_int16_t id; - - nfulnl_callback *cb; - void *data; -}; - -int nfulnl_errno; - -/*********************************************************************** - * low level stuff - ***********************************************************************/ - -static void del_gh(struct nfulnl_g_handle *gh) -{ - struct nfulnl_g_handle *cur_gh, *prev_gh = NULL; - - for (cur_gh = gh->h->gh_list; cur_gh; cur_gh = cur_gh->next) { - if (cur_gh == gh) { - if (prev_gh) - prev_gh->next = gh->next; - else - gh->h->gh_list = gh->next; - return; - } - prev_gh = cur_gh; - } -} - -static void add_gh(struct nfulnl_g_handle *gh) -{ - gh->next = gh->h->gh_list; - gh->h->gh_list = gh; -} - -static struct nfulnl_g_handle *find_gh(struct nfulnl_handle *h, u_int16_t group) -{ - struct nfulnl_g_handle *gh; - - for (gh = h->gh_list; gh; gh = gh->next) { - if (gh->id == group) - return gh; - } - return NULL; -} - -static int __nfulnl_rcv_cmd(struct nlmsghdr *nlh, struct nfattr *nfa[], - void *data) -{ - struct nfulnl_handle *h = data; - - /* FIXME: implement this */ - return 0; -} - -/* build a NFULNL_MSG_CONFIG message */ -static int -__build_send_cfg_msg(struct nfulnl_handle *h, u_int8_t command, - u_int16_t queuenum, u_int8_t pf) -{ - char buf[NFNL_HEADER_LEN - +NFA_LENGTH(sizeof(struct nfulnl_msg_config_cmd))]; - struct nfulnl_msg_config_cmd cmd; - struct nlmsghdr *nmh = (struct nlmsghdr *) buf; - - nfnl_fill_hdr(&h->nfnlh, nmh, 0, pf, queuenum, - NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK); - - cmd.command = command; - nfnl_addattr_l(nmh, sizeof(buf), NFULA_CFG_CMD, &cmd, sizeof(cmd)); - - return nfnl_talk(&h->nfnlh, nmh, 0, 0, NULL, NULL, NULL); -} - -static int __nfulnl_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[], - void *data) -{ - struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); - struct nfulnl_handle *h = data; - u_int16_t group = ntohs(nfmsg->res_id); - struct nfulnl_g_handle *gh = find_gh(h, group); - - if (!gh) - return -ENODEV; - - if (!gh->cb) - return -ENODEV; - - return gh->cb(gh, nfmsg, nfa, gh->data); -} - -static struct nfnl_callback cmd_cb = { - .call = &__nfulnl_rcv_cmd, - .attr_count = NFULA_CFG_MAX, -}; - -static struct nfnl_callback pkt_cb = { - .call = &__nfulnl_rcv_pkt, - .attr_count = NFULA_MAX, -}; - -/* public interface */ - -struct nfnl_handle *nfulnl_nfnlh(struct nfulnl_handle *h) -{ - return &h->nfnlh; -} - -int nfulnl_fd(struct nfulnl_handle *h) -{ - return nfnl_fd(nfulnl_nfnlh(h)); -} - -struct nfulnl_handle *nfulnl_open(void) -{ - struct nfulnl_handle *h; - int err; - - h = malloc(sizeof(*h)); - if (!h) - return NULL; - - memset(h, 0, sizeof(*h)); - - err = nfnl_open(&h->nfnlh, NFNL_SUBSYS_ULOG, NFULNL_MSG_MAX, 0); - if (err < 0) { - nfulnl_errno = err; - goto out_free; - } - - cmd_cb.data = h; - err = nfnl_callback_register(&h->nfnlh, NFULNL_MSG_CONFIG, &cmd_cb); - if (err < 0) { - nfulnl_errno = err; - goto out_close; - } - pkt_cb.data = h; - err = nfnl_callback_register(&h->nfnlh, NFULNL_MSG_PACKET, &pkt_cb); - if (err < 0) { - nfulnl_errno = err; - goto out_close; - } - - return h; -out_close: - nfnl_close(&h->nfnlh); -out_free: - free(h); - return NULL; -} - -int nfulnl_callback_register(struct nfulnl_g_handle *gh, nfulnl_callback *cb, - void *data) -{ - gh->data = data; - gh->cb = cb; - - return 0; -} - -int nfulnl_handle_packet(struct nfulnl_handle *h, char *buf, int len) -{ - return nfnl_handle_packet(&h->nfnlh, buf, len); -} - -int nfulnl_close(struct nfulnl_handle *h) -{ - return nfnl_close(&h->nfnlh); -} - -/* bind nf_queue from a specific protocol family */ -int nfulnl_bind_pf(struct nfulnl_handle *h, u_int16_t pf) -{ - return __build_send_cfg_msg(h, NFULNL_CFG_CMD_PF_BIND, 0, pf); -} - -/* unbind nf_queue from a specific protocol family */ -int nfulnl_unbind_pf(struct nfulnl_handle *h, u_int16_t pf) -{ - return __build_send_cfg_msg(h, NFULNL_CFG_CMD_PF_UNBIND, 0, pf); -} - -/* bind this socket to a specific queue number */ -struct nfulnl_g_handle * -nfulnl_bind_group(struct nfulnl_handle *h, u_int16_t num) -{ - struct nfulnl_g_handle *gh; - - if (find_gh(h, num)) - return NULL; - - gh = malloc(sizeof(*gh)); - if (!gh) - return NULL; - - memset(gh, 0, sizeof(*gh)); - gh->h = h; - gh->id = num; - - if (__build_send_cfg_msg(h, NFULNL_CFG_CMD_BIND, num, 0) < 0) { - free(gh); - return NULL; - } - - add_gh(gh); - return gh; -} - -/* unbind this socket from a specific queue number */ -int nfulnl_unbind_group(struct nfulnl_g_handle *gh) -{ - int ret = __build_send_cfg_msg(gh->h, NFULNL_CFG_CMD_UNBIND, gh->id, 0); - if (ret == 0) { - del_gh(gh); - free(gh); - } - - return ret; -} - -int nfulnl_set_mode(struct nfulnl_g_handle *gh, - u_int8_t mode, u_int32_t range) -{ - char buf[NFNL_HEADER_LEN - +NFA_LENGTH(sizeof(struct nfulnl_msg_config_mode))]; - struct nfulnl_msg_config_mode params; - struct nlmsghdr *nmh = (struct nlmsghdr *) buf; - - nfnl_fill_hdr(&gh->h->nfnlh, nmh, 0, AF_UNSPEC, gh->id, - NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK); - - params.copy_range = htonl(range); /* copy_range is short */ - params.copy_mode = mode; - nfnl_addattr_l(nmh, sizeof(buf), NFULA_CFG_MODE, ¶ms, - sizeof(params)); - - return nfnl_talk(&gh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL); -} - -int nfulnl_set_timeout(struct nfulnl_g_handle *gh, u_int32_t timeout) -{ - char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))]; - struct nlmsghdr *nmh = (struct nlmsghdr *) buf; - - nfnl_fill_hdr(&gh->h->nfnlh, nmh, 0, AF_UNSPEC, gh->id, - NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK); - - nfnl_addattr32(nmh, sizeof(buf), NFULA_CFG_TIMEOUT, htonl(timeout)); - - return nfnl_talk(&gh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL); -} - -int nfulnl_set_qthresh(struct nfulnl_g_handle *gh, u_int32_t qthresh) -{ - char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))]; - struct nlmsghdr *nmh = (struct nlmsghdr *) buf; - - nfnl_fill_hdr(&gh->h->nfnlh, nmh, 0, AF_UNSPEC, gh->id, - NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK); - - nfnl_addattr32(nmh, sizeof(buf), NFULA_CFG_QTHRESH, htonl(qthresh)); - - return nfnl_talk(&gh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL); -} - -int nfulnl_set_nlbufsiz(struct nfulnl_g_handle *gh, u_int32_t nlbufsiz) -{ - char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))]; - struct nlmsghdr *nmh = (struct nlmsghdr *) buf; - int status; - - nfnl_fill_hdr(&gh->h->nfnlh, nmh, 0, AF_UNSPEC, gh->id, - NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK); - - nfnl_addattr32(nmh, sizeof(buf), NFULA_CFG_NLBUFSIZ, htonl(nlbufsiz)); - - status = nfnl_talk(&gh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL); - - /* we try to have space for at least 10 messages in the socket buffer */ - if (status >= 0) - nfnl_rcvbufsiz(&gh->h->nfnlh, 10*nlbufsiz); - - return status; -} diff --git a/_log/utils/Makefile.am b/_log/utils/Makefile.am deleted file mode 100644 index a2c2f2e..0000000 --- a/_log/utils/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = $(all_includes) -I$(top_srcdir)/include -I${KERNELDIR} - -bin_PROGRAMS = nfulnl_test ulog_test - -nfulnl_test_SOURCES = nfulnl_test.c -nfulnl_test_LDADD = ../src/libnfnetlink_log.la -nfulnl_test_LDFLAGS = -dynamic -#nfulnl_test_LDFLAGS = $(all_libraries) -lnfnetlink_log - -ulog_test_SOURCES = ulog_test.c -ulog_test_LDADD = ../src/libnfnetlink_log_libipulog.la ../src/libnfnetlink_log.la -ulog_test_LDFLAGS = -dynamic -#ulog_test_LDFLAGS = $(all_libraries) -lnfnetlink_log_libipulog -lnfnetlink_log - - diff --git a/_log/utils/nfulnl_test.c b/_log/utils/nfulnl_test.c deleted file mode 100644 index a6d648e..0000000 --- a/_log/utils/nfulnl_test.c +++ /dev/null @@ -1,155 +0,0 @@ - -#include -#include -#include -#include - -#include - -static int print_pkt(struct nfattr *tb[]) -{ - if (tb[NFULA_PACKET_HDR-1]) { - struct nfulnl_msg_packet_hdr *ph = - NFA_DATA(tb[NFULA_PACKET_HDR-1]); - printf("hw_protocol=0x%04x hook=%u ", - ntohs(ph->hw_protocol), ph->hook); - } - - if (tb[NFULA_MARK-1]) { - u_int32_t mark = - ntohl(*(u_int32_t *)NFA_DATA(tb[NFULA_MARK-1])); - printf("mark=%u ", mark); - } - - if (tb[NFULA_IFINDEX_INDEV-1]) { - u_int32_t ifi = ntohl(*(u_int32_t *)NFA_DATA(tb[NFULA_IFINDEX_INDEV-1])); - printf("indev=%u ", ifi); - } - if (tb[NFULA_IFINDEX_OUTDEV-1]) { - u_int32_t ifi = ntohl(*(u_int32_t *)NFA_DATA(tb[NFULA_IFINDEX_OUTDEV-1])); - printf("outdev=%u ", ifi); - } -#if 0 - if (tb[NFULA_IFINDEX_PHYSINDEV-1]) { - u_int32_t ifi = ntohl(*(u_int32_t *)NFA_DATA(tb[NFULA_IFINDEX_PHYSINDEV-1])); - printf("physindev=%u ", ifi); - } - if (tb[NFULA_IFINDEX_PHYSOUTDEV-1]) { - u_int32_t ifi = ntohl(*(u_int32_t *)NFA_DATA(tb[NFULA_IFINDEX_PHYSOUTDEV-1])); - printf("physoutdev=%u ", ifi); - } -#endif - if (tb[NFULA_PREFIX-1]) { - char *prefix = NFA_DATA(tb[NFULA_PREFIX-1]); - printf("prefix=\"%s\" ", prefix); - } - if (tb[NFULA_PAYLOAD-1]) { - printf("payload_len=%d ", NFA_PAYLOAD(tb[NFULA_PAYLOAD-1])); - } - - fputc('\n', stdout); - return 0; -} - -static int cb(struct nfulnl_g_handle *gh, struct nfgenmsg *nfmsg, - struct nfattr *nfa[], void *data) -{ - print_pkt(nfa); -} - - -int main(int argc, char **argv) -{ - struct nfulnl_handle *h; - struct nfulnl_g_handle *qh; - struct nfulnl_g_handle *qh100; - struct nfnl_handle *nh; - int rv, fd; - char buf[4096]; - - h = nfulnl_open(); - if (!h) { - fprintf(stderr, "error during nfulnl_open()\n"); - exit(1); - } - - printf("unbinding existing nf_log handler for AF_INET (if any)\n"); - if (nfulnl_unbind_pf(h, AF_INET) < 0) { - fprintf(stderr, "error nfulnl_unbind_pf()\n"); - exit(1); - } - - printf("binding nfnetlink_log to AF_INET\n"); - if (nfulnl_bind_pf(h, AF_INET) < 0) { - fprintf(stderr, "error during nfulnl_bind_pf()\n"); - exit(1); - } - printf("binding this socket to group 0\n"); - qh = nfulnl_bind_group(h, 0); - if (!qh) { - fprintf(stderr, "no handle for grup 0\n"); - exit(1); - } - - printf("binding this socket to group 100\n"); - qh100 = nfulnl_bind_group(h, 100); - if (!qh100) { - fprintf(stderr, "no handle for group 100\n"); - exit(1); - } - - printf("setting copy_packet mode\n"); - if (nfulnl_set_mode(qh, NFULNL_COPY_PACKET, 0xffff) < 0) { - fprintf(stderr, "can't set packet copy mode\n"); - exit(1); - } - - nh = nfulnl_nfnlh(h); - fd = nfnl_fd(nh); - - printf("registering callback for group 0\n"); - nfulnl_callback_register(qh, &cb, NULL); - - printf("going into main loop\n"); - while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) { - struct nlmsghdr *nlh; - printf("pkt received (len=%u)\n", rv); - -#if 0 - for (nlh = nfnl_get_msg_first(nh, buf, rv); - nlh; nlh = nfnl_get_msg_next(nh, buf, rv)) { - struct nfattr *tb[NFULA_MAX]; - struct nfgenmsg *nfmsg; - - printf("msg received: "); - nfnl_parse_hdr(nh, nlh, &nfmsg); - rv = nfnl_parse_attr(tb, NFULA_MAX, NFM_NFA(NLMSG_DATA(nlh)), nlh->nlmsg_len-NLMSG_ALIGN(sizeof(struct nfgenmsg))); - if (rv < 0) { - printf("error during parse: %d\n", rv); - break; - } - print_pkt(tb); - } -#else - /* handle messages in just-received packet */ - nfulnl_handle_packet(h, buf, rv); -#endif - } - - printf("unbinding from group 100\n"); - nfulnl_unbind_group(qh100); - printf("unbinding from group 0\n"); - nfulnl_unbind_group(qh); - -#ifdef INSANE - /* norally, applications SHOULD NOT issue this command, - * since it detaches other programs/sockets from AF_INET, too ! */ - printf("unbinding from AF_INET\n"); - nfulnl_unbind_pf(h, AF_INET); -#endif - - printf("closing handle\n"); - nfulnl_close(h); - - exit(0); -} diff --git a/_log/utils/ulog_test.c b/_log/utils/ulog_test.c deleted file mode 100644 index f8515d3..0000000 --- a/_log/utils/ulog_test.c +++ /dev/null @@ -1,87 +0,0 @@ -/* ulog_test, $Revision: 1.4 $ - * - * small testing program for libipulog, part of the netfilter ULOG target - * for the linux 2.4 netfilter subsystem. - * - * (C) 2000 by Harald Welte - * - * this code is released under the terms of GNU GPL - * - * $Id: ulog_test.c 286 2002-06-13 12:56:53Z laforge $ - */ - -#include -#include -#include -#include - -#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; - int len; - ulog_packet_msg_t *upkt; - int i; - - if (argc != 4) { - fprintf(stderr, "Usage: %s count group timeout\n", argv[0]); - exit(2); - } - - /* allocate a receive buffer */ - buf = (unsigned char *) malloc(MYBUFSIZ); - if (!buf) - exit(1); - - /* create ipulog handle */ - h = ipulog_create_handle(ipulog_group2gmask(atoi(argv[2])), 65535); - 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, MYBUFSIZ, 1); - if (len <= 0) { - ipulog_perror("ulog_test: short read"); - exit(1); - } - printf("%d bytes received\n", len); - while (upkt = ipulog_get_packet(h, buf, len)) { - handle_packet(upkt); - } - } - - /* just to give it a cleaner look */ - ipulog_destroy_handle(h); - return 0; -} -- cgit v1.2.3