Hello community, here is the log from the commit of package libnetfilter_acct for openSUSE:Factory checked in at 2012-10-23 19:38:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libnetfilter_acct (Old) and /work/SRC/openSUSE:Factory/.libnetfilter_acct.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libnetfilter_acct", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/libnetfilter_acct/libnetfilter_acct.changes 2012-03-29 07:45:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libnetfilter_acct.new/libnetfilter_acct.changes 2012-10-23 19:38:56.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Oct 8 23:49:34 UTC 2012 - [email protected] + +- Update to new upstream release 1.0.1 +* This release adds the new flag NFACCT_SNPRINTF_T_XML for + nfacct_snprintf and several cleanups. + +------------------------------------------------------------------- Old: ---- libnetfilter_acct-1.0.0.tar.bz2 libnetfilter_acct-1.0.0.tar.bz2.sig New: ---- libnetfilter_acct-1.0.1.tar.bz2 libnetfilter_acct-1.0.1.tar.bz2.sig rhel5-patch1.diff rhel5-patch2.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libnetfilter_acct.spec ++++++ --- /var/tmp/diff_new_pack.EAIYlm/_old 2012-10-23 19:39:06.000000000 +0200 +++ /var/tmp/diff_new_pack.EAIYlm/_new 2012-10-23 19:39:06.000000000 +0200 @@ -18,21 +18,28 @@ Name: libnetfilter_acct %define lname %{name}1 -Version: 1.0.0 +Version: 1.0.1 Release: 0 +Summary: Userspace library for the in-kernel Netfilter counters +License: LGPL-2.1+ +Group: Productivity/Networking/Security Url: http://netfilter.org/projects/libnetfilter_acct/ -Source: %name-%version.tar.bz2 -Source2: %name-%version.tar.bz2.sig + +#Git-Clone: git://git.netfilter.org/libnetfilter_acct +#DL-URL: http://netfilter.org/projects/libnetfilter_acct/files/ +Source: http://netfilter.org/projects/libnetfilter_acct/files/%name-%version.tar.bz2 +Source2: http://netfilter.org/projects/libnetfilter_acct/files/%name-%version.tar.bz2.sig Source3: baselibs.conf +Patch1: rhel5-patch1.diff +Patch2: rhel5-patch2.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: autoconf -BuildRequires: automake >= 1.6 -BuildRequires: libtool +#git#BuildRequires: autoconf, automake >= 1.6, libtool BuildRequires: pkgconfig >= 0.21 +%if 0%{?suse_version} >= 1210 || 0%{?fedora_version} BuildRequires: pkgconfig(libmnl) >= 1.0.0 -Summary: Userspace library for the in-kernel Netfilter counters -License: LGPL-2.1+ -Group: Productivity/Networking/Security +%else +BuildRequires: libmnl-devel >= 1.0.0 +%endif %description This library provides the programming interface (API) to the @@ -56,12 +63,8 @@ Netfilter extended accounting infrastructure. %prep -%if 0%{?__xz:1} %setup -q -%else -tar -xf "%{S:0}" --use=bzip2; -%setup -DTq -%endif +%patch -P 1 -P 2 -p1 %build if [ ! -e configure ]; then @@ -71,7 +74,7 @@ make %{?_smp_mflags} %install -%makeinstall +make install DESTDIR="%buildroot"; rm -f "%buildroot/%_libdir"/*.la; %post -n %lname -p /sbin/ldconfig @@ -80,11 +83,11 @@ %files -n %lname %defattr(-,root,root) -%_libdir/libnetfilter_acct.so.* +%_libdir/libnetfilter_acct.so.1* %files devel %defattr(-,root,root) -%_includedir/libnetfilter_acct* +%_includedir/%name-%version %_libdir/libnetfilter_acct.so %_libdir/pkgconfig/libnetfilter_acct.pc ++++++ libnetfilter_acct-1.0.0.tar.bz2 -> libnetfilter_acct-1.0.1.tar.bz2 ++++++ ++++ 5820 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/Makefile.am new/libnetfilter_acct-1.0.1/Makefile.am --- old/libnetfilter_acct-1.0.0/Makefile.am 2011-12-29 19:29:20.000000000 +0100 +++ new/libnetfilter_acct-1.0.1/Makefile.am 2012-06-26 16:47:02.000000000 +0200 @@ -7,5 +7,3 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnetfilter_acct.pc - -${pkgconfig_DATA}: ${top_builddir}/config.status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/build-aux/compile new/libnetfilter_acct-1.0.1/build-aux/compile --- old/libnetfilter_acct-1.0.0/build-aux/compile 2012-03-27 11:54:55.000000000 +0200 +++ new/libnetfilter_acct-1.0.1/build-aux/compile 2012-10-09 00:41:30.000000000 +0200 @@ -1,10 +1,10 @@ #! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. +# Wrapper for compilers which do not understand '-c -o'. -scriptversion=2009-10-06.20; # UTC +scriptversion=2012-03-05.13; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software -# Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free +# Software Foundation, Inc. # Written by Tom Tromey <[email protected]>. # # This program is free software; you can redistribute it and/or modify @@ -29,21 +29,219 @@ # bugs to <[email protected]> or send patches to # <[email protected]>. +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + case $1 in '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. +right script to run: please start by reading the file 'INSTALL'. Report bugs to <[email protected]>. EOF @@ -53,11 +251,13 @@ echo "compile $scriptversion" exit $? ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; esac ofile= cfile= -eat= for arg do @@ -66,8 +266,8 @@ else case $1 in -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) @@ -94,10 +294,10 @@ done if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a + # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also + # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi @@ -106,7 +306,7 @@ cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. -# Note: use `[/\\:.-]' here to ensure that we don't use the same name +# Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/build-aux/missing new/libnetfilter_acct-1.0.1/build-aux/missing --- old/libnetfilter_acct-1.0.0/build-aux/missing 2012-03-27 11:54:55.000000000 +0200 +++ new/libnetfilter_acct-1.0.1/build-aux/missing 2012-10-09 00:41:30.000000000 +0200 @@ -1,10 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2009-04-28.21; # UTC +scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <[email protected]>, 1996. # This program is free software; you can redistribute it and/or modify @@ -84,7 +84,6 @@ help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and @@ -122,15 +121,6 @@ # Not GNU programs, they don't have --version. ;; - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. @@ -226,7 +216,7 @@ \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` @@ -256,7 +246,7 @@ \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` @@ -318,41 +308,6 @@ touch $file ;; - tar*) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/configure.ac new/libnetfilter_acct-1.0.1/configure.ac --- old/libnetfilter_acct-1.0.0/configure.ac 2011-12-30 00:38:06.000000000 +0100 +++ new/libnetfilter_acct-1.0.1/configure.ac 2012-06-22 17:51:41.000000000 +0200 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to create configure. -AC_INIT([libnetfilter_acct], [1.0.0]) +AC_INIT([libnetfilter_acct], [1.0.1]) AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_HOST AC_CONFIG_MACRO_DIR([m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/include/libnetfilter_acct/libnetfilter_acct.h new/libnetfilter_acct-1.0.1/include/libnetfilter_acct/libnetfilter_acct.h --- old/libnetfilter_acct-1.0.0/include/libnetfilter_acct/libnetfilter_acct.h 2012-03-26 16:48:51.000000000 +0200 +++ new/libnetfilter_acct-1.0.1/include/libnetfilter_acct/libnetfilter_acct.h 2012-06-22 17:30:48.000000000 +0200 @@ -30,7 +30,8 @@ void nfacct_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfacct *nfacct); int nfacct_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfacct *nfacct); -#define NFACCT_SNPRINTF_F_FULL (1 << 0) +#define NFACCT_SNPRINTF_F_FULL (1 << 0) +#define NFACCT_SNPRINTF_F_TIME (1 << 1) #define NFACCT_SNPRINTF_T_PLAIN 0 #define NFACCT_SNPRINTF_T_XML 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/m4/libtool.m4 new/libnetfilter_acct-1.0.1/m4/libtool.m4 --- old/libnetfilter_acct-1.0.0/m4/libtool.m4 2012-03-27 11:54:52.000000000 +0200 +++ new/libnetfilter_acct-1.0.1/m4/libtool.m4 2012-10-09 00:41:25.000000000 +0200 @@ -2512,17 +2512,6 @@ esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2628,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3244,6 @@ fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3282,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4034,7 @@ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4333,7 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6226,6 @@ _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6387,7 @@ _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libnetfilter_acct-1.0.0/src/libnetfilter_acct.c new/libnetfilter_acct-1.0.1/src/libnetfilter_acct.c --- old/libnetfilter_acct-1.0.0/src/libnetfilter_acct.c 2012-03-27 11:23:38.000000000 +0200 +++ new/libnetfilter_acct-1.0.1/src/libnetfilter_acct.c 2012-10-09 00:30:50.000000000 +0200 @@ -208,7 +208,7 @@ const char * nfacct_attr_get_str(struct nfacct *nfacct, enum nfacct_attr_type type) { - return (char *)nfacct_attr_get(nfacct, type); + return nfacct_attr_get(nfacct, type); } EXPORT_SYMBOL(nfacct_attr_get_str); @@ -227,6 +227,99 @@ } EXPORT_SYMBOL(nfacct_attr_get_u64); +static int +nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct, + uint16_t flags) +{ + int ret; + + if (flags & NFACCT_SNPRINTF_F_FULL) { + ret = snprintf(buf, rem, + "{ pkts = %.20lu, bytes = %.20lu } = %s;", + nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES), + nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS), + nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME)); + } else { + ret = snprintf(buf, rem, "%s\n", + nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME)); + } + + return ret; +} + +#define BUFFER_SIZE(ret, size, rem, offset) \ + size += ret; \ + if (ret > rem) \ + ret = rem; \ + offset += ret; \ + rem -= ret; + +static int +nfacct_snprintf_xml_localtime(char *buf, unsigned int rem, const struct tm *tm) +{ + int ret = 0; + unsigned int size = 0, offset = 0; + + ret = snprintf(buf+offset, rem, "<hour>%d</hour>", tm->tm_hour); + BUFFER_SIZE(ret, size, rem, offset); + + ret = snprintf(buf+offset, rem, "<min>%02d</min>", tm->tm_min); + BUFFER_SIZE(ret, size, rem, offset); + + ret = snprintf(buf+offset, rem, "<sec>%02d</sec>", tm->tm_sec); + BUFFER_SIZE(ret, size, rem, offset); + + ret = snprintf(buf+offset, rem, "<wday>%d</wday>", tm->tm_wday + 1); + BUFFER_SIZE(ret, size, rem, offset); + + ret = snprintf(buf+offset, rem, "<day>%d</day>", tm->tm_mday); + BUFFER_SIZE(ret, size, rem, offset); + + ret = snprintf(buf+offset, rem, "<month>%d</month>", tm->tm_mon + 1); + BUFFER_SIZE(ret, size, rem, offset); + + ret = snprintf(buf+offset, rem, "<year>%d</year>", 1900 + tm->tm_year); + BUFFER_SIZE(ret, size, rem, offset); + + return size; +} + + +static int +nfacct_snprintf_xml(char *buf, size_t rem, struct nfacct *nfacct, + uint16_t flags) +{ + int ret = 0; + unsigned int size = 0, offset = 0; + + ret = snprintf(buf, rem, + "<obj><name>%s</name>" + "<pkts>%.20lu</pkts>" + "<bytes>%.20lu</bytes>", + nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME), + nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES), + nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS)); + BUFFER_SIZE(ret, size, rem, offset); + + if (flags & NFACCT_SNPRINTF_F_TIME) { + time_t t; + struct tm tm; + + t = time(NULL); + if (localtime_r(&t, &tm) == NULL) + goto err; + + ret = nfacct_snprintf_xml_localtime(buf+offset, rem, &tm); + BUFFER_SIZE(ret, size, rem, offset); + } + + ret = snprintf(buf+offset, rem, "</obj>"); + BUFFER_SIZE(ret, size, rem, offset); + +err: + return ret; +} + /** * nfacct_snprintf - print accounting object into one buffer * \param buf: pointer to buffer that is used to print the object @@ -245,29 +338,10 @@ switch(type) { case NFACCT_SNPRINTF_T_PLAIN: - if (flags & NFACCT_SNPRINTF_F_FULL) { - ret = snprintf(buf, size, - "{ pkts = %.20llu, bytes = %.20llu } = %s;", - (unsigned long long) - nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES), - (unsigned long long) - nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS), - nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME)); - } else { - ret = snprintf(buf, size, "%s\n", - nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME)); - } + ret = nfacct_snprintf_plain(buf, size, nfacct, flags); break; case NFACCT_SNPRINTF_T_XML: - ret = snprintf(buf, size, - "<obj><name>%s</name>" - "<pkts>%.20llu</pkts>" - "<bytes>%.20llu</bytes></obj>", - nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME), - (unsigned long long) - nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES), - (unsigned long long) - nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS)); + ret = nfacct_snprintf_xml(buf, size, nfacct, flags); break; default: ret = -1; @@ -368,11 +442,6 @@ } break; case NFACCT_PKTS: - if (mnl_attr_validate(attr, MNL_TYPE_U64) < 0) { - perror("mnl_attr_validate"); - return MNL_CB_ERROR; - } - break; case NFACCT_BYTES: if (mnl_attr_validate(attr, MNL_TYPE_U64) < 0) { perror("mnl_attr_validate"); ++++++ rhel5-patch1.diff ++++++ >From d4a740659e127f6950ac8c43ef4f6a641594ed89 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt <[email protected]> Date: Sat, 13 Oct 2012 13:50:53 +0200 Subject: [PATCH 1/2] build: resolve compile abort on RHEL5 #1 [ 24s] In file included from libnetfilter_acct.c:18: [ 24s] ../include/linux/netfilter/nfnetlink.h:4:46: error: linux/netfilter/nfnetlink_compat.h: No such file or directory Slurp in new headers from the kernel du jour (v3.6-10970-g4d7127d). Signed-off-by: Jan Engelhardt <[email protected]> --- include/linux/netfilter/nfnetlink.h | 50 +++-------------------- include/linux/netfilter/nfnetlink_acct.h | 15 ++----- include/linux/netfilter/nfnetlink_compat.h | 61 ++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 56 deletions(-) create mode 100644 include/linux/netfilter/nfnetlink_compat.h diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index b64454c..4a4efaf 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h @@ -1,5 +1,5 @@ -#ifndef _NFNETLINK_H -#define _NFNETLINK_H +#ifndef _UAPI_NFNETLINK_H +#define _UAPI_NFNETLINK_H #include <linux/types.h> #include <linux/netfilter/nfnetlink_compat.h> @@ -49,46 +49,8 @@ struct nfgenmsg { #define NFNL_SUBSYS_OSF 5 #define NFNL_SUBSYS_IPSET 6 #define NFNL_SUBSYS_ACCT 7 -#define NFNL_SUBSYS_COUNT 8 +#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 +#define NFNL_SUBSYS_CTHELPER 9 +#define NFNL_SUBSYS_COUNT 10 -#ifdef __KERNEL__ - -#include <linux/netlink.h> -#include <linux/capability.h> -#include <net/netlink.h> - -struct nfnl_callback { - int (*call)(struct sock *nl, struct sk_buff *skb, - const struct nlmsghdr *nlh, - const struct nlattr * const cda[]); - int (*call_rcu)(struct sock *nl, struct sk_buff *skb, - const struct nlmsghdr *nlh, - const struct nlattr * const cda[]); - const struct nla_policy *policy; /* netlink attribute policy */ - const u_int16_t attr_count; /* number of nlattr's */ -}; - -struct nfnetlink_subsystem { - const char *name; - __u8 subsys_id; /* nfnetlink subsystem ID */ - __u8 cb_count; /* number of callbacks */ - const struct nfnl_callback *cb; /* callback for individual types */ -}; - -extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); -extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); - -extern int nfnetlink_has_listeners(struct net *net, unsigned int group); -extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, - int echo, gfp_t flags); -extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); -extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); - -extern void nfnl_lock(void); -extern void nfnl_unlock(void); - -#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ - MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) - -#endif /* __KERNEL__ */ -#endif /* _NFNETLINK_H */ +#endif /* _UAPI_NFNETLINK_H */ diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h index 7c4279b..c7b6269 100644 --- a/include/linux/netfilter/nfnetlink_acct.h +++ b/include/linux/netfilter/nfnetlink_acct.h @@ -1,5 +1,5 @@ -#ifndef _NFNL_ACCT_H_ -#define _NFNL_ACCT_H_ +#ifndef _UAPI_NFNL_ACCT_H_ +#define _UAPI_NFNL_ACCT_H_ #ifndef NFACCT_NAME_MAX #define NFACCT_NAME_MAX 32 @@ -23,14 +23,5 @@ enum nfnl_acct_type { }; #define NFACCT_MAX (__NFACCT_MAX - 1) -#ifdef __KERNEL__ -struct nf_acct; - -extern struct nf_acct *nfnl_acct_find_get(const char *filter_name); -extern void nfnl_acct_put(struct nf_acct *acct); -extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct); - -#endif /* __KERNEL__ */ - -#endif /* _NFNL_ACCT_H */ +#endif /* _UAPI_NFNL_ACCT_H_ */ diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h new file mode 100644 index 0000000..74b9e55 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_compat.h @@ -0,0 +1,61 @@ +#ifndef _NFNETLINK_COMPAT_H +#define _NFNETLINK_COMPAT_H + +#include <linux/types.h> + +/* Old nfnetlink macros for userspace */ + +/* nfnetlink groups: Up to 32 maximum */ +#define NF_NETLINK_CONNTRACK_NEW 0x00000001 +#define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 +#define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 +#define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 +#define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 +#define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 + +/* Generic structure for encapsulation optional netfilter information. + * It is reminiscent of sockaddr, but with sa_family replaced + * with attribute type. + * ! This should someday be put somewhere generic as now rtnetlink and + * ! nfnetlink use the same attributes methods. - J. Schulist. + */ + +struct nfattr { + __u16 nfa_len; + __u16 nfa_type; /* we use 15 bits for the type, and the highest + * bit to indicate whether the payload is nested */ +}; + +/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from + * rtnetlink.h, it's time to put this in a generic file */ + +#define NFNL_NFA_NEST 0x8000 +#define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) + +#define NFA_ALIGNTO 4 +#define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) +#define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ + && (nfa)->nfa_len <= (len)) +#define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ + (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) +#define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) +#define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) +#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) +#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) +#define NFA_NEST(skb, type) \ +({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ + NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ + __start; }) +#define NFA_NEST_END(skb, start) \ +({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ + (skb)->len; }) +#define NFA_NEST_CANCEL(skb, start) \ +({ if (start) \ + skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ + -1; }) + +#define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ + + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) +#define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) + +#endif /* _NFNETLINK_COMPAT_H */ -- 1.7.10.4 ++++++ rhel5-patch2.diff ++++++ >From e01126788f5d1eb4b2b1bc3de72a419a18a5ba7e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt <[email protected]> Date: Sat, 13 Oct 2012 14:05:47 +0200 Subject: [PATCH 2/2] build: resolve compile abort on RHEL5 #2 libnetfilter_acct.c: In function 'nfacct_nlmsg_build_payload': libnetfilter_acct.c:422: warning: implicit declaration of function 'htobe64' libnetfilter_acct.c: In function 'nfacct_nlmsg_parse_payload': libnetfilter_acct.c:477: warning: implicit declaration of function 'be64toh' Signed-off-by: Jan Engelhardt <[email protected]> --- src/internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/internal.h b/src/internal.h index 3a88d1a..2106401 100644 --- a/src/internal.h +++ b/src/internal.h @@ -9,4 +9,16 @@ # define EXPORT_SYMBOL #endif +#include <endian.h> +#if !defined(htobe64) +# include <byteswap.h> +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define htobe64(x) __bswap_64(x) +# define betoh64(x) __bswap_64(x) +# else +# define htobe64(x) (x) +# define betoh64(x) (x) +# endif +#endif + #endif -- 1.7.10.4 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
