]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Nineth stage to ipset-5
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 22 Apr 2010 15:11:01 +0000 (17:11 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 22 Apr 2010 15:11:01 +0000 (17:11 +0200)
Update tests.

18 files changed:
README
tests/iphash.t
tests/iphash.t.list0
tests/iphash.t.list1
tests/iphash.t.restore
tests/ipmap.t
tests/ipmap.t.list0
tests/ipmap.t.list1
tests/ipmap.t.list2
tests/ipmap.t.list3
tests/macipmap.t
tests/macipmap.t.list0
tests/macipmap.t.list1
tests/portmap.t
tests/portmap.t.list0
tests/portmap.t.list1
tests/runtest.sh
tests/sort.sh

diff --git a/README b/README
index 4833b901b3fea2b0146193fcf4ff326ff3ad9474..7838a37baf92c5b5367f9ce89fb4e4fce9ac12ab 100644 (file)
--- a/README
+++ b/README
@@ -1,55 +1,40 @@
 This is the ipset source tree. Follow these steps to install ipset:
 
-0. You need the source tree of your kernel (version >= 2.6.16 or 2.4.36.x)
+0. You need the source tree of your kernel (version >= 2.6.16)
    and it have to be configured, modules compiled.
 
-1. Compile ipset and it's kernel modules
+1. Initialize the environment
 
-   # make KERNEL_DIR=<<where-you-built-your-kernel>>
+   % ./autogen.sh
 
-   You can specify the maximum number of sets (default 256)
-   and/or the hash size for bindings (default 1024) if you want:
+2. Run `./configure` and then compile the ipset binary and the kernel
+   modules.
 
-   # make KERNEL_DIR=<<where-you-built-your-kernel>> \
-       IP_NF_SET_MAX=<<your setsize number>> \
-       IP_NF_SET_HASHSIZE=<<your hashsize number>>
+   Configure parameters can be used to to override the default path
+   to the kernel source tree (/lib/modules/`uname -r`/build),
+   the maximum number of sets (256), the default hash sizes (1024)
+   or disable the extra compiler warning flags if your compiler
+   does not support all of them.
 
-   If your compiler does not support all of the extra warning
-   flags, you can disable those too:
+   % ./configure
+   % make
+   % make modules
 
-   # make KERNEL_DIR=<<where-you-built-your-kernel>> \
-       IP_NF_SET_MAX=<<your setsize number>> \
-       IP_NF_SET_HASHSIZE=<<your hashsize number>> \
-       NO_EXTRA_WARN_FLAGS=yes
+3. Install the binary and the modules
 
-2. Install the binary and the modules
+   # make install
+   # make modules_install
 
-   # make KERNEL_DIR=<<where-you-built-your-kernel>> install
+   After installing the modules, you can run the testsuite as well:
 
-3. Cleanup the source tree
+   # make tests
 
-   # make KERNEL_DIR=<<where-you-built-your-kernel>> clean
+4. Cleanup the source tree
+
+   % make clean
+   % make modules_clean
 
 That's it! 
 
 Read the ipset(8) and iptables(8) manpages on how to use ipset 
 and its match and target from iptables.
-
-If you want to build a non-modular >= 2.6.16 kernel or has got a 2.4.36.x
-kernel tree, then proceed with the following steps:
-
-1. Compile the ipset binaries
-
-  # make KERNEL_DIR=<<where-you-built-your-kernel>> binaries
-
-2. Install the ipset binaries
-
-  # make KERNEL_DIR=<<where-you-built-your-kernel>> binaries_install
-
-3. Patch your kernel source
-
-  # make KERNEL_DIR=<<where-you-built-your-kernel>> patch_kernel
-
-4. Go to the kernel source and run 'make oldconfig', enable the ipset
-   functionality and compile, install your kernel.
-
index 7a3ce1ff07e797396af52868c6d7df9c0c1dbc25..923931afe30c308538c51ffa17bd63d11d43488e 100644 (file)
@@ -1,9 +1,9 @@
 # IP: Create a set 
 0 ipset -N test iphash --hashsize 128 
 # Range: Add zero valued element
-2 ipset -A test 0.0.0.0
+1 ipset -A test 0.0.0.0
 # Range: Test zero valued element
-2 ipset -T test 0.0.0.0
+1 ipset -T test 0.0.0.0
 # IP: Add first random value
 0 ipset -A test 2.0.0.1
 # IP: Add 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 > .foo0 && ./sort.sh .foo0
+0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0
 # IP: Check listing
 0 diff .foo iphash.t.list0 && rm .foo
 # IP: Flush test set
 0 ipset -F test
 # IP: Delete test set
 0 ipset -X test
+# IP: Restore values so that rehashing is triggered, old format
+0 ipset -R < iphash.t.restore.old
+# IP: Check that all values are restored
+0 (grep add iphash.t.restore | sort > .foo.1) && (ipset -S test | grep add | sort > .foo.2) && cmp .foo.1 .foo.2 && rm .foo.*
+# IP: Delete test set
+0 ipset -X test
 # IP: Restore values so that rehashing is triggered
 0 ipset -R < iphash.t.restore
 # IP: Check that all values are restored
-0 (egrep -v '#|-N' iphash.t.restore | sort > .foo.1) && (ipset -S test | egrep -v '#|-N' | sort > .foo.2) && cmp .foo.1 .foo.2 && rm .foo.*
+0 (grep add iphash.t.restore | sort > .foo.1) && (ipset -S test | grep add | sort > .foo.2) && cmp .foo.1 .foo.2 && rm .foo.*
 # IP: Flush test set
 0 ipset -F test
 # IP: Delete test set
 # Network: Create a set 
 0 ipset -N test iphash --hashsize 128 --netmask 24
 # Network: Add zero valued element
-2 ipset -A test 0.0.0.0
+1 ipset -A test 0.0.0.0
 # Network: Test zero valued element
-2 ipset -T test 0.0.0.0
+1 ipset -T test 0.0.0.0
 # Network: Delete zero valued element
-2 ipset -D test 0.0.0.0
+1 ipset -D test 0.0.0.0
 # Network: Add first random network
 0 ipset -A test 2.0.0.1
 # Network: Add second random network
 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: 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 > .foo0 && ./sort.sh .foo0
 # Network: Check listing
index 93d51c2fa3ece30078fa7931ce2e3e622c4e6add..3f0c2fabea2d2f7a6a63ee81cfe214bb7a4fa7cc 100644 (file)
@@ -1,7 +1,10 @@
 Name: test
-Type: iphash
+Type: hash:ip
+Header: hashsize 128 maxelem 65536 probes 4 resize 50 
+Elements: 2
+Size in memory: 512
 References: 0
-Header: hashsize: 128 probes: 8 resize: 50
 Members:
 192.168.68.69
 2.0.0.1
+
index 7f13c1ccaba3d71266663782c865ae01de4a202e..f32655a7f637f6835d50c8782072d35d16e52357 100644 (file)
@@ -1,7 +1,10 @@
 Name: test
-Type: iphash
+Type: hash:ip
+Header: hashsize 128 maxelem 65536 probes 4 resize 50 netmask 24 
+Elements: 2
+Size in memory: 512
 References: 0
-Header: hashsize: 128 probes: 8 resize: 50 netmask: 24
 Members:
 192.168.68.0
 2.0.0.0
+
index fd915cc2e6d7143d1519a2b33604cd35199288a1..d521c878eb6e0fc6720c95055c8dc6a4b17c86b6 100644 (file)
--N test iphash --hashsize 128
--A test 10.0.0.0
--A test 10.0.0.1
--A test 10.0.0.10
--A test 10.0.0.100
--A test 10.0.0.101
--A test 10.0.0.102
--A test 10.0.0.103
--A test 10.0.0.104
--A test 10.0.0.105
--A test 10.0.0.106
--A test 10.0.0.107
--A test 10.0.0.108
--A test 10.0.0.109
--A test 10.0.0.11
--A test 10.0.0.110
--A test 10.0.0.111
--A test 10.0.0.112
--A test 10.0.0.113
--A test 10.0.0.114
--A test 10.0.0.115
--A test 10.0.0.116
--A test 10.0.0.117
--A test 10.0.0.118
--A test 10.0.0.119
--A test 10.0.0.12
--A test 10.0.0.120
--A test 10.0.0.121
--A test 10.0.0.122
--A test 10.0.0.123
--A test 10.0.0.124
--A test 10.0.0.125
--A test 10.0.0.126
--A test 10.0.0.127
--A test 10.0.0.128
--A test 10.0.0.13
--A test 10.0.0.14
--A test 10.0.0.15
--A test 10.0.0.16
--A test 10.0.0.17
--A test 10.0.0.18
--A test 10.0.0.19
--A test 10.0.0.2
--A test 10.0.0.20
--A test 10.0.0.21
--A test 10.0.0.22
--A test 10.0.0.23
--A test 10.0.0.24
--A test 10.0.0.25
--A test 10.0.0.26
--A test 10.0.0.27
--A test 10.0.0.28
--A test 10.0.0.29
--A test 10.0.0.3
--A test 10.0.0.30
--A test 10.0.0.31
--A test 10.0.0.32
--A test 10.0.0.33
--A test 10.0.0.34
--A test 10.0.0.35
--A test 10.0.0.36
--A test 10.0.0.37
--A test 10.0.0.38
--A test 10.0.0.39
--A test 10.0.0.4
--A test 10.0.0.40
--A test 10.0.0.41
--A test 10.0.0.42
--A test 10.0.0.43
--A test 10.0.0.44
--A test 10.0.0.45
--A test 10.0.0.46
--A test 10.0.0.47
--A test 10.0.0.48
--A test 10.0.0.49
--A test 10.0.0.5
--A test 10.0.0.50
--A test 10.0.0.51
--A test 10.0.0.52
--A test 10.0.0.53
--A test 10.0.0.54
--A test 10.0.0.55
--A test 10.0.0.56
--A test 10.0.0.57
--A test 10.0.0.58
--A test 10.0.0.59
--A test 10.0.0.6
--A test 10.0.0.60
--A test 10.0.0.61
--A test 10.0.0.62
--A test 10.0.0.63
--A test 10.0.0.64
--A test 10.0.0.65
--A test 10.0.0.66
--A test 10.0.0.67
--A test 10.0.0.68
--A test 10.0.0.69
--A test 10.0.0.7
--A test 10.0.0.70
--A test 10.0.0.71
--A test 10.0.0.72
--A test 10.0.0.73
--A test 10.0.0.74
--A test 10.0.0.75
--A test 10.0.0.76
--A test 10.0.0.77
--A test 10.0.0.78
--A test 10.0.0.79
--A test 10.0.0.8
--A test 10.0.0.80
--A test 10.0.0.81
--A test 10.0.0.82
--A test 10.0.0.83
--A test 10.0.0.84
--A test 10.0.0.85
--A test 10.0.0.86
--A test 10.0.0.87
--A test 10.0.0.88
--A test 10.0.0.89
--A test 10.0.0.9
--A test 10.0.0.90
--A test 10.0.0.91
--A test 10.0.0.92
--A test 10.0.0.93
--A test 10.0.0.94
--A test 10.0.0.95
--A test 10.0.0.96
--A test 10.0.0.97
--A test 10.0.0.98
--A test 10.0.0.99
-COMMIT
+create test hash:ip hashsize 128
+add test 10.0.0.38
+add test 10.0.0.94
+add test 10.0.0.17
+add test 10.0.0.114
+add test 10.0.0.69
+add test 10.0.0.112
+add test 10.0.0.122
+add test 10.0.0.119
+add test 10.0.0.70
+add test 10.0.0.101
+add test 10.0.0.37
+add test 10.0.0.45
+add test 10.0.0.41
+add test 10.0.0.123
+add test 10.0.0.18
+add test 10.0.0.33
+add test 10.0.0.35
+add test 10.0.0.48
+add test 10.0.0.29
+add test 10.0.0.80
+add test 10.0.0.12
+add test 10.0.0.42
+add test 10.0.0.85
+add test 10.0.0.116
+add test 10.0.0.56
+add test 10.0.0.83
+add test 10.0.0.28
+add test 10.0.0.32
+add test 10.0.0.68
+add test 10.0.0.84
+add test 10.0.0.82
+add test 10.0.0.20
+add test 10.0.0.43
+add test 10.0.0.2
+add test 10.0.0.121
+add test 10.0.0.6
+add test 10.0.0.31
+add test 10.0.0.66
+add test 10.0.0.57
+add test 10.0.0.77
+add test 10.0.0.25
+add test 10.0.0.76
+add test 10.0.0.47
+add test 10.0.0.8
+add test 10.0.0.105
+add test 10.0.0.73
+add test 10.0.0.60
+add test 10.0.0.75
+add test 10.0.0.7
+add test 10.0.0.46
+add test 10.0.0.39
+add test 10.0.0.99
+add test 10.0.0.51
+add test 10.0.0.54
+add test 10.0.0.9
+add test 10.0.0.103
+add test 10.0.0.5
+add test 10.0.0.124
+add test 10.0.0.52
+add test 10.0.0.1
+add test 10.0.0.125
+add test 10.0.0.117
+add test 10.0.0.72
+add test 10.0.0.127
+add test 10.0.0.63
+add test 10.0.0.27
+add test 10.0.0.21
+add test 10.0.0.91
+add test 10.0.0.74
+add test 10.0.0.30
+add test 10.0.0.23
+add test 10.0.0.95
+add test 10.0.0.120
+add test 10.0.0.89
+add test 10.0.0.24
+add test 10.0.0.10
+add test 10.0.0.96
+add test 10.0.0.92
+add test 10.0.0.71
+add test 10.0.0.34
+add test 10.0.0.67
+add test 10.0.0.59
+add test 10.0.0.4
+add test 10.0.0.79
+add test 10.0.0.13
+add test 10.0.0.100
+add test 10.0.0.111
+add test 10.0.0.58
+add test 10.0.0.106
+add test 10.0.0.107
+add test 10.0.0.44
+add test 10.0.0.40
+add test 10.0.0.50
+add test 10.0.0.118
+add test 10.0.0.87
+add test 10.0.0.3
+add test 10.0.0.49
+add test 10.0.0.126
+add test 10.0.0.109
+add test 10.0.0.55
+add test 10.0.0.102
+add test 10.0.0.11
+add test 10.0.0.16
+add test 10.0.0.97
+add test 10.0.0.115
+add test 10.0.0.93
+add test 10.0.0.86
+add test 10.0.0.113
+add test 10.0.0.53
+add test 10.0.0.110
+add test 10.0.0.65
+add test 10.0.0.0
+add test 10.0.0.15
+add test 10.0.0.62
+add test 10.0.0.90
+add test 10.0.0.108
+add test 10.0.0.81
+add test 10.0.0.128
+add test 10.0.0.64
+add test 10.0.0.61
+add test 10.0.0.88
+add test 10.0.0.104
+add test 10.0.0.26
+add test 10.0.0.36
+add test 10.0.0.78
+add test 10.0.0.14
+add test 10.0.0.98
+add test 10.0.0.22
+add test 10.0.0.19
index 239cef9dd9917ebea515cb221aa2ca898e6b18fe..c639e0b94b2b6373860525d63ab19b0c086a09a0 100644 (file)
@@ -1,5 +1,5 @@
 # Range: Try to create from an invalid range
-2 ipset -N test ipmap --from 2.0.0.1 --to 2.1.0.1
+1 ipset -N test ipmap --from 2.0.0.1 --to 2.1.0.1
 # Range: Create a set from a valid range
 0 ipset -N test ipmap --from 2.0.0.1 --to 2.1.0.0
 # Range: Add lower boundary
 0 ipset -T test 2.0.0.1
 # Range: Test upper boundary
 0 ipset -T test 2.1.0.0
-# Range: Test value not added to the set
+# Range: Test element not added to the set
 1 ipset -T test 2.0.0.2
-# Range: Test value before lower boundary
+# Range: Test element before lower boundary
 1 ipset -T test 2.0.0.0
-# Range: Test value after upper boundary
+# Range: Test element after upper boundary
 1 ipset -T test 2.1.0.1
-# Range: Try to add value before lower boundary
+# Range: Try to add element before lower boundary
 1 ipset -A test 2.0.0.0
-# Range: Try to add value after upper boundary
+# Range: Try to add element 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: Add element in the middle
+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
 # Range: List set
 0 ipset -L test > .foo
 # 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
+# Range: List set
+0 ipset -L test > .foo
+# Range: Check listing
+0 diff .foo ipmap.t.list1 && 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 ipmap --network 2.0.0.0/15
+1 ipset -N test ipmap --network 2.0.0.0/15
 # Network: Create a set from a valid network
 0 ipset -N test ipmap --network 2.0.0.0/16
 # Network: Add lower boundary
 0 ipset -T test 2.0.0.0
 # Network: Test upper boundary
 0 ipset -T test 2.0.255.255
-# Network: Test value not added to the set
+# Network: Test element not added to the set
 1 ipset -T test 2.0.0.1
-# Network: Test value before lower boundary
+# Network: Test element before lower boundary
 1 ipset -T test 1.255.255.255
-# Network: Test value after upper boundary
+# Network: Test element after upper boundary
 1 ipset -T test 2.1.0.0
-# Network: Try to add value before lower boundary
+# Network: Try to add element before lower boundary
 1 ipset -A test 1.255.255.255
-# Network: Try to add value after upper boundary
+# Network: Try to add element 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: Add element in the middle
+0 ipset -A test 2.0.0.128
+# Network: Delete the same element
+0 ipset -D test 2.0.0.128
 # Network: List set
 0 ipset -L test > .foo
 # Network: Check listing
-0 diff .foo ipmap.t.list1 && rm .foo
+0 diff .foo ipmap.t.list2 && rm .foo
 # Network: Flush test set
 0 ipset -F test
 # Network: Delete test set
 0 ipset -T test 10.0.0.255
 # Subnets: Test upper boundary
 0 ipset -T test 10.255.255.0
-# Subnets: Test value not added to the set
+# Subnets: Test element not added to the set
 1 ipset -T test 10.1.0.0
-# Subnets: Test value before lower boundary
+# Subnets: Test element before lower boundary
 1 ipset -T test 9.255.255.255
-# Subnets: Test value after upper boundary
+# Subnets: Test element after upper boundary
 1 ipset -T test 11.0.0.0
-# Subnets: Try to add value before lower boundary
+# Subnets: Try to add element before lower boundary
 1 ipset -A test 9.255.255.255
-# Subnets: Try to add value after upper boundary
+# Subnets: Try to add element after upper boundary
 1 ipset -A test 11.0.0.0
+# Subnets: Try to delete element not added to the set
+1 ipset -D test 10.2.0.0
+# Subnets: Add element to the set
+0 ipset -A test 10.2.0.0
+# Subnets: Delete the same element from the set
+0 ipset -D test 10.2.0.0
+# Subnets: Add a subnet of subnets
+0 ipset -A test 10.8.0.0/16
 # Subnets: List set
 0 ipset -L test > .foo
 # Subnets: Check listing
-0 diff .foo ipmap.t.list2 && rm .foo
+0 diff .foo ipmap.t.list3 && rm .foo
 # Subnets: FLush test set
 0 ipset -F test
 # Subnets: Delete test set
 # Full: Create full IPv4 space with /16 networks
 0 ipset -N test ipmap --network 0.0.0.0/0 --netmask 16
 # Full: Add lower boundary
-0 ipset -A test 0.0.255.255
+0 ipset -A test 0.0.0.0
 # Full: Add upper boundary
 0 ipset -A test 255.255.0.0
 # Full: Test lower boundary
 0 ipset -T test 0.0.0.0
 # Full: Test upper boundary
 0 ipset -T test 255.255.255.255
-# Full: Test value not added to the set
+# Full: Test element not added to the set
 1 ipset -T test 0.1.0.0
+# Full: Delete element not added to the set
+1 ipset -T test 0.1.0.0
+# Full: Add element to the set
+0 ipset -A test 0.1.0.0
+# Full: Delete same element
+0 ipset -D test 0.1.0.0
 # Full: List set
 0 ipset -L test > .foo
 # Full: Check listing
-0 diff .foo ipmap.t.list3 && rm .foo
+0 diff .foo ipmap.t.list4 && rm .foo
 # Full: Delete test set
 0 ipset -X test
 # eof
index aeaa4fb6ea31fc8945e9a141f7ef653396cc50a6..560eed1c724a24f4c00d563a0bdb033c027d7c14 100644 (file)
@@ -1,8 +1,14 @@
 Name: test
-Type: ipmap
+Type: bitmap:ip
+Header: range 2.0.0.1-2.1.0.0 
+Elements: 6
+Size in memory: 8192
 References: 0
-Header: from: 2.0.0.1 to: 2.1.0.0
 Members:
 2.0.0.1
+2.0.0.128
+2.0.0.129
+2.0.0.130
+2.0.0.131
 2.1.0.0
 
index 53b76b6ae0a3f5002abe283dae3770bc45b758b2..55556a7abd27198e428189d55ff5a03530271e44 100644 (file)
@@ -1,8 +1,10 @@
 Name: test
-Type: ipmap
+Type: bitmap:ip
+Header: range 2.0.0.1-2.1.0.0 
+Elements: 2
+Size in memory: 8192
 References: 0
-Header: from: 2.0.0.0 to: 2.0.255.255
 Members:
-2.0.0.0
-2.0.255.255
+2.0.0.1
+2.1.0.0
 
index 695254b999fa7419009b83d7f38446bcd7c1e462..9e1b65d8b08b74e8cb9f2492d1c57434aaa7b4fa 100644 (file)
@@ -1,8 +1,10 @@
 Name: test
-Type: ipmap
+Type: bitmap:ip
+Header: range 2.0.0.0-2.0.255.255 
+Elements: 2
+Size in memory: 8192
 References: 0
-Header: from: 10.0.0.0 to: 10.255.255.255 netmask: 24
 Members:
-10.0.0.0
-10.255.255.0
+2.0.0.0
+2.0.255.255
 
index 3d95091c9cfd60cc7690c11ce734383665aa6c22..4b2a45a992e5d0f0882e3b58ed2aad97c5ea55b3 100644 (file)
@@ -1,8 +1,266 @@
 Name: test
-Type: ipmap
+Type: bitmap:ip
+Header: range 10.0.0.0-10.255.255.255 netmask 24 
+Elements: 258
+Size in memory: 8192
 References: 0
-Header: from: 0.0.0.0 to: 255.255.255.255 netmask: 16
 Members:
-0.0.0.0
-255.255.0.0
+10.0.0.0
+10.8.0.0
+10.8.1.0
+10.8.2.0
+10.8.3.0
+10.8.4.0
+10.8.5.0
+10.8.6.0
+10.8.7.0
+10.8.8.0
+10.8.9.0
+10.8.10.0
+10.8.11.0
+10.8.12.0
+10.8.13.0
+10.8.14.0
+10.8.15.0
+10.8.16.0
+10.8.17.0
+10.8.18.0
+10.8.19.0
+10.8.20.0
+10.8.21.0
+10.8.22.0
+10.8.23.0
+10.8.24.0
+10.8.25.0
+10.8.26.0
+10.8.27.0
+10.8.28.0
+10.8.29.0
+10.8.30.0
+10.8.31.0
+10.8.32.0
+10.8.33.0
+10.8.34.0
+10.8.35.0
+10.8.36.0
+10.8.37.0
+10.8.38.0
+10.8.39.0
+10.8.40.0
+10.8.41.0
+10.8.42.0
+10.8.43.0
+10.8.44.0
+10.8.45.0
+10.8.46.0
+10.8.47.0
+10.8.48.0
+10.8.49.0
+10.8.50.0
+10.8.51.0
+10.8.52.0
+10.8.53.0
+10.8.54.0
+10.8.55.0
+10.8.56.0
+10.8.57.0
+10.8.58.0
+10.8.59.0
+10.8.60.0
+10.8.61.0
+10.8.62.0
+10.8.63.0
+10.8.64.0
+10.8.65.0
+10.8.66.0
+10.8.67.0
+10.8.68.0
+10.8.69.0
+10.8.70.0
+10.8.71.0
+10.8.72.0
+10.8.73.0
+10.8.74.0
+10.8.75.0
+10.8.76.0
+10.8.77.0
+10.8.78.0
+10.8.79.0
+10.8.80.0
+10.8.81.0
+10.8.82.0
+10.8.83.0
+10.8.84.0
+10.8.85.0
+10.8.86.0
+10.8.87.0
+10.8.88.0
+10.8.89.0
+10.8.90.0
+10.8.91.0
+10.8.92.0
+10.8.93.0
+10.8.94.0
+10.8.95.0
+10.8.96.0
+10.8.97.0
+10.8.98.0
+10.8.99.0
+10.8.100.0
+10.8.101.0
+10.8.102.0
+10.8.103.0
+10.8.104.0
+10.8.105.0
+10.8.106.0
+10.8.107.0
+10.8.108.0
+10.8.109.0
+10.8.110.0
+10.8.111.0
+10.8.112.0
+10.8.113.0
+10.8.114.0
+10.8.115.0
+10.8.116.0
+10.8.117.0
+10.8.118.0
+10.8.119.0
+10.8.120.0
+10.8.121.0
+10.8.122.0
+10.8.123.0
+10.8.124.0
+10.8.125.0
+10.8.126.0
+10.8.127.0
+10.8.128.0
+10.8.129.0
+10.8.130.0
+10.8.131.0
+10.8.132.0
+10.8.133.0
+10.8.134.0
+10.8.135.0
+10.8.136.0
+10.8.137.0
+10.8.138.0
+10.8.139.0
+10.8.140.0
+10.8.141.0
+10.8.142.0
+10.8.143.0
+10.8.144.0
+10.8.145.0
+10.8.146.0
+10.8.147.0
+10.8.148.0
+10.8.149.0
+10.8.150.0
+10.8.151.0
+10.8.152.0
+10.8.153.0
+10.8.154.0
+10.8.155.0
+10.8.156.0
+10.8.157.0
+10.8.158.0
+10.8.159.0
+10.8.160.0
+10.8.161.0
+10.8.162.0
+10.8.163.0
+10.8.164.0
+10.8.165.0
+10.8.166.0
+10.8.167.0
+10.8.168.0
+10.8.169.0
+10.8.170.0
+10.8.171.0
+10.8.172.0
+10.8.173.0
+10.8.174.0
+10.8.175.0
+10.8.176.0
+10.8.177.0
+10.8.178.0
+10.8.179.0
+10.8.180.0
+10.8.181.0
+10.8.182.0
+10.8.183.0
+10.8.184.0
+10.8.185.0
+10.8.186.0
+10.8.187.0
+10.8.188.0
+10.8.189.0
+10.8.190.0
+10.8.191.0
+10.8.192.0
+10.8.193.0
+10.8.194.0
+10.8.195.0
+10.8.196.0
+10.8.197.0
+10.8.198.0
+10.8.199.0
+10.8.200.0
+10.8.201.0
+10.8.202.0
+10.8.203.0
+10.8.204.0
+10.8.205.0
+10.8.206.0
+10.8.207.0
+10.8.208.0
+10.8.209.0
+10.8.210.0
+10.8.211.0
+10.8.212.0
+10.8.213.0
+10.8.214.0
+10.8.215.0
+10.8.216.0
+10.8.217.0
+10.8.218.0
+10.8.219.0
+10.8.220.0
+10.8.221.0
+10.8.222.0
+10.8.223.0
+10.8.224.0
+10.8.225.0
+10.8.226.0
+10.8.227.0
+10.8.228.0
+10.8.229.0
+10.8.230.0
+10.8.231.0
+10.8.232.0
+10.8.233.0
+10.8.234.0
+10.8.235.0
+10.8.236.0
+10.8.237.0
+10.8.238.0
+10.8.239.0
+10.8.240.0
+10.8.241.0
+10.8.242.0
+10.8.243.0
+10.8.244.0
+10.8.245.0
+10.8.246.0
+10.8.247.0
+10.8.248.0
+10.8.249.0
+10.8.250.0
+10.8.251.0
+10.8.252.0
+10.8.253.0
+10.8.254.0
+10.8.255.0
+10.255.255.0
 
index d08895817ad7abbfa2b13a2d601ff72c12303650..277672d28e58333a516076f7fa3eaab330bf5b61 100644 (file)
@@ -1,5 +1,5 @@
 # Range: Try to create from an invalid range
-2 ipset -N test macipmap --from 2.0.0.1 --to 2.1.0.1
+1 ipset -N test macipmap --from 2.0.0.1 --to 2.1.0.1
 # Range: Create a set from a valid range
 0 ipset -N test macipmap --from 2.0.0.1 --to 2.1.0.0
 # Range: Add lower boundary
 1 ipset -T test 2.0.0.2,00:11:22:33:44:56
 # Range: Test value with valid MAC
 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: 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
+0 ipset -D test 2.0.200.214
 # Range: List set
 0 ipset -L test > .foo
 # Range: Check listing
@@ -35,7 +41,7 @@
 # Range: Delete test set
 0 ipset -X test
 # Network: Try to create a set from an invalid network
-2 ipset -N test macipmap --network 2.0.0.0/15
+1 ipset -N test macipmap --network 2.0.0.0/15
 # Network: Create a set from a valid network
 0 ipset -N test macipmap --network 2.0.0.0/16
 # Network: Add lower boundary
 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: 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
+1 ipset -T test 2.0.0.2,00:11:22:33:44:56
+# Network: Test value with valid MAC
+0 ipset -T test 2.0.0.2,00:11:22:33:44:55
+# Network: Add MAC to already added element
+0 ipset -A test 2.0.255.255,00:11:22:33:44:56
 # Network: List set
 0 ipset -L test > .foo
 # Network: Check listing
 0 ipset -F test
 # Network: Delete test set
 0 ipset -X test
+# Range: Create a set from a valid range with timeout
+0 ipset -N test macipmap --from 2.0.0.1 --to 2.1.0.0 timeout 10
+# Range: Add lower boundary
+0 ipset -A test 2.0.0.1 timeout 8
+# Range: Add upper boundary
+0 ipset -A test 2.1.0.0 timeout 5
+# Range: Test lower boundary
+0 ipset -T test 2.0.0.1
+# Range: Test upper boundary
+0 ipset -T test 2.1.0.0
+# Range: Test value not added to the set
+1 ipset -T test 2.0.0.2
+# Range: Test value before lower boundary
+1 ipset -T test 2.0.0.0
+# Range: Test value after upper boundary
+1 ipset -T test 2.1.0.1
+# Range: Try to add value before lower boundary
+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: Try to add value with MAC
+0 ipset -A test 2.0.0.2,00:11:22:33:44:55 timeout 8
+# Range: Test value with invalid MAC
+1 ipset -T test 2.0.0.2,00:11:22:33:44:56
+# Range: Test value with valid MAC
+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: 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
+0 ipset -D test 2.0.200.214
+# Range: Check listing
+0 ipset -L test | grep '2.0.0.2,00:11:22:33:44:55 timeout' >/dev/null
+# Range: wait 10s so that elements can timeout
+0 sleep 10
+# Range: List set
+0 ipset -L test > .foo
+# Range: Check listing
+0 diff .foo macipmap.t.list2 && rm .foo
+# Range: Flush test set
+0 ipset -F test
+# Range: Delete test set
+0 ipset -X test
 # eof
index 157ba53332c495972029a4f62f91cac4595fe336..f34c882b26b3c4ac1cf9df349f3e9d4545f1232d 100644 (file)
@@ -1,9 +1,11 @@
 Name: test
-Type: macipmap
+Type: bitmap:ip,mac
+Header: range 2.0.0.1-2.1.0.0 
+Elements: 3
+Size in memory: 458752
 References: 0
-Header: from: 2.0.0.1 to: 2.1.0.0
 Members:
-2.0.0.1,00:00:00:00:00:00
+2.0.0.1,00:11:22:33:44:56
 2.0.0.2,00:11:22:33:44:55
-2.1.0.0,00:00:00:00:00:00
+2.1.0.0
 
index dc0dc75363400bc00b31a269898ae8ee2ed4c3a3..cbdf1277fd5d75775fbc4831e8cc692212c95751 100644 (file)
@@ -1,8 +1,11 @@
 Name: test
-Type: macipmap
+Type: bitmap:ip,mac
+Header: range 2.0.0.0-2.0.255.255 
+Elements: 3
+Size in memory: 458752
 References: 0
-Header: from: 2.0.0.0 to: 2.0.255.255
 Members:
-2.0.0.0,00:00:00:00:00:00
-2.0.255.255,00:00:00:00:00:00
+2.0.0.0
+2.0.0.2,00:11:22:33:44:55
+2.0.255.255,00:11:22:33:44:56
 
index 12cdc1f8a38251ebff397bde1dc8969ff183d55a..5e058496ff4a75d4cb5385a45e72f26e383bc7cb 100644 (file)
 1 ipset -A test 0
 # Range: Try to add value after upper boundary
 1 ipset -A test 1025
+# Range: Add element in the middle
+0 ipset -A test 567
+# Range: Delete the same element
+0 ipset -D test 567
 # Range: List set
 0 ipset -L test > .foo
 # Range: Check listing
 0 ipset -F test
 # Full: Delete test set
 0 ipset -X test
+# Full: Create a full set of ports and timeout
+0 ipset -N test portmap --from 0 --to 65535 timeout 8
+# Full: Add lower boundary
+0 ipset -A test 0 timeout 5
+# Full: Add upper boundary
+0 ipset -A test 65535 timeout 0
+# Full: Test lower boundary
+0 ipset -T test 0
+# Full: Test upper boundary
+0 ipset -T test 65535
+# Full: Test value not added to the set
+1 ipset -T test 1
+# Full: Add element in the middle
+0 ipset -A test 567
+# Full: Delete the same element
+0 ipset -D test 567
+# Full: sleep 10s so that elements can timeout
+0 sleep 10
+# Full: List set
+0 ipset -L test > .foo
+# Full: Check listing
+# 0 diff .foo portmap.t.list2 && rm .foo
+# Full: Flush test set
+0 ipset -F test
+# Full: Delete test set
+0 ipset -X test
 # eof
index 809ffe1a4f06b34d3c08a9b3f69d88a09104f5c4..ed0b7d12e565a1ca9bf516cbd477e9a9317739db 100644 (file)
@@ -1,7 +1,9 @@
 Name: test
-Type: portmap
+Type: bitmap:port
+Header: range 1-1024 
+Elements: 2
+Size in memory: 128
 References: 0
-Header: from: 1 to: 1024
 Members:
 1
 1024
index 9c9b38dea7320cbf905cf7908b8e1ab3d67e5cf3..f67b128334b92000f077e95ac9c686258c600998 100644 (file)
@@ -1,7 +1,9 @@
 Name: test
-Type: portmap
+Type: bitmap:port
+Header: range 0-65535 
+Elements: 2
+Size in memory: 8192
 References: 0
-Header: from: 0 to: 65535
 Members:
 0
 65535
index d063cd7d5fb03946d8314d991c993586db5ca593..a0459058eaaf26a23b07365952066aa3ca50fd3e 100755 (executable)
@@ -1,18 +1,29 @@
 #!/bin/bash
 
 tests="init"
-tests="$tests ipmap macipmap portmap"
-tests="$tests iphash nethash ipporthash"
-tests="$tests ipportiphash ipportnethash"
-tests="$tests iptree iptreemap"
-tests="$tests setlist"
+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"
 
 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
-    ipset -X test >/dev/null 2>&1
+    ../src/ipset -X test >/dev/null 2>&1
+    if [ -f $types ]; then
+       filename=$types
+    else
+       filename=$types.t
+    fi
     while read ret cmd; do
        case $ret in
            \#)
@@ -26,7 +37,8 @@ for types in $tests; do
                ;;
        esac
        echo -ne "$types: $what: "
-       eval $cmd >/dev/null 2>&1
+       cmd=`echo $cmd | sed 's/ipset/..\/src\/ipset 2>.foo.err/'`
+       eval $cmd
        r=$?
        # echo $ret $r
        if [ "$ret" = "$r" ]; then
@@ -34,22 +46,26 @@ for types in $tests; do
        else
                echo "FAILED"
                echo "Failed test: $cmd"
+               cat .foo.err
                exit 1
        fi
        # sleep 1
-    done < $types.t
+    done < $filename
 done
 # Remove test sets created by setlist.t
-ipset -X
+../src/ipset -X >/dev/null 2>&1
 for x in $tests; do
        case $x in
        init)
                ;;
        *)
-               rmmod ip_set_$x >/dev/null 2>&1
+               for x in `lsmod | grep ip_set_ | awk '{print $1}'`; do
+                       rmmod $x >/dev/null 2>&1
+               done
                ;;
        esac
 done
 rmmod ip_set >/dev/null 2>&1
+rm -f .foo.err
 echo "All tests are passed"
 
index a01d066aab01544db457cbf88ec17651b18edef0..907148aca21d548658645fb86f6722cf0ac0fb04 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 
-awk '/^[A-Za-z]+:/ { print $0 }' $1 > .foo
-awk '!/^[A-Za-z]+:/ && !/inding/ { print $0 }' | sort >> .foo
+head -n 7 $1 > .foo
+tail -n +8 $1 | grep  '[[:alnum:]]' | sort >> .foo
+echo >> .foo
 rm $1