From 3fd6b24ace319b139ec3c4e3031a5f05d21e304e Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 15 Jun 2010 13:30:55 +0200 Subject: ipset 5 in an almost ready state - milestone Reworked protocol and internal interfaces, missing set types added, backward compatibility verified, lots of tests added (and thanks to the tests, bugs fixed), even the manpage is rewritten ;-). Countless changes everywhere... The missing bits before announcing ipset 5: - net namespace support - new iptables/ip6tables extension library - iptables/ip6tables match and target tests (backward/forward compatibility) - tests on catching syntax errors --- tests/Makefile | 450 +++++++++++++++++++++++++++++++++++++++ tests/Makefile.am | 5 + tests/Makefile.in | 450 +++++++++++++++++++++++++++++++++++++++ tests/bitmap:ip.t | 16 +- tests/bitmap:ip.t.list0 | 3 +- tests/bitmap:ip.t.list1 | 3 +- tests/bitmap:ip.t.list2 | 3 +- tests/bitmap:ip.t.list3 | 3 +- tests/bitmap:ip.t.list4 | 13 ++ tests/bitmap:ip.t.list5 | 9 + tests/bitmap:ip.t.list6 | 265 +++++++++++++++++++++++ tests/hash:ip,port,ip.t | 51 +++++ tests/hash:ip,port,ip.t.list0 | 11 + tests/hash:ip,port,ip.t.list1 | 7 + tests/hash:ip,port.t | 43 ++++ tests/hash:ip,port.t.list0 | 11 + tests/hash:ip,port.t.list1 | 7 + tests/hash:ip.t | 14 +- tests/hash:ip.t.list0 | 5 +- tests/hash:ip.t.list1 | 5 +- tests/hash:ip.t.list2 | 9 + tests/hash:ip.t.list3 | 10 + tests/hash:ip6,port,ip6.t | 51 +++++ tests/hash:ip6,port,ip6.t.list0 | 11 + tests/hash:ip6,port,ip6.t.list1 | 7 + tests/hash:ip6,port,net6.t | 45 ++++ tests/hash:ip6,port,net6.t.list0 | 11 + tests/hash:ip6,port.t | 43 ++++ tests/hash:ip6,port.t.list0 | 11 + tests/hash:ip6,port.t.list1 | 7 + tests/hash:ip6.t | 77 +++++++ tests/hash:ip6.t.list0 | 8 + tests/hash:ip6.t.list1 | 8 + tests/hash:ip6.t.list2 | 9 + tests/hash:ip6.t.list3 | 10 + tests/hash:net.t | 49 +++++ tests/hash:net.t.list0 | 11 + tests/hash:net.t.list1 | 7 + tests/hash:net6.t | 49 +++++ tests/hash:net6.t.list0 | 11 + tests/hash:net6.t.list1 | 7 + tests/iphash.t | 10 +- tests/iphash.t.list0 | 5 +- tests/iphash.t.list1 | 5 +- tests/ipmap.t | 2 +- tests/ipmap.t.list0 | 3 +- tests/ipmap.t.list1 | 3 +- tests/ipmap.t.list2 | 3 +- tests/ipmap.t.list3 | 3 +- tests/ipmap.t.list4 | 3 +- tests/ipporthash.t | 44 ++-- tests/ipporthash.t.list0 | 8 +- tests/ipporthash.t.list1 | 8 +- tests/ipportiphash.t | 40 ++-- tests/ipportiphash.t.list0 | 8 +- tests/ipportiphash.t.list1 | 6 +- tests/ipportnethash.t | 26 +-- tests/ipportnethash.t.list0 | 8 +- tests/ipportnethash.t.list1 | 8 +- tests/iptree.t | 2 +- tests/iptree.t.list0 | 7 +- tests/iptreemap.t | 4 +- tests/iptreemap.t.list0 | 35 ++- tests/macipmap.t | 12 +- tests/macipmap.t.list0 | 3 +- tests/macipmap.t.list1 | 3 +- tests/macipmap.t.list2 | 3 +- tests/macipmap.t.list3 | 10 + tests/nethash.t | 30 +-- tests/nethash.t.list0 | 8 +- tests/portmap.t | 6 + tests/portmap.t.list0 | 3 +- tests/portmap.t.list1 | 3 +- tests/portmap.t.list3 | 9 + tests/runtest.sh | 19 +- tests/setlist.t | 6 + tests/setlist.t.list0 | 5 +- tests/sort.sh | 4 +- 78 files changed, 2028 insertions(+), 162 deletions(-) create mode 100644 tests/Makefile create mode 100644 tests/Makefile.am create mode 100644 tests/Makefile.in create mode 100644 tests/bitmap:ip.t.list4 create mode 100644 tests/bitmap:ip.t.list5 create mode 100644 tests/bitmap:ip.t.list6 create mode 100644 tests/hash:ip,port,ip.t create mode 100644 tests/hash:ip,port,ip.t.list0 create mode 100644 tests/hash:ip,port,ip.t.list1 create mode 100644 tests/hash:ip,port.t create mode 100644 tests/hash:ip,port.t.list0 create mode 100644 tests/hash:ip,port.t.list1 create mode 100644 tests/hash:ip.t.list2 create mode 100644 tests/hash:ip.t.list3 create mode 100644 tests/hash:ip6,port,ip6.t create mode 100644 tests/hash:ip6,port,ip6.t.list0 create mode 100644 tests/hash:ip6,port,ip6.t.list1 create mode 100644 tests/hash:ip6,port,net6.t create mode 100644 tests/hash:ip6,port,net6.t.list0 create mode 100644 tests/hash:ip6,port.t create mode 100644 tests/hash:ip6,port.t.list0 create mode 100644 tests/hash:ip6,port.t.list1 create mode 100644 tests/hash:ip6.t create mode 100644 tests/hash:ip6.t.list0 create mode 100644 tests/hash:ip6.t.list1 create mode 100644 tests/hash:ip6.t.list2 create mode 100644 tests/hash:ip6.t.list3 create mode 100644 tests/hash:net.t create mode 100644 tests/hash:net.t.list0 create mode 100644 tests/hash:net.t.list1 create mode 100644 tests/hash:net6.t create mode 100644 tests/hash:net6.t.list0 create mode 100644 tests/hash:net6.t.list1 create mode 100644 tests/macipmap.t.list3 create mode 100644 tests/portmap.t.list3 (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..c9fcefc --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,450 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# tests/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +pkgdatadir = $(datadir)/ipset +pkglibdir = $(libdir)/ipset +pkgincludedir = $(includedir)/ipset +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +target_triplet = x86_64-unknown-linux-gnu +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Make_global.am +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /root/ipset/missing --run aclocal-1.10 +AMTAR = ${SHELL} /root/ipset/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /root/ipset/missing --run autoconf +AUTOHEADER = ${SHELL} /root/ipset/missing --run autoheader +AUTOMAKE = ${SHELL} /root/ipset/missing --run automake-1.10 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = +CXXDEPMODE = depmode=none +CXXFLAGS = +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DSYMUTIL = +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +F77 = +FFLAGS = +GREP = /bin/grep +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = -lmnl +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /root/ipset/missing --run makeinfo +MKDIR_P = /bin/mkdir -p +NMEDIT = +OBJEXT = o +PACKAGE = ipset +PACKAGE_BUGREPORT = kadlec@blackhole.kfki.hu +PACKAGE_NAME = ipset +PACKAGE_STRING = ipset 5.0 +PACKAGE_TARNAME = ipset +PACKAGE_VERSION = 5.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +VERSION = 5.0 +abs_builddir = /root/ipset/tests +abs_srcdir = /root/ipset/tests +abs_top_builddir = /root/ipset +abs_top_srcdir = /root/ipset +ac_ct_CC = gcc +ac_ct_CXX = +ac_ct_F77 = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = $(SHELL) /root/ipset/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = /bin/mkdir -p +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target = x86_64-unknown-linux-gnu +target_alias = +target_cpu = x86_64 +target_os = linux-gnu +target_vendor = unknown +top_builddir = .. +top_srcdir = .. + +# This is _NOT_ the library release version, it's an API version. +# Please read Chapter 6 "Library interface versions" of the libtool +# documentation before making any modification +# http://sources.redhat.com/autobook/autobook/autobook_91.html +LIBVERSION = 1:0:0 +AM_CPPFLAGS = $(kinclude_CFLAGS) $(all_includes) -I$(top_srcdir)/include \ + -I/usr/local/include + +# -Wconversion \ -> false warnings +# -Wcast-qual \ -> false warnings +# -Wpointer-arith \ -> we need it +# -std=gnu99 + +# -std=gnu99 ULLONG_MAX requires +AM_CFLAGS = -std=gnu99 \ + -Wall \ + -Wextra \ + -Waggregate-return \ + -Wbad-function-cast \ + -Wcast-align \ + -Wfloat-equal \ + -Winit-self \ + -Winline \ + -Wmissing-declarations \ + -Wmissing-format-attribute \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wold-style-definition \ + -Wpacked \ + -Wredundant-decls \ + -Wshadow \ + -Wsign-compare \ + -Wstrict-prototypes \ + -Wswitch-default \ + -Wundef \ + -Wwrite-strings \ + -Wno-missing-field-initializers \ + -Werror \ + -g -ggdb + + +# fails with ntoh*: +# -Wunreachable-code +AM_VERBOSE_CC = @echo " CC " $@; +AM_VERBOSE_CCLD = @echo " CCLD " $@; +TESTS = ./runtest.sh +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Make_global.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + clean-libtool distclean distclean-generic distclean-libtool \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..9b62557 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,5 @@ +## Process this file with automake to produce Makefile.in + +include $(top_srcdir)/Make_global.am + +TESTS = ./runtest.sh diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..5c47bc5 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,450 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Make_global.am +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This is _NOT_ the library release version, it's an API version. +# Please read Chapter 6 "Library interface versions" of the libtool +# documentation before making any modification +# http://sources.redhat.com/autobook/autobook/autobook_91.html +LIBVERSION = 1:0:0 +AM_CPPFLAGS = $(kinclude_CFLAGS) $(all_includes) -I$(top_srcdir)/include \ + -I/usr/local/include + +# -Wconversion \ -> false warnings +# -Wcast-qual \ -> false warnings +# -Wpointer-arith \ -> we need it +# -std=gnu99 + +# -std=gnu99 ULLONG_MAX requires +AM_CFLAGS = -std=gnu99 \ + -Wall \ + -Wextra \ + -Waggregate-return \ + -Wbad-function-cast \ + -Wcast-align \ + -Wfloat-equal \ + -Winit-self \ + -Winline \ + -Wmissing-declarations \ + -Wmissing-format-attribute \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wold-style-definition \ + -Wpacked \ + -Wredundant-decls \ + -Wshadow \ + -Wsign-compare \ + -Wstrict-prototypes \ + -Wswitch-default \ + -Wundef \ + -Wwrite-strings \ + -Wno-missing-field-initializers \ + -Werror \ + -g -ggdb + + +# fails with ntoh*: +# -Wunreachable-code +@VERBOSE_FALSE@AM_VERBOSE_CC = @echo " CC " $@; +@VERBOSE_FALSE@AM_VERBOSE_CCLD = @echo " CCLD " $@; +TESTS = ./runtest.sh +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Make_global.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + clean-libtool distclean distclean-generic distclean-libtool \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/bitmap:ip.t b/tests/bitmap:ip.t index b44f5c4..03cbe0d 100644 --- a/tests/bitmap:ip.t +++ b/tests/bitmap:ip.t @@ -23,21 +23,21 @@ # Range: Delete element not added to the set 1 ipset -D test 2.0.0.2 # Range: Delete element not added to the set, with exist flag -0 ipset -x -D test 2.0.0.2 +0 ipset -! -D test 2.0.0.2 # Range: Add element in the middle 0 ipset -A test 2.0.0.128 # Range: Add element in the middle again 1 ipset -A test 2.0.0.128 # Range: Add element in the middle again, with exist flag -0 ipset -x -A test 2.0.0.128 +0 ipset -! -A test 2.0.0.128 # Range: Delete the same element 0 ipset -D test 2.0.0.128 # Range: Add a range of elements 0 ipset -A test 2.0.0.128-2.0.0.131 timeout 6 # Range: List set -0 ipset list test > .foo +0 ipset list test | sed 's/timeout ./timeout x/' > .foo # Range: Check listing -0 grep '2.0.0.1 timeout' .foo >/dev/null +0 diff .foo bitmap:ip.t.list4 && rm .foo # Sleep 10s so that entries can time out 0 sleep 10s # Range: List set after timeout @@ -77,9 +77,9 @@ # Network: Delete the same element 0 ipset -D test 2.0.0.128 # Network: List set -0 ipset list test > .foo +0 ipset list test | sed 's/timeout ./timeout x/' > .foo # Network: Check listing -0 grep '2.0.255.255 timeout' .foo >/dev/null +0 diff .foo bitmap:ip.t.list5 && rm .foo # Sleep 10s so that entries can time out 0 sleep 10s # Network: List set @@ -118,8 +118,10 @@ 0 ipset -D test 10.2.0.0 # Subnets: Add a subnet of subnets 0 ipset -A test 10.8.0.0/16 timeout 8 +# Subnets: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo # Subnets: Check listing -0 ipset list test | grep '10.0.0.0 timeout' >/dev/null +0 diff .foo bitmap:ip.t.list6 && rm .foo # Sleep 10s so that entries can time out 0 sleep 10s # Subnets: List set diff --git a/tests/bitmap:ip.t.list0 b/tests/bitmap:ip.t.list0 index 0be60c0..5f6b35d 100644 --- a/tests/bitmap:ip.t.list0 +++ b/tests/bitmap:ip.t.list0 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 2.0.0.1-2.1.0.0 timeout 5 -Elements: 1 -Size in memory: 524288 +Size in memory: 524408 References: 0 Members: 2.1.0.0 timeout 0 diff --git a/tests/bitmap:ip.t.list1 b/tests/bitmap:ip.t.list1 index 02ccdaa..6064717 100644 --- a/tests/bitmap:ip.t.list1 +++ b/tests/bitmap:ip.t.list1 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 2.0.0.0-2.0.255.255 timeout 5 -Elements: 1 -Size in memory: 524288 +Size in memory: 524408 References: 0 Members: 2.0.0.0 timeout 0 diff --git a/tests/bitmap:ip.t.list2 b/tests/bitmap:ip.t.list2 index 7b17999..e00abc9 100644 --- a/tests/bitmap:ip.t.list2 +++ b/tests/bitmap:ip.t.list2 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 10.0.0.0-10.255.255.255 netmask 24 timeout 5 -Elements: 1 -Size in memory: 524288 +Size in memory: 524408 References: 0 Members: 10.255.255.0 timeout 0 diff --git a/tests/bitmap:ip.t.list3 b/tests/bitmap:ip.t.list3 index 677bb2a..2d5e7a7 100644 --- a/tests/bitmap:ip.t.list3 +++ b/tests/bitmap:ip.t.list3 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 0.0.0.0-255.255.255.255 netmask 16 timeout 5 -Elements: 2 -Size in memory: 524288 +Size in memory: 524408 References: 0 Members: 0.0.0.0 timeout 0 diff --git a/tests/bitmap:ip.t.list4 b/tests/bitmap:ip.t.list4 new file mode 100644 index 0000000..53004cf --- /dev/null +++ b/tests/bitmap:ip.t.list4 @@ -0,0 +1,13 @@ +Name: test +Type: bitmap:ip +Header: range 2.0.0.1-2.1.0.0 timeout x +Size in memory: 524408 +References: 0 +Members: +2.0.0.1 timeout x +2.0.0.128 timeout x +2.0.0.129 timeout x +2.0.0.130 timeout x +2.0.0.131 timeout x +2.1.0.0 timeout x + diff --git a/tests/bitmap:ip.t.list5 b/tests/bitmap:ip.t.list5 new file mode 100644 index 0000000..65d338d --- /dev/null +++ b/tests/bitmap:ip.t.list5 @@ -0,0 +1,9 @@ +Name: test +Type: bitmap:ip +Header: range 2.0.0.0-2.0.255.255 timeout x +Size in memory: 524408 +References: 0 +Members: +2.0.0.0 timeout x +2.0.255.255 timeout x + diff --git a/tests/bitmap:ip.t.list6 b/tests/bitmap:ip.t.list6 new file mode 100644 index 0000000..13b75ad --- /dev/null +++ b/tests/bitmap:ip.t.list6 @@ -0,0 +1,265 @@ +Name: test +Type: bitmap:ip +Header: range 10.0.0.0-10.255.255.255 netmask 24 timeout x +Size in memory: 524408 +References: 0 +Members: +10.0.0.0 timeout x +10.8.0.0 timeout x +10.8.1.0 timeout x +10.8.2.0 timeout x +10.8.3.0 timeout x +10.8.4.0 timeout x +10.8.5.0 timeout x +10.8.6.0 timeout x +10.8.7.0 timeout x +10.8.8.0 timeout x +10.8.9.0 timeout x +10.8.10.0 timeout x +10.8.11.0 timeout x +10.8.12.0 timeout x +10.8.13.0 timeout x +10.8.14.0 timeout x +10.8.15.0 timeout x +10.8.16.0 timeout x +10.8.17.0 timeout x +10.8.18.0 timeout x +10.8.19.0 timeout x +10.8.20.0 timeout x +10.8.21.0 timeout x +10.8.22.0 timeout x +10.8.23.0 timeout x +10.8.24.0 timeout x +10.8.25.0 timeout x +10.8.26.0 timeout x +10.8.27.0 timeout x +10.8.28.0 timeout x +10.8.29.0 timeout x +10.8.30.0 timeout x +10.8.31.0 timeout x +10.8.32.0 timeout x +10.8.33.0 timeout x +10.8.34.0 timeout x +10.8.35.0 timeout x +10.8.36.0 timeout x +10.8.37.0 timeout x +10.8.38.0 timeout x +10.8.39.0 timeout x +10.8.40.0 timeout x +10.8.41.0 timeout x +10.8.42.0 timeout x +10.8.43.0 timeout x +10.8.44.0 timeout x +10.8.45.0 timeout x +10.8.46.0 timeout x +10.8.47.0 timeout x +10.8.48.0 timeout x +10.8.49.0 timeout x +10.8.50.0 timeout x +10.8.51.0 timeout x +10.8.52.0 timeout x +10.8.53.0 timeout x +10.8.54.0 timeout x +10.8.55.0 timeout x +10.8.56.0 timeout x +10.8.57.0 timeout x +10.8.58.0 timeout x +10.8.59.0 timeout x +10.8.60.0 timeout x +10.8.61.0 timeout x +10.8.62.0 timeout x +10.8.63.0 timeout x +10.8.64.0 timeout x +10.8.65.0 timeout x +10.8.66.0 timeout x +10.8.67.0 timeout x +10.8.68.0 timeout x +10.8.69.0 timeout x +10.8.70.0 timeout x +10.8.71.0 timeout x +10.8.72.0 timeout x +10.8.73.0 timeout x +10.8.74.0 timeout x +10.8.75.0 timeout x +10.8.76.0 timeout x +10.8.77.0 timeout x +10.8.78.0 timeout x +10.8.79.0 timeout x +10.8.80.0 timeout x +10.8.81.0 timeout x +10.8.82.0 timeout x +10.8.83.0 timeout x +10.8.84.0 timeout x +10.8.85.0 timeout x +10.8.86.0 timeout x +10.8.87.0 timeout x +10.8.88.0 timeout x +10.8.89.0 timeout x +10.8.90.0 timeout x +10.8.91.0 timeout x +10.8.92.0 timeout x +10.8.93.0 timeout x +10.8.94.0 timeout x +10.8.95.0 timeout x +10.8.96.0 timeout x +10.8.97.0 timeout x +10.8.98.0 timeout x +10.8.99.0 timeout x +10.8.100.0 timeout x +10.8.101.0 timeout x +10.8.102.0 timeout x +10.8.103.0 timeout x +10.8.104.0 timeout x +10.8.105.0 timeout x +10.8.106.0 timeout x +10.8.107.0 timeout x +10.8.108.0 timeout x +10.8.109.0 timeout x +10.8.110.0 timeout x +10.8.111.0 timeout x +10.8.112.0 timeout x +10.8.113.0 timeout x +10.8.114.0 timeout x +10.8.115.0 timeout x +10.8.116.0 timeout x +10.8.117.0 timeout x +10.8.118.0 timeout x +10.8.119.0 timeout x +10.8.120.0 timeout x +10.8.121.0 timeout x +10.8.122.0 timeout x +10.8.123.0 timeout x +10.8.124.0 timeout x +10.8.125.0 timeout x +10.8.126.0 timeout x +10.8.127.0 timeout x +10.8.128.0 timeout x +10.8.129.0 timeout x +10.8.130.0 timeout x +10.8.131.0 timeout x +10.8.132.0 timeout x +10.8.133.0 timeout x +10.8.134.0 timeout x +10.8.135.0 timeout x +10.8.136.0 timeout x +10.8.137.0 timeout x +10.8.138.0 timeout x +10.8.139.0 timeout x +10.8.140.0 timeout x +10.8.141.0 timeout x +10.8.142.0 timeout x +10.8.143.0 timeout x +10.8.144.0 timeout x +10.8.145.0 timeout x +10.8.146.0 timeout x +10.8.147.0 timeout x +10.8.148.0 timeout x +10.8.149.0 timeout x +10.8.150.0 timeout x +10.8.151.0 timeout x +10.8.152.0 timeout x +10.8.153.0 timeout x +10.8.154.0 timeout x +10.8.155.0 timeout x +10.8.156.0 timeout x +10.8.157.0 timeout x +10.8.158.0 timeout x +10.8.159.0 timeout x +10.8.160.0 timeout x +10.8.161.0 timeout x +10.8.162.0 timeout x +10.8.163.0 timeout x +10.8.164.0 timeout x +10.8.165.0 timeout x +10.8.166.0 timeout x +10.8.167.0 timeout x +10.8.168.0 timeout x +10.8.169.0 timeout x +10.8.170.0 timeout x +10.8.171.0 timeout x +10.8.172.0 timeout x +10.8.173.0 timeout x +10.8.174.0 timeout x +10.8.175.0 timeout x +10.8.176.0 timeout x +10.8.177.0 timeout x +10.8.178.0 timeout x +10.8.179.0 timeout x +10.8.180.0 timeout x +10.8.181.0 timeout x +10.8.182.0 timeout x +10.8.183.0 timeout x +10.8.184.0 timeout x +10.8.185.0 timeout x +10.8.186.0 timeout x +10.8.187.0 timeout x +10.8.188.0 timeout x +10.8.189.0 timeout x +10.8.190.0 timeout x +10.8.191.0 timeout x +10.8.192.0 timeout x +10.8.193.0 timeout x +10.8.194.0 timeout x +10.8.195.0 timeout x +10.8.196.0 timeout x +10.8.197.0 timeout x +10.8.198.0 timeout x +10.8.199.0 timeout x +10.8.200.0 timeout x +10.8.201.0 timeout x +10.8.202.0 timeout x +10.8.203.0 timeout x +10.8.204.0 timeout x +10.8.205.0 timeout x +10.8.206.0 timeout x +10.8.207.0 timeout x +10.8.208.0 timeout x +10.8.209.0 timeout x +10.8.210.0 timeout x +10.8.211.0 timeout x +10.8.212.0 timeout x +10.8.213.0 timeout x +10.8.214.0 timeout x +10.8.215.0 timeout x +10.8.216.0 timeout x +10.8.217.0 timeout x +10.8.218.0 timeout x +10.8.219.0 timeout x +10.8.220.0 timeout x +10.8.221.0 timeout x +10.8.222.0 timeout x +10.8.223.0 timeout x +10.8.224.0 timeout x +10.8.225.0 timeout x +10.8.226.0 timeout x +10.8.227.0 timeout x +10.8.228.0 timeout x +10.8.229.0 timeout x +10.8.230.0 timeout x +10.8.231.0 timeout x +10.8.232.0 timeout x +10.8.233.0 timeout x +10.8.234.0 timeout x +10.8.235.0 timeout x +10.8.236.0 timeout x +10.8.237.0 timeout x +10.8.238.0 timeout x +10.8.239.0 timeout x +10.8.240.0 timeout x +10.8.241.0 timeout x +10.8.242.0 timeout x +10.8.243.0 timeout x +10.8.244.0 timeout x +10.8.245.0 timeout x +10.8.246.0 timeout x +10.8.247.0 timeout x +10.8.248.0 timeout x +10.8.249.0 timeout x +10.8.250.0 timeout x +10.8.251.0 timeout x +10.8.252.0 timeout x +10.8.253.0 timeout x +10.8.254.0 timeout x +10.8.255.0 timeout x +10.255.255.0 timeout x + diff --git a/tests/hash:ip,port,ip.t b/tests/hash:ip,port,ip.t new file mode 100644 index 0000000..3c74cd9 --- /dev/null +++ b/tests/hash:ip,port,ip.t @@ -0,0 +1,51 @@ +# Range: Create a set with timeout +0 ipset create test hash:ip,port,ip timeout 5 +# Range: Add partly zero valued element +0 ipset add test 2.0.0.1,0,0.0.0.0 +# Range: Test partly zero valued element +0 ipset test test 2.0.0.1,0,0.0.0.0 +# Range: Delete party zero valued element +0 ipset del test 2.0.0.1,0,0.0.0.0 +# Range: Add almost zero valued element +0 ipset add test 2.0.0.1,0,0.0.0.1 +# Range: Test almost zero valued element +0 ipset test test 2.0.0.1,0,0.0.0.1 +# Range: Delete almost zero valued element +0 ipset del test 2.0.0.1,0,0.0.0.1 +# Range: Add lower boundary +0 ipset add test 2.0.0.1,5,1.1.1.1 +# Range: Add upper boundary +0 ipset add test 2.1.0.0,128,2.2.2.2 +# Range: Test lower boundary +0 ipset test test 2.0.0.1,5,1.1.1.1 +# Range: Test upper boundary +0 ipset test test 2.1.0.0,128,2.2.2.2 +# Range: Test value not added to the set +1 ipset test test 2.0.0.1,5,1.1.1.2 +# Range: Test value not added to the set +1 ipset test test 2.0.0.1,6,1.1.1.1 +# Range: Test value not added to the set +1 ipset test test 2.0.0.2,6,1.1.1.1 +# Range: Test value before lower boundary +1 ipset test test 2.0.0.0,5,1.1.1.1 +# Range: Test value after upper boundary +1 ipset test test 2.1.0.1,128,2.2.2.2 +# Range: Try to add value before lower boundary +0 ipset add test 2.0.0.0,5,1.1.1.1 +# Range: Try to add value after upper boundary +0 ipset add test 2.1.0.1,128,2.2.2.2 +# Range: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list0 && rm .foo +# Range: Sleep 6s so that elements can time out +0 sleep 6 +# Range: List set +0 ipset list test > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list1 && rm .foo +# Range: Flush test set +0 ipset flush test +# Range: Delete test set +0 ipset destroy test +# eof diff --git a/tests/hash:ip,port,ip.t.list0 b/tests/hash:ip,port,ip.t.list0 new file mode 100644 index 0000000..b20c8d8 --- /dev/null +++ b/tests/hash:ip,port,ip.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:ip,port,ip +Header: family inet hashsize 1024 maxelem 65536 timeout x +Size in memory: 8720 +References: 0 +Members: +2.0.0.0,5,1.1.1.1 timeout x +2.0.0.1,5,1.1.1.1 timeout x +2.1.0.0,128,2.2.2.2 timeout x +2.1.0.1,128,2.2.2.2 timeout x + diff --git a/tests/hash:ip,port,ip.t.list1 b/tests/hash:ip,port,ip.t.list1 new file mode 100644 index 0000000..fb0b4a4 --- /dev/null +++ b/tests/hash:ip,port,ip.t.list1 @@ -0,0 +1,7 @@ +Name: test +Type: hash:ip,port,ip +Header: family inet hashsize 1024 maxelem 65536 timeout 5 +Size in memory: 8304 +References: 0 +Members: + diff --git a/tests/hash:ip,port.t b/tests/hash:ip,port.t new file mode 100644 index 0000000..cb88f96 --- /dev/null +++ b/tests/hash:ip,port.t @@ -0,0 +1,43 @@ +# Range: Create a set with timeout +0 ipset create test hash:ip,port timeout 5 +# Range: Add partly zero valued element +0 ipset add test 2.0.0.1,0 +# Range: Test partly zero valued element +0 ipset test test 2.0.0.1,0 +# Range: Delete partly zero valued element +0 ipset del test 2.0.0.1,0 +# Range: Add lower boundary +0 ipset add test 2.0.0.1,5 +# Range: Add upper boundary +0 ipset add test 2.1.0.0,128 +# Range: Test lower boundary +0 ipset test test 2.0.0.1,5 +# Range: Test upper boundary +0 ipset test test 2.1.0.0,128 +# Range: Test value not added to the set +1 ipset test test 2.0.0.1,4 +# Range: Delete value not added to the set +1 ipset del test 2.0.0.1,6 +# Range: Test value before lower boundary +1 ipset test test 2.0.0.0,5 +# Range: Test value after upper boundary +1 ipset test test 2.1.0.1,128 +# Range: Try to add value before lower boundary +0 ipset add test 2.0.0.0,5 +# Range: Try to add value after upper boundary +0 ipset add test 2.1.0.1,128 +# Range: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list0 && rm .foo +# Range: Sleep 6s so that elements can time out +0 sleep 6 +# Range: List set +0 ipset list test > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list1 && rm .foo +# Range: Flush test set +0 ipset flush test +# Range: Delete test set +0 ipset destroy test +# eof diff --git a/tests/hash:ip,port.t.list0 b/tests/hash:ip,port.t.list0 new file mode 100644 index 0000000..25d8632 --- /dev/null +++ b/tests/hash:ip,port.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:ip,port +Header: family inet hashsize 1024 maxelem 65536 timeout x +Size in memory: 8592 +References: 0 +Members: +2.0.0.0,5 timeout x +2.0.0.1,5 timeout x +2.1.0.0,128 timeout x +2.1.0.1,128 timeout x + diff --git a/tests/hash:ip,port.t.list1 b/tests/hash:ip,port.t.list1 new file mode 100644 index 0000000..d455117 --- /dev/null +++ b/tests/hash:ip,port.t.list1 @@ -0,0 +1,7 @@ +Name: test +Type: hash:ip,port +Header: family inet hashsize 1024 maxelem 65536 timeout 5 +Size in memory: 8304 +References: 0 +Members: + diff --git a/tests/hash:ip.t b/tests/hash:ip.t index de6b0df..c7bddb8 100644 --- a/tests/hash:ip.t +++ b/tests/hash:ip.t @@ -18,12 +18,16 @@ 0 ipset -A test 200.100.0.12 # IP: Delete the same value 0 ipset -D test 200.100.0.12 +# IP: List set +0 ipset -L test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# IP: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip.t.list2 && rm .foo # Sleep 6s so that element can time out 0 sleep 6 # IP: List set 0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 # IP: Check listing -0 diff .foo hash:ip.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo hash:ip.t.list0 && rm .foo # IP: Flush test set 0 ipset -F test # IP: Delete test set @@ -58,20 +62,22 @@ 0 ipset -T test 192.168.68.95 # Network: Test value not added to the set 1 ipset -T test 2.0.1.0 -# Network: List set -0 ipset -L test > .foo && grep '2.0.0.0 timeout' .foo >/dev/null && grep '192.168.68.0 timeout' .foo >/dev/null && rm .foo # Network: Add third element 0 ipset -A test 200.100.10.1 timeout 0 # Network: Add third random network 0 ipset -A test 200.100.0.12 # Network: Delete the same network 0 ipset -D test 200.100.0.12 +# Network: List set +0 ipset -L test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Network: Check listing +0 diff -I 'Size in memory.*' -I 'Size in memory.*' .foo hash:ip.t.list3 && rm .foo # Sleep 6s so that elements can time out 0 sleep 6 # Network: List set 0 ipset -L test > .foo # Network: Check listing -0 diff .foo hash:ip.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo hash:ip.t.list1 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set diff --git a/tests/hash:ip.t.list0 b/tests/hash:ip.t.list0 index cf2ecac..117faf2 100644 --- a/tests/hash:ip.t.list0 +++ b/tests/hash:ip.t.list0 @@ -1,8 +1,7 @@ Name: test Type: hash:ip -Header: hashsize 128 maxelem 65536 probes 4 resize 50 timeout 5 -Elements: 1 -Size in memory: 2048 +Header: family inet hashsize 128 maxelem 65536 timeout 5 +Size in memory: 1208 References: 0 Members: 192.168.68.69 timeout 0 diff --git a/tests/hash:ip.t.list1 b/tests/hash:ip.t.list1 index c564ba0..3189dae 100644 --- a/tests/hash:ip.t.list1 +++ b/tests/hash:ip.t.list1 @@ -1,8 +1,7 @@ Name: test Type: hash:ip -Header: hashsize 128 maxelem 65536 probes 4 resize 50 netmask 24 timeout 6 -Elements: 1 -Size in memory: 2048 +Header: family inet hashsize 128 maxelem 65536 netmask 24 timeout 6 +Size in memory: 1352 References: 0 Members: 200.100.10.0 timeout 0 diff --git a/tests/hash:ip.t.list2 b/tests/hash:ip.t.list2 new file mode 100644 index 0000000..468ba67 --- /dev/null +++ b/tests/hash:ip.t.list2 @@ -0,0 +1,9 @@ +Name: test +Type: hash:ip +Header: family inet hashsize 128 maxelem 65536 timeout x +Size in memory: 1280 +References: 0 +Members: +192.168.68.69 timeout x +2.0.0.1 timeout x + diff --git a/tests/hash:ip.t.list3 b/tests/hash:ip.t.list3 new file mode 100644 index 0000000..463f0a4 --- /dev/null +++ b/tests/hash:ip.t.list3 @@ -0,0 +1,10 @@ +Name: test +Type: hash:ip +Header: family inet hashsize 128 maxelem 65536 netmask 24 timeout x +Size in memory: 1352 +References: 0 +Members: +192.168.68.0 timeout x +2.0.0.0 timeout x +200.100.10.0 timeout x + diff --git a/tests/hash:ip6,port,ip6.t b/tests/hash:ip6,port,ip6.t new file mode 100644 index 0000000..84afdf9 --- /dev/null +++ b/tests/hash:ip6,port,ip6.t @@ -0,0 +1,51 @@ +# Range: Create a set with timeout +0 ipset create test hash:ip,port,ip family inet6 timeout 5 +# Range: Add partly zero valued element +0 ipset add test 2:0:0::1,0,0:0:0::0 +# Range: Test partly zero valued element +0 ipset test test 2:0:0::1,0,0:0:0::0 +# Range: Delete party zero valued element +0 ipset del test 2:0:0::1,0,0:0:0::0 +# Range: Add almost zero valued element +0 ipset add test 2:0:0::1,0,0:0:0::1 +# Range: Test almost zero valued element +0 ipset test test 2:0:0::1,0,0:0:0::1 +# Range: Delete almost zero valued element +0 ipset del test 2:0:0::1,0,0:0:0::1 +# Range: Add lower boundary +0 ipset add test 2:0:0::1,5,1:1:1::1 +# Range: Add upper boundary +0 ipset add test 2:1:0::0,128,2:2:2::2 +# Range: Test lower boundary +0 ipset test test 2:0:0::1,5,1:1:1::1 +# Range: Test upper boundary +0 ipset test test 2:1:0::0,128,2:2:2::2 +# Range: Test value not added to the set +1 ipset test test 2:0:0::1,5,1:1:1::2 +# Range: Test value not added to the set +1 ipset test test 2:0:0::1,6,1:1:1::1 +# Range: Test value not added to the set +1 ipset test test 2:0:0::2,6,1:1:1::1 +# Range: Test value before lower boundary +1 ipset test test 2:0:0::0,5,1:1:1::1 +# Range: Test value after upper boundary +1 ipset test test 2:1:0::1,128,2:2:2::2 +# Range: Try to add value before lower boundary +0 ipset add test 2:0:0::0,5,1:1:1::1 +# Range: Try to add value after upper boundary +0 ipset add test 2:1:0::1,128,2:2:2::2 +# Range: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list0 && rm .foo +# Range: Sleep 6s so that elements can time out +0 sleep 6 +# Range: List set +0 ipset list test > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list1 && rm .foo +# Range: Flush test set +0 ipset flush test +# Range: Delete test set +0 ipset destroy test +# eof diff --git a/tests/hash:ip6,port,ip6.t.list0 b/tests/hash:ip6,port,ip6.t.list0 new file mode 100644 index 0000000..84cdf5c --- /dev/null +++ b/tests/hash:ip6,port,ip6.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:ip,port,ip +Header: family inet6 hashsize 1024 maxelem 65536 timeout x +Size in memory: 9104 +References: 0 +Members: +2:1::1,128,2:2:2::2 timeout x +2:1::,128,2:2:2::2 timeout x +2::1,5,1:1:1::1 timeout x +2::,5,1:1:1::1 timeout x + diff --git a/tests/hash:ip6,port,ip6.t.list1 b/tests/hash:ip6,port,ip6.t.list1 new file mode 100644 index 0000000..16fdb92 --- /dev/null +++ b/tests/hash:ip6,port,ip6.t.list1 @@ -0,0 +1,7 @@ +Name: test +Type: hash:ip,port,ip +Header: family inet6 hashsize 1024 maxelem 65536 timeout 5 +Size in memory: 8304 +References: 0 +Members: + diff --git a/tests/hash:ip6,port,net6.t b/tests/hash:ip6,port,net6.t new file mode 100644 index 0000000..0041b5d --- /dev/null +++ b/tests/hash:ip6,port,net6.t @@ -0,0 +1,45 @@ +# Range: Create a set +0 ipset -N test ipportnethash -6 +# Range: Add zero valued element +1 ipset -A test 2:0:0::1,0,0:0:0::0/0 +# Range: Test zero valued element +1 ipset -T test 2:0:0::1,0,0:0:0::0/0 +# Range: Delete zero valued element +1 ipset -D test 2:0:0::1,0,0:0:0::0/0 +# Range: Add almost zero valued element +0 ipset -A test 2:0:0::1,0,0:0:0::0/24 +# Range: Test almost zero valued element +0 ipset -T test 2:0:0::1,0,0:0:0::0/24 +# Range: Delete almost zero valued element +0 ipset -D test 2:0:0::1,0,0:0:0::0/24 +# Range: Add lower boundary +0 ipset -A test 2:0:0::1,5,1:1:1::1/24 +# Range: Add upper boundary +0 ipset -A test 2:1:0::0,128,2:2:2::2/12 +# Range: Test lower boundary +0 ipset -T test 2:0:0::1,5,1:1:1::2 +# Range: Test upper boundary +0 ipset -T test 2:1:0::0,128,2:2:2::0 +# Range: Test value not added to the set +1 ipset -T test 2:0:0::1,5,2:1:1::255 +# Range: Test value not added to the set +1 ipset -T test 2:0:0::1,6,1:1:1::1 +# Range: Test value not added to the set +1 ipset -T test 2:0:0::2,6,1:1:1::1 +# Range: Test value before lower boundary +1 ipset -T test 2:0:0::0,5,1:1:1::1 +# Range: Test value after upper boundary +1 ipset -T test 2:1:0::1,128,2:2:2::2 +# Range: Try to add value before lower boundary +0 ipset -A test 2:0:0::0,5,1:1:1::1/24 +# Range: Try to add value after upper boundary +0 ipset -A test 2:1:0::1,128,2:2:2::2/12 +# Range: List set +0 ipset -L test > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6,port,net6.t.list0 && rm .foo +# Range: Flush test set +0 ipset -F test +# Range: Delete test set +0 ipset -X test +# eof diff --git a/tests/hash:ip6,port,net6.t.list0 b/tests/hash:ip6,port,net6.t.list0 new file mode 100644 index 0000000..cd9bffe --- /dev/null +++ b/tests/hash:ip6,port,net6.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:ip,port,net +Header: family inet6 family inet6 hashsize 1024 maxelem 65536 +Size in memory: 9928 +References: 0 +Members: +2:1::1,128,::/12 +2:1::,128,::/12 +2::1,5,1::/24 +2::,5,1::/24 + diff --git a/tests/hash:ip6,port.t b/tests/hash:ip6,port.t new file mode 100644 index 0000000..feb525c --- /dev/null +++ b/tests/hash:ip6,port.t @@ -0,0 +1,43 @@ +# Range: Create a set with timeout +0 ipset create test hash:ip,port family inet6 timeout 5 +# Range: Add partly zero valued element +0 ipset add test 2:0:0::1,0 +# Range: Test partly zero valued element +0 ipset test test 2:0:0::1,0 +# Range: Delete partly zero valued element +0 ipset del test 2:0:0::1,0 +# Range: Add lower boundary +0 ipset add test 2:0:0::1,5 +# Range: Add upper boundary +0 ipset add test 2:1:0::0,128 +# Range: Test lower boundary +0 ipset test test 2:0:0::1,5 +# Range: Test upper boundary +0 ipset test test 2:1:0::0,128 +# Range: Test value not added to the set +1 ipset test test 2:0:0::1,4 +# Range: Delete value not added to the set +1 ipset del test 2:0:0::1,6 +# Range: Test value before lower boundary +1 ipset test test 2:0:0::0,5 +# Range: Test value after upper boundary +1 ipset test test 2:1:0::1,128 +# Range: Try to add value before lower boundary +0 ipset add test 2:0:0::0,5 +# Range: Try to add value after upper boundary +0 ipset add test 2:1:0::1,128 +# Range: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list0 && rm .foo +# Range: Sleep 6s so that elements can time out +0 sleep 6 +# Range: List set +0 ipset list test > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list1 && rm .foo +# Range: Flush test set +0 ipset flush test +# Range: Delete test set +0 ipset destroy test +# eof diff --git a/tests/hash:ip6,port.t.list0 b/tests/hash:ip6,port.t.list0 new file mode 100644 index 0000000..defd377 --- /dev/null +++ b/tests/hash:ip6,port.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:ip,port +Header: family inet6 hashsize 1024 maxelem 65536 timeout x +Size in memory: 8848 +References: 0 +Members: +2:1::1,128 timeout x +2:1::,128 timeout x +2::1,5 timeout x +2::,5 timeout x + diff --git a/tests/hash:ip6,port.t.list1 b/tests/hash:ip6,port.t.list1 new file mode 100644 index 0000000..8dec3e8 --- /dev/null +++ b/tests/hash:ip6,port.t.list1 @@ -0,0 +1,7 @@ +Name: test +Type: hash:ip,port +Header: family inet6 hashsize 1024 maxelem 65536 timeout 5 +Size in memory: 8304 +References: 0 +Members: + diff --git a/tests/hash:ip6.t b/tests/hash:ip6.t new file mode 100644 index 0000000..dae9e1e --- /dev/null +++ b/tests/hash:ip6.t @@ -0,0 +1,77 @@ +# IP: Create a set with timeout +0 ipset -N test iphash -6 --hashsize 128 timeout 5 +# IP: Add zero valued element +1 ipset -A test :: +# IP: Test zero valued element +1 ipset -T test :: +# IP: Delete zero valued element +1 ipset -D test :: +# IP: Add first random value +0 ipset -A test 2:0:0::1 timeout 5 +# IP: Add second random value +0 ipset -A test 192:168:68::69 timeout 0 +# IP: Test first random value +0 ipset -T test 2:0:0::1 +# IP: Test second random value +0 ipset -T test 192:168:68::69 +# IP: Test value not added to the set +1 ipset -T test 2:0:0::2 +# IP: Add third random value +0 ipset -A test 200:100:0::12 +# IP: Delete the same value +0 ipset -D test 200:100:0::12 +# IP: List set +0 ipset -L test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# IP: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6.t.list2 && rm .foo +# Sleep 6s so that element can time out +0 sleep 6 +# IP: List set +0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +# IP: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6.t.list0 && rm .foo +# IP: Flush test set +0 ipset -F test +# IP: Delete test set +0 ipset -X test +# Network: Create a set with timeout +0 ipset -N test iphash -6 --hashsize 128 --netmask 64 timeout 6 +# Network: Add zero valued element +1 ipset -A test :: +# Network: Test zero valued element +1 ipset -T test :: +# Network: Delete zero valued element +1 ipset -D test :: +# Network: Add first random network +0 ipset -A test 2:0:0::1 +# Network: Add second random network +0 ipset -A test 192:168:68::69 +# Network: Test first random value +0 ipset -T test 2:0:0::255 +# Network: Test second random value +0 ipset -T test 192:168:68::95 +# Network: Test value not added to the set +1 ipset -T test 4:0:1::0 +# Network: Add third element +0 ipset -A test 200:100:10::1 timeout 0 +# Network: Add third random network +0 ipset -A test 200:101:0::12 +# Network: Delete the same network +0 ipset -D test 200:101:0::12 +# Network: Test the deleted network +1 ipset -T test 200:101:0::12 +# Network: List set +0 ipset -L test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Network: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6.t.list3 && rm .foo +# Sleep 6s so that elements can time out +0 sleep 6 +# Network: List set +0 ipset -L test > .foo +# Network: Check listing +0 diff -I 'Size in memory.*' .foo hash:ip6.t.list1 && rm .foo +# Network: Flush test set +0 ipset -F test +# Network: Delete test set +0 ipset -X test +# eof diff --git a/tests/hash:ip6.t.list0 b/tests/hash:ip6.t.list0 new file mode 100644 index 0000000..ff1c0da --- /dev/null +++ b/tests/hash:ip6.t.list0 @@ -0,0 +1,8 @@ +Name: test +Type: hash:ip +Header: family inet6 hashsize 128 maxelem 65536 timeout 5 +Size in memory: 1240 +References: 0 +Members: +192:168:68::69 timeout 0 + diff --git a/tests/hash:ip6.t.list1 b/tests/hash:ip6.t.list1 new file mode 100644 index 0000000..ce5c5fe --- /dev/null +++ b/tests/hash:ip6.t.list1 @@ -0,0 +1,8 @@ +Name: test +Type: hash:ip +Header: family inet6 hashsize 128 maxelem 65536 netmask 64 timeout 6 +Size in memory: 1448 +References: 0 +Members: +200:100:10:: timeout 0 + diff --git a/tests/hash:ip6.t.list2 b/tests/hash:ip6.t.list2 new file mode 100644 index 0000000..5cd39fb --- /dev/null +++ b/tests/hash:ip6.t.list2 @@ -0,0 +1,9 @@ +Name: test +Type: hash:ip +Header: family inet6 hashsize 128 maxelem 65536 timeout x +Size in memory: 1344 +References: 0 +Members: +192:168:68::69 timeout x +2::1 timeout x + diff --git a/tests/hash:ip6.t.list3 b/tests/hash:ip6.t.list3 new file mode 100644 index 0000000..dce0660 --- /dev/null +++ b/tests/hash:ip6.t.list3 @@ -0,0 +1,10 @@ +Name: test +Type: hash:ip +Header: family inet6 hashsize 128 maxelem 65536 netmask 64 timeout x +Size in memory: 1448 +References: 0 +Members: +192:168:68:: timeout x +200:100:10:: timeout x +2:: timeout x + diff --git a/tests/hash:net.t b/tests/hash:net.t new file mode 100644 index 0000000..b46ac86 --- /dev/null +++ b/tests/hash:net.t @@ -0,0 +1,49 @@ +# Create a set with timeout +0 ipset create test nethash hashsize 128 timeout 6 +# Range: Add zero valued element +1 ipset add test 0.0.0.0/0 +# Range: Test zero valued element +1 ipset test test 0.0.0.0/0 +# Range: Delete zero valued element +1 ipset del test 0.0.0.0/0 +# Range: Try to add /0 +1 ipset add test 1.1.1.1/0 +# Range: Try to add /32 +0 ipset add test 1.1.1.1/32 +# Range: Add almost zero valued element +0 ipset add test 0.0.0.0/1 +# Range: Test almost zero valued element +0 ipset test test 0.0.0.0/1 +# Range: Delete almost zero valued element +0 ipset del test 0.0.0.0/1 +# Range: Test deleted element +1 ipset test test 0.0.0.0/1 +# Range: Delete element not added to the set +1 ipset del test 0.0.0.0/1 +# Range: Add first random network +0 ipset add test 2.0.0.1/24 +# Range: Add second random network +0 ipset add test 192.168.68.69/27 +# Range: Test first random value +0 ipset test test 2.0.0.255 +# Range: Test second random value +0 ipset test test 192.168.68.95 +# Range: Test value not added to the set +1 ipset test test 2.0.1.0 +# Range: Try to add IP address +0 ipset add test 2.0.0.1 +# Range: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:net.t.list0 && rm .foo +# Sleep 6s so that element can time out +0 sleep 6 +# IP: List set +0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +# IP: Check listing +0 diff -I 'Size in memory.*' .foo hash:net.t.list1 && rm .foo +# Flush test set +0 ipset flush test +# Delete test set +0 ipset destroy test +# eof diff --git a/tests/hash:net.t.list0 b/tests/hash:net.t.list0 new file mode 100644 index 0000000..b5cc00b --- /dev/null +++ b/tests/hash:net.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:net +Header: family inet hashsize 128 maxelem 65536 timeout x +Size in memory: 1672 +References: 0 +Members: +1.1.1.1 timeout x +192.168.68.64/27 timeout x +2.0.0.0/24 timeout x +2.0.0.1 timeout x + diff --git a/tests/hash:net.t.list1 b/tests/hash:net.t.list1 new file mode 100644 index 0000000..7dec348 --- /dev/null +++ b/tests/hash:net.t.list1 @@ -0,0 +1,7 @@ +Name: test +Type: hash:net +Header: family inet hashsize 128 maxelem 65536 timeout 6 +Size in memory: 1672 +References: 0 +Members: + diff --git a/tests/hash:net6.t b/tests/hash:net6.t new file mode 100644 index 0000000..e4246d9 --- /dev/null +++ b/tests/hash:net6.t @@ -0,0 +1,49 @@ +# Create a set with timeout +0 ipset create test nethash family inet6 hashsize 128 timeout 6 +# Range: Add zero valued element +1 ipset add test ::/0 +# Range: Test zero valued element +1 ipset test test ::/0 +# Range: Delete zero valued element +1 ipset del test ::/0 +# Range: Try to add /0 +1 ipset add test 1:1:1::1/0 +# Range: Try to add /32 +0 ipset add test 1:1:1::1/128 +# Range: Add almost zero valued element +0 ipset add test 0:0:0::0/1 +# Range: Test almost zero valued element +0 ipset test test 0:0:0::0/1 +# Range: Delete almost zero valued element +0 ipset del test 0:0:0::0/1 +# Range: Test deleted element +1 ipset test test 0:0:0::0/1 +# Range: Delete element not added to the set +1 ipset del test 0:0:0::0/1 +# Range: Add first random network +0 ipset add test 2:0:0::1/24 +# Range: Add second random network +0 ipset add test 192:168:68::69/27 +# Range: Test first random value +0 ipset test test 2:0:0::255 +# Range: Test second random value +0 ipset test test 192:168:68::95 +# Range: Test value not added to the set +1 ipset test test 3:0:0::1 +# Range: Try to add IP address +0 ipset add test 3:0:0::1 +# Range: List set +0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +# Range: Check listing +0 diff -I 'Size in memory.*' .foo hash:net6.t.list0 && rm .foo +# Sleep 6s so that element can time out +0 sleep 6 +# IP: List set +0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +# IP: Check listing +0 diff -I 'Size in memory.*' .foo hash:net6.t.list1 && rm .foo +# Flush test set +0 ipset flush test +# Delete test set +0 ipset destroy test +# eof diff --git a/tests/hash:net6.t.list0 b/tests/hash:net6.t.list0 new file mode 100644 index 0000000..47a4663 --- /dev/null +++ b/tests/hash:net6.t.list0 @@ -0,0 +1,11 @@ +Name: test +Type: hash:net +Header: family inet6 hashsize 128 maxelem 65536 timeout x +Size in memory: 2696 +References: 0 +Members: +1:1:1::1 timeout x +192:160::/27 timeout x +2::/24 timeout x +3::1 timeout x + diff --git a/tests/hash:net6.t.list1 b/tests/hash:net6.t.list1 new file mode 100644 index 0000000..2a606bc --- /dev/null +++ b/tests/hash:net6.t.list1 @@ -0,0 +1,7 @@ +Name: test +Type: hash:net +Header: family inet6 hashsize 128 maxelem 65536 timeout 6 +Size in memory: 2696 +References: 0 +Members: + diff --git a/tests/iphash.t b/tests/iphash.t index 923931a..c912ad7 100644 --- a/tests/iphash.t +++ b/tests/iphash.t @@ -18,10 +18,14 @@ 0 ipset -A test 200.100.0.12 # IP: Delete the same value 0 ipset -D test 200.100.0.12 +# IP: Delete element not added to the set +1 ipset -D test 200.100.0.12 +# IP: Delete element not added to the set, ignoring error +0 ipset -! -D test 200.100.0.12 # IP: List set 0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 # IP: Check listing -0 diff .foo iphash.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo iphash.t.list0 && rm .foo # IP: Flush test set 0 ipset -F test # IP: Delete test set @@ -62,10 +66,12 @@ 0 ipset -A test 200.100.0.12 # Network: Delete the same network 0 ipset -D test 200.100.0.12 +# Network: Delete element not added to the set +1 ipset -D test 200.100.0.12 # Network: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Network: Check listing -0 diff .foo iphash.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo iphash.t.list1 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set diff --git a/tests/iphash.t.list0 b/tests/iphash.t.list0 index 3f0c2fa..e2cc4ca 100644 --- a/tests/iphash.t.list0 +++ b/tests/iphash.t.list0 @@ -1,8 +1,7 @@ Name: test Type: hash:ip -Header: hashsize 128 maxelem 65536 probes 4 resize 50 -Elements: 2 -Size in memory: 512 +Header: family inet hashsize 128 maxelem 65536 +Size in memory: 1184 References: 0 Members: 192.168.68.69 diff --git a/tests/iphash.t.list1 b/tests/iphash.t.list1 index f32655a..ec9b493 100644 --- a/tests/iphash.t.list1 +++ b/tests/iphash.t.list1 @@ -1,8 +1,7 @@ Name: test Type: hash:ip -Header: hashsize 128 maxelem 65536 probes 4 resize 50 netmask 24 -Elements: 2 -Size in memory: 512 +Header: family inet hashsize 128 maxelem 65536 netmask 24 +Size in memory: 1184 References: 0 Members: 192.168.68.0 diff --git a/tests/ipmap.t b/tests/ipmap.t index c639e0b..00c35e8 100644 --- a/tests/ipmap.t +++ b/tests/ipmap.t @@ -33,7 +33,7 @@ # Range: Check listing 0 diff .foo ipmap.t.list0 && rm .foo # Range: Delete a range of elements -0 ipset -D test -x 2.0.0.128-2.0.0.132 +0 ipset -! -D test 2.0.0.128-2.0.0.132 # Range: List set 0 ipset -L test > .foo # Range: Check listing diff --git a/tests/ipmap.t.list0 b/tests/ipmap.t.list0 index 560eed1..8bf54c2 100644 --- a/tests/ipmap.t.list0 +++ b/tests/ipmap.t.list0 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 2.0.0.1-2.1.0.0 -Elements: 6 -Size in memory: 8192 +Size in memory: 8232 References: 0 Members: 2.0.0.1 diff --git a/tests/ipmap.t.list1 b/tests/ipmap.t.list1 index 55556a7..4541cf5 100644 --- a/tests/ipmap.t.list1 +++ b/tests/ipmap.t.list1 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 2.0.0.1-2.1.0.0 -Elements: 2 -Size in memory: 8192 +Size in memory: 8232 References: 0 Members: 2.0.0.1 diff --git a/tests/ipmap.t.list2 b/tests/ipmap.t.list2 index 9e1b65d..5f78ba6 100644 --- a/tests/ipmap.t.list2 +++ b/tests/ipmap.t.list2 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 2.0.0.0-2.0.255.255 -Elements: 2 -Size in memory: 8192 +Size in memory: 8232 References: 0 Members: 2.0.0.0 diff --git a/tests/ipmap.t.list3 b/tests/ipmap.t.list3 index 4b2a45a..0acb3ee 100644 --- a/tests/ipmap.t.list3 +++ b/tests/ipmap.t.list3 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 10.0.0.0-10.255.255.255 netmask 24 -Elements: 258 -Size in memory: 8192 +Size in memory: 8232 References: 0 Members: 10.0.0.0 diff --git a/tests/ipmap.t.list4 b/tests/ipmap.t.list4 index f498ba9..67a0c4f 100644 --- a/tests/ipmap.t.list4 +++ b/tests/ipmap.t.list4 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip Header: range 0.0.0.0-255.255.255.255 netmask 16 -Elements: 2 -Size in memory: 8192 +Size in memory: 8232 References: 0 Members: 0.0.0.0 diff --git a/tests/ipporthash.t b/tests/ipporthash.t index 7c622bb..dc35bcd 100644 --- a/tests/ipporthash.t +++ b/tests/ipporthash.t @@ -1,13 +1,15 @@ -# Range: Try to create from an invalid range -2 ipset -N test ipporthash --from 2.0.0.1 --to 2.1.0.1 -# Range: Create a set from a valid range +# Range: Create a set from a range (range ignored) 0 ipset -N test ipporthash --from 2.0.0.1 --to 2.1.0.0 -# Range: Add zero valued element -1 ipset -A test 2.0.0.1,0 -# Range: Test zero valued element -1 ipset -T test 2.0.0.1,0 -# Range: Delete zero valued element -1 ipset -D test 2.0.0.1,0 +# Range: Destroy set +0 ipset -X test +# Range: Create a set +0 ipset -N test ipporthash +# Range: Add partly zero valued element +0 ipset -A test 2.0.0.1,0 +# Range: Test partly zero valued element +0 ipset -T test 2.0.0.1,0 +# Range: Delete partly zero valued element +0 ipset -D test 2.0.0.1,0 # Range: Add lower boundary 0 ipset -A test 2.0.0.1,5 # Range: Add upper boundary @@ -18,27 +20,25 @@ 0 ipset -T test 2.1.0.0,128 # Range: Test value not added to the set 1 ipset -T test 2.0.0.1,4 -# Range: Test value not added to the set -1 ipset -T test 2.0.0.1,6 +# Range: Delete value not added to the set +1 ipset -D test 2.0.0.1,6 # Range: Test value before lower boundary 1 ipset -T test 2.0.0.0,5 # Range: Test value after upper boundary 1 ipset -T test 2.1.0.1,128 # Range: Try to add value before lower boundary -1 ipset -A test 2.0.0.0,5 +0 ipset -A test 2.0.0.0,5 # Range: Try to add value after upper boundary -1 ipset -A test 2.1.0.1,128 +0 ipset -A test 2.1.0.1,128 # Range: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Range: Check listing -0 diff .foo ipporthash.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo ipporthash.t.list0 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set 0 ipset -X test -# Network: Try to create a set from an invalid network -2 ipset -N test ipporthash --network 2.0.0.0/15 -# Network: Create a set from a valid network +# Network: Create a set from a network (network ignored) 0 ipset -N test ipporthash --network 2.0.0.0/16 # Network: Add lower boundary 0 ipset -A test 2.0.0.0,5 @@ -50,20 +50,20 @@ 0 ipset -T test 2.0.255.255,128 # Network: Test value not added to the set 1 ipset -T test 2.0.0.0,4 -# Network: Test value not added to the set -1 ipset -T test 2.0.0.0,6 +# Network: Delete value not added to the set +1 ipset -D test 2.0.0.0,6 # Network: Test value before lower boundary 1 ipset -T test 1.255.255.255,5 # Network: Test value after upper boundary 1 ipset -T test 2.1.0.0,128 # Network: Try to add value before lower boundary -1 ipset -A test 1.255.255.255,5 +0 ipset -A test 1.255.255.255,5 # Network: Try to add value after upper boundary -1 ipset -A test 2.1.0.0,128 +0 ipset -A test 2.1.0.0,128 # Network: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Network: Check listing -0 diff .foo ipporthash.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo ipporthash.t.list1 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set diff --git a/tests/ipporthash.t.list0 b/tests/ipporthash.t.list0 index b840a94..2e78ac4 100644 --- a/tests/ipporthash.t.list0 +++ b/tests/ipporthash.t.list0 @@ -1,7 +1,11 @@ Name: test -Type: ipporthash +Type: hash:ip,port +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8464 References: 0 -Header: from: 2.0.0.1 to: 2.1.0.0 hashsize: 1024 probes: 8 resize: 50 Members: +2.0.0.0,5 2.0.0.1,5 2.1.0.0,128 +2.1.0.1,128 + diff --git a/tests/ipporthash.t.list1 b/tests/ipporthash.t.list1 index be86cda..e0f0da5 100644 --- a/tests/ipporthash.t.list1 +++ b/tests/ipporthash.t.list1 @@ -1,7 +1,11 @@ Name: test -Type: ipporthash +Type: hash:ip,port +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8464 References: 0 -Header: from: 2.0.0.0 to: 2.0.255.255 hashsize: 1024 probes: 8 resize: 50 Members: +1.255.255.255,5 2.0.0.0,5 2.0.255.255,128 +2.1.0.0,128 + diff --git a/tests/ipportiphash.t b/tests/ipportiphash.t index 860d5a6..3f61947 100644 --- a/tests/ipportiphash.t +++ b/tests/ipportiphash.t @@ -1,13 +1,15 @@ -# Range: Try to create from an invalid range -2 ipset -N test ipportiphash --from 2.0.0.1 --to 2.1.0.1 -# Range: Create a set from a valid range +# Range: Create a set from a range (range ignored) 0 ipset -N test ipportiphash --from 2.0.0.1 --to 2.1.0.0 -# Range: Add zero valued element -1 ipset -A test 2.0.0.1,0,0.0.0.0 -# Range: Test zero valued element -1 ipset -T test 2.0.0.1,0,0.0.0.0 -# Range: Delete zero valued element -1 ipset -D test 2.0.0.1,0,0.0.0.0 +# Range: Destroy set +0 ipset -X test +# Range: Create a set +0 ipset -N test ipportiphash +# Range: Add partly zero valued element +0 ipset -A test 2.0.0.1,0,0.0.0.0 +# Range: Test partly zero valued element +0 ipset -T test 2.0.0.1,0,0.0.0.0 +# Range: Delete party zero valued element +0 ipset -D test 2.0.0.1,0,0.0.0.0 # Range: Add almost zero valued element 0 ipset -A test 2.0.0.1,0,0.0.0.1 # Range: Test almost zero valued element @@ -33,20 +35,18 @@ # Range: Test value after upper boundary 1 ipset -T test 2.1.0.1,128,2.2.2.2 # Range: Try to add value before lower boundary -1 ipset -A test 2.0.0.0,5,1.1.1.1 +0 ipset -A test 2.0.0.0,5,1.1.1.1 # Range: Try to add value after upper boundary -1 ipset -A test 2.1.0.1,128,2.2.2.2 +0 ipset -A test 2.1.0.1,128,2.2.2.2 # Range: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Range: Check listing -0 diff .foo ipportiphash.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo ipportiphash.t.list0 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set 0 ipset -X test -# Network: Try to create a set from an invalid network -2 ipset -N test ipportiphash --network 2.0.0.0/15 -# Network: Create a set from a valid network +# Network: Create a set from a valid network (network ignored) 0 ipset -N test ipportiphash --network 2.0.0.0/16 # Network: Add lower boundary 0 ipset -A test 2.0.0.0,5,1.1.1.1 @@ -65,13 +65,15 @@ # Network: Test value after upper boundary 1 ipset -T test 2.1.0.0,128,2.2.2.2 # Network: Try to add value before lower boundary -1 ipset -A test 1.255.255.255,5,1.1.1.1 -# Network: Try to add value after upper boundary -1 ipset -A test 2.1.0.0,128,2.2.2.2 +0 ipset -A test 1.255.255.255,5,1.1.1.1 +# Network: Try to test value before lower boundary +0 ipset -T test 1.255.255.255,5,1.1.1.1 +# Network: Try to del value before lower boundary +0 ipset -D test 1.255.255.255,5,1.1.1.1 # Network: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Network: Check listing -0 diff .foo ipportiphash.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo ipportiphash.t.list1 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set diff --git a/tests/ipportiphash.t.list0 b/tests/ipportiphash.t.list0 index acb1041..ba20b14 100644 --- a/tests/ipportiphash.t.list0 +++ b/tests/ipportiphash.t.list0 @@ -1,7 +1,11 @@ Name: test -Type: ipportiphash +Type: hash:ip,port,ip +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8528 References: 0 -Header: from: 2.0.0.1 to: 2.1.0.0 hashsize: 1024 probes: 8 resize: 50 Members: +2.0.0.0,5,1.1.1.1 2.0.0.1,5,1.1.1.1 2.1.0.0,128,2.2.2.2 +2.1.0.1,128,2.2.2.2 + diff --git a/tests/ipportiphash.t.list1 b/tests/ipportiphash.t.list1 index 5545078..aca272a 100644 --- a/tests/ipportiphash.t.list1 +++ b/tests/ipportiphash.t.list1 @@ -1,7 +1,9 @@ Name: test -Type: ipportiphash +Type: hash:ip,port,ip +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8416 References: 0 -Header: from: 2.0.0.0 to: 2.0.255.255 hashsize: 1024 probes: 8 resize: 50 Members: 2.0.0.0,5,1.1.1.1 2.0.255.255,128,2.2.2.2 + diff --git a/tests/ipportnethash.t b/tests/ipportnethash.t index 93369ef..6aff583 100644 --- a/tests/ipportnethash.t +++ b/tests/ipportnethash.t @@ -1,13 +1,11 @@ -# Range: Try to create from an invalid range -2 ipset -N test ipportnethash --from 2.0.0.1 --to 2.1.0.1 -# Range: Create a set from a valid range +# Range: Create a set from a range (range ignored) 0 ipset -N test ipportnethash --from 2.0.0.1 --to 2.1.0.0 # Range: Add zero valued element -2 ipset -A test 2.0.0.1,0,0.0.0.0/0 +1 ipset -A test 2.0.0.1,0,0.0.0.0/0 # Range: Test zero valued element -2 ipset -T test 2.0.0.1,0,0.0.0.0/0 +1 ipset -T test 2.0.0.1,0,0.0.0.0/0 # Range: Delete zero valued element -2 ipset -D test 2.0.0.1,0,0.0.0.0/0 +1 ipset -D test 2.0.0.1,0,0.0.0.0/0 # Range: Add almost zero valued element 0 ipset -A test 2.0.0.1,0,0.0.0.0/24 # Range: Test almost zero valued element @@ -33,20 +31,18 @@ # Range: Test value after upper boundary 1 ipset -T test 2.1.0.1,128,2.2.2.2 # Range: Try to add value before lower boundary -1 ipset -A test 2.0.0.0,5,1.1.1.1/24 +0 ipset -A test 2.0.0.0,5,1.1.1.1/24 # Range: Try to add value after upper boundary -1 ipset -A test 2.1.0.1,128,2.2.2.2/12 +0 ipset -A test 2.1.0.1,128,2.2.2.2/12 # Range: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Range: Check listing -0 diff .foo ipportnethash.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo ipportnethash.t.list0 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set 0 ipset -X test -# Network: Try to create a set from an invalid network -2 ipset -N test ipportnethash --network 2.0.0.0/15 -# Network: Create a set from a valid network +# Network: Create a set from a valid network (network ignored) 0 ipset -N test ipportnethash --network 2.0.0.0/16 # Network: Add lower boundary 0 ipset -A test 2.0.0.0,5,1.1.1.1/24 @@ -65,13 +61,13 @@ # Network: Test value after upper boundary 1 ipset -T test 2.1.0.0,128,2.2.2.2 # Network: Try to add value before lower boundary -1 ipset -A test 1.255.255.255,5,1.1.1.1/24 +0 ipset -A test 1.255.255.255,5,1.1.1.1/24 # Network: Try to add value after upper boundary -1 ipset -A test 2.1.0.0,128,2.2.2.2/12 +0 ipset -A test 2.1.0.0,128,2.2.2.2/12 # Network: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Network: Check listing -0 diff .foo ipportnethash.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo ipportnethash.t.list1 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set diff --git a/tests/ipportnethash.t.list0 b/tests/ipportnethash.t.list0 index 9727d20..60a0242 100644 --- a/tests/ipportnethash.t.list0 +++ b/tests/ipportnethash.t.list0 @@ -1,7 +1,11 @@ Name: test -Type: ipportnethash +Type: hash:ip,port,net +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8776 References: 0 -Header: from: 2.0.0.1 to: 2.1.0.0 hashsize: 1024 probes: 8 resize: 50 Members: +2.0.0.0,5,1.1.1.0/24 2.0.0.1,5,1.1.1.0/24 2.1.0.0,128,2.0.0.0/12 +2.1.0.1,128,2.0.0.0/12 + diff --git a/tests/ipportnethash.t.list1 b/tests/ipportnethash.t.list1 index ad861d4..5d74105 100644 --- a/tests/ipportnethash.t.list1 +++ b/tests/ipportnethash.t.list1 @@ -1,7 +1,11 @@ Name: test -Type: ipportnethash +Type: hash:ip,port,net +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8776 References: 0 -Header: from: 2.0.0.0 to: 2.0.255.255 hashsize: 1024 probes: 8 resize: 50 Members: +1.255.255.255,5,1.1.1.0/24 2.0.0.0,5,1.1.1.0/24 2.0.255.255,128,2.0.0.0/12 +2.1.0.0,128,2.0.0.0/12 + diff --git a/tests/iptree.t b/tests/iptree.t index 3cb0e00..b1e3678 100644 --- a/tests/iptree.t +++ b/tests/iptree.t @@ -13,7 +13,7 @@ # Static: Test value not added to the set 1 ipset -T test 192.168.68.70 # Static: List set -0 ipset -L test > .foo +0 ipset -L test > .foo0 && ./sort.sh .foo0 # Static: Check listing 0 diff .foo iptree.t.list0 && rm .foo # Static: Flush test set diff --git a/tests/iptree.t.list0 b/tests/iptree.t.list0 index 07433b9..f93546d 100644 --- a/tests/iptree.t.list0 +++ b/tests/iptree.t.list0 @@ -1,8 +1,9 @@ Name: test -Type: iptree +Type: hash:ip +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 8352 References: 0 -Header: Members: -2.0.0.1 192.168.68.69 +2.0.0.1 diff --git a/tests/iptreemap.t b/tests/iptreemap.t index 2e9fce7..0c36c3a 100644 --- a/tests/iptreemap.t +++ b/tests/iptreemap.t @@ -28,6 +28,8 @@ 1 ipset -T test 3.0.0.1 # Test the range: third 0 ipset -T test 3.0.0.2 +# Delete second random IP entry +0 ipset -D test 192.168.68.69 # Add a network block 0 ipset -A test 192.168.68.69/27 # Test the lower bound of the network @@ -47,7 +49,7 @@ # Test element after upper bound of deleted network 0 ipset -T test 192.168.68.72 # List set -0 ipset -L test > .foo +0 ipset -L test > .foo0 && ./sort.sh .foo0 # Check listing 0 diff .foo iptreemap.t.list0 && rm .foo # Flush test set diff --git a/tests/iptreemap.t.list0 b/tests/iptreemap.t.list0 index 6e783a0..15db1fe 100644 --- a/tests/iptreemap.t.list0 +++ b/tests/iptreemap.t.list0 @@ -1,11 +1,38 @@ Name: test -Type: iptreemap +Type: hash:ip +Header: family inet hashsize 1024 maxelem 65536 +Size in memory: 9048 References: 0 -Header: gc: 300 Members: +192.168.68.64 +192.168.68.65 +192.168.68.66 +192.168.68.67 +192.168.68.72 +192.168.68.73 +192.168.68.74 +192.168.68.75 +192.168.68.76 +192.168.68.77 +192.168.68.78 +192.168.68.79 +192.168.68.80 +192.168.68.81 +192.168.68.82 +192.168.68.83 +192.168.68.84 +192.168.68.85 +192.168.68.86 +192.168.68.87 +192.168.68.88 +192.168.68.89 +192.168.68.90 +192.168.68.91 +192.168.68.92 +192.168.68.93 +192.168.68.94 +192.168.68.95 2.0.0.1 3.0.0.0 3.0.0.2 -192.168.68.64-192.168.68.67 -192.168.68.72-192.168.68.95 diff --git a/tests/macipmap.t b/tests/macipmap.t index 277672d..90f09ba 100644 --- a/tests/macipmap.t +++ b/tests/macipmap.t @@ -20,6 +20,8 @@ 1 ipset -A test 2.0.0.0 # Range: Try to add value after upper boundary 1 ipset -A test 2.1.0.1 +# Range: Delete element not added to the set +1 ipset -D test 2.0.0.2 # Range: Try to add value with MAC 0 ipset -A test 2.0.0.2,00:11:22:33:44:55 # Range: Test value with invalid MAC @@ -28,6 +30,10 @@ 0 ipset -T test 2.0.0.2,00:11:22:33:44:55 # Range: Add MAC to already added element 0 ipset -A test 2.0.0.1,00:11:22:33:44:56 +# Range: Test value without supplying MAC +0 ipset -T test 2.0.0.1 +# Range: Test value with valid MAC +0 ipset -T test 2.0.0.1,00:11:22:33:44:56 # Range: Add an element in the middle 0 ipset -A test 2.0.200.214,00:11:22:33:44:57 # Range: Delete the same element @@ -62,6 +68,8 @@ 1 ipset -A test 1.255.255.255 # Network: Try to add value after upper boundary 1 ipset -A test 2.1.0.0 +# Network: Delete element not added to the set +1 ipset -D test 2.0.0.2 # Network: Try to add value with MAC 0 ipset -A test 2.0.0.2,00:11:22:33:44:55 # Network: Test value with invalid MAC @@ -110,8 +118,10 @@ 0 ipset -A test 2.0.200.214,00:11:22:33:44:57 # Range: Delete the same element 0 ipset -D test 2.0.200.214 +# Range: List set +0 ipset -L test | sed 's/timeout ./timeout x/' > .foo # Range: Check listing -0 ipset -L test | grep '2.0.0.2,00:11:22:33:44:55 timeout' >/dev/null +0 diff .foo macipmap.t.list3 && rm .foo # Range: wait 10s so that elements can timeout 0 sleep 10 # Range: List set diff --git a/tests/macipmap.t.list0 b/tests/macipmap.t.list0 index f34c882..9403224 100644 --- a/tests/macipmap.t.list0 +++ b/tests/macipmap.t.list0 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip,mac Header: range 2.0.0.1-2.1.0.0 -Elements: 3 -Size in memory: 458752 +Size in memory: 458864 References: 0 Members: 2.0.0.1,00:11:22:33:44:56 diff --git a/tests/macipmap.t.list1 b/tests/macipmap.t.list1 index cbdf127..3420abe 100644 --- a/tests/macipmap.t.list1 +++ b/tests/macipmap.t.list1 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip,mac Header: range 2.0.0.0-2.0.255.255 -Elements: 3 -Size in memory: 458752 +Size in memory: 458864 References: 0 Members: 2.0.0.0 diff --git a/tests/macipmap.t.list2 b/tests/macipmap.t.list2 index 9d0413e..6a727d8 100644 --- a/tests/macipmap.t.list2 +++ b/tests/macipmap.t.list2 @@ -1,8 +1,7 @@ Name: test Type: bitmap:ip,mac Header: range 2.0.0.1-2.1.0.0 timeout 10 -Elements: 1 -Size in memory: 1048576 +Size in memory: 1048688 References: 0 Members: 2.1.0.0 timeout 5 diff --git a/tests/macipmap.t.list3 b/tests/macipmap.t.list3 new file mode 100644 index 0000000..9f52f06 --- /dev/null +++ b/tests/macipmap.t.list3 @@ -0,0 +1,10 @@ +Name: test +Type: bitmap:ip,mac +Header: range 2.0.0.1-2.1.0.0 timeout x0 +Size in memory: 1048688 +References: 0 +Members: +2.0.0.1,00:11:22:33:44:56 timeout x +2.0.0.2,00:11:22:33:44:55 timeout x +2.1.0.0 timeout x + diff --git a/tests/nethash.t b/tests/nethash.t index cedcfde..400e110 100644 --- a/tests/nethash.t +++ b/tests/nethash.t @@ -1,37 +1,41 @@ # Create a set 0 ipset -N test nethash --hashsize 128 # Range: Add zero valued element -2 ipset -A test 0.0.0.0/0 +1 ipset -A test 0.0.0.0/0 # Range: Test zero valued element -2 ipset -T test 0.0.0.0/0 +1 ipset -T test 0.0.0.0/0 # Range: Delete zero valued element -2 ipset -D test 0.0.0.0/0 +1 ipset -D test 0.0.0.0/0 # Range: Try to add /0 -2 ipset -A test 1.1.1.1/0 +1 ipset -A test 1.1.1.1/0 # Range: Try to add /32 -2 ipset -A test 1.1.1.1/32 +0 ipset -A test 1.1.1.1/32 # Range: Add almost zero valued element 0 ipset -A test 0.0.0.0/1 # Range: Test almost zero valued element 0 ipset -T test 0.0.0.0/1 # Range: Delete almost zero valued element 0 ipset -D test 0.0.0.0/1 -# Range: Add first random network +# Range: Test deleted element +1 ipset -T test 0.0.0.0/1 +# Range: Delete element not added to the set +1 ipset -D test 0.0.0.0/1 +# Range: Add first random network 0 ipset -A test 2.0.0.1/24 -# Range: Add second random network +# Range: Add second random network 0 ipset -A test 192.168.68.69/27 -# Range: Test first random value +# Range: Test first random value 0 ipset -T test 2.0.0.255 -# Range: Test second random value +# Range: Test second random value 0 ipset -T test 192.168.68.95 -# Range: Test value not added to the set +# Range: Test value not added to the set 1 ipset -T test 2.0.1.0 -# Range: Try to add IP address -2 ipset -A test 2.0.0.1 +# Range: Try to add IP address +0 ipset -A test 2.0.0.1 # Range: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Range: Check listing -0 diff .foo nethash.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo nethash.t.list0 && rm .foo # Flush test set 0 ipset -F test # Delete test set diff --git a/tests/nethash.t.list0 b/tests/nethash.t.list0 index 0b008b8..2809d79 100644 --- a/tests/nethash.t.list0 +++ b/tests/nethash.t.list0 @@ -1,7 +1,11 @@ Name: test -Type: nethash +Type: hash:net +Header: family inet hashsize 128 maxelem 65536 +Size in memory: 1544 References: 0 -Header: hashsize: 128 probes: 4 resize: 50 Members: +1.1.1.1 192.168.68.64/27 2.0.0.0/24 +2.0.0.1 + diff --git a/tests/portmap.t b/tests/portmap.t index 5e05849..b2ebf55 100644 --- a/tests/portmap.t +++ b/tests/portmap.t @@ -18,6 +18,8 @@ 1 ipset -A test 0 # Range: Try to add value after upper boundary 1 ipset -A test 1025 +# Range: Delete element not added to the set +1 ipset -D test 567 # Range: Add element in the middle 0 ipset -A test 567 # Range: Delete the same element @@ -66,6 +68,10 @@ 0 ipset -A test 567 # Full: Delete the same element 0 ipset -D test 567 +# Full: List set +0 ipset -L test | sed 's/timeout ./timeout x/' > .foo +# Full: Check listing +0 diff .foo portmap.t.list3 && rm .foo # Full: sleep 10s so that elements can timeout 0 sleep 10 # Full: List set diff --git a/tests/portmap.t.list0 b/tests/portmap.t.list0 index ed0b7d1..9934a75 100644 --- a/tests/portmap.t.list0 +++ b/tests/portmap.t.list0 @@ -1,8 +1,7 @@ Name: test Type: bitmap:port Header: range 1-1024 -Elements: 2 -Size in memory: 128 +Size in memory: 152 References: 0 Members: 1 diff --git a/tests/portmap.t.list1 b/tests/portmap.t.list1 index f67b128..4f13e32 100644 --- a/tests/portmap.t.list1 +++ b/tests/portmap.t.list1 @@ -1,8 +1,7 @@ Name: test Type: bitmap:port Header: range 0-65535 -Elements: 2 -Size in memory: 8192 +Size in memory: 8216 References: 0 Members: 0 diff --git a/tests/portmap.t.list3 b/tests/portmap.t.list3 new file mode 100644 index 0000000..b79cd1e --- /dev/null +++ b/tests/portmap.t.list3 @@ -0,0 +1,9 @@ +Name: test +Type: bitmap:port +Header: range 0-65535 timeout x +Size in memory: 524400 +References: 0 +Members: +0 timeout x +65535 timeout x + diff --git a/tests/runtest.sh b/tests/runtest.sh index a045905..ccd057e 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -1,22 +1,19 @@ #!/bin/bash tests="init" -tests="$tests ipmap bitmap:ip macipmap portmap" -tests="$tests iphash hash:ip" -# nethash ipporthash" -# tests="$tests ipportiphash ipportnethash" -# tests="$tests iptree iptreemap" -# tests="$tests setlist" +tests="$tests ipmap bitmap:ip" +tests="$tests macipmap portmap" +tests="$tests iphash hash:ip hash:ip6" +tests="$tests ipporthash hash:ip,port hash:ip6,port" +tests="$tests ipportiphash hash:ip,port,ip hash:ip6,port,ip6" +tests="$tests nethash hash:net hash:net6" +tests="$tests setlist" +tests="$tests iptree iptreemap" if [ "$1" ]; then tests="init $@" fi -if [ ! -x ../src/ipset ]; then - echo "Please rune `make` first and create the ipset binary." - exit 1 -fi - for types in $tests; do ../src/ipset -X test >/dev/null 2>&1 if [ -f $types ]; then diff --git a/tests/setlist.t b/tests/setlist.t index ed21396..f80f5ae 100644 --- a/tests/setlist.t +++ b/tests/setlist.t @@ -1,9 +1,15 @@ +# Setlist: Create dummy set +0 ipset -N dummy list:set # Setlist: Create base set foo 0 ipset -N foo ipmap --from 2.0.0.1 --to 2.1.0.0 # Setlist: Create base set bar 0 ipset -N bar iphash # Setlist: Create setlist kind of set 0 ipset -N test setlist +# Setlist: Swap test and dumy sets +0 ipset -W test dummy +# Setlist: Destroy dummy set +0 ipset -X dummy # Setlist: Add foo set to setlist 0 ipset -A test foo # Setlist: Test foo set in setlist diff --git a/tests/setlist.t.list0 b/tests/setlist.t.list0 index 9b70446..99f88fb 100644 --- a/tests/setlist.t.list0 +++ b/tests/setlist.t.list0 @@ -1,7 +1,8 @@ Name: test -Type: setlist +Type: list:set +Header: size 8 +Size in memory: 112 References: 0 -Header: size: 8 Members: foo bar diff --git a/tests/sort.sh b/tests/sort.sh index 907148a..ccdbc4e 100755 --- a/tests/sort.sh +++ b/tests/sort.sh @@ -1,6 +1,6 @@ #!/bin/sh -head -n 7 $1 > .foo -tail -n +8 $1 | grep '[[:alnum:]]' | sort >> .foo +head -n 6 $1 > .foo +tail -n +7 $1 | grep '[[:alnum:]]' | sort >> .foo echo >> .foo rm $1 -- cgit v1.2.3