From d95c2f1eb788c4ccb1ce6f4add61943dbb334f07 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 11 Sep 2012 17:34:37 +0200 Subject: The set type revision number is added to the header part of listing Incompatibility: if your script rely on the number of lines in the header of set listings, then the new line Revision: number can break your script. --- lib/session.c | 7 ++++--- tests/bitmap:ip.t | 14 +++++++------- tests/hash:ip,port,ip.t | 4 ++-- tests/hash:ip,port,net.t | 2 +- tests/hash:ip,port.t | 6 +++--- tests/hash:ip.t | 8 ++++---- tests/hash:ip6,port,ip6.t | 4 ++-- tests/hash:ip6,port,net6.t | 2 +- tests/hash:ip6,port.t | 4 ++-- tests/hash:ip6.t | 14 +++++++------- tests/hash:net,iface.t | 8 ++++---- tests/hash:net,port.t | 4 ++-- tests/hash:net.t | 6 +++--- tests/hash:net6,port.t | 6 +++--- tests/hash:net6.t | 4 ++-- tests/iphash.t | 4 ++-- tests/ipmap.t | 10 +++++----- tests/ipporthash.t | 4 ++-- tests/ipportiphash.t | 4 ++-- tests/ipportnethash.t | 4 ++-- tests/iptree.t | 2 +- tests/iptreemap.t | 2 +- tests/macipmap.t | 8 ++++---- tests/nethash.t | 2 +- tests/portmap.t | 8 ++++---- tests/setlist.t | 10 +++++----- 26 files changed, 76 insertions(+), 75 deletions(-) diff --git a/lib/session.c b/lib/session.c index 3803bfa..d5f220f 100644 --- a/lib/session.c +++ b/lib/session.c @@ -842,18 +842,19 @@ list_create(struct ipset_session *session, struct nlattr *nla[]) break; case IPSET_LIST_PLAIN: safe_snprintf(session, "%sName: %s\n" - "Type: %s\nHeader: ", + "Type: %s\nRevision: %u\nHeader: ", session->printed_set ? "\n" : "", ipset_data_setname(data), - type->name); + type->name, type->revision); break; case IPSET_LIST_XML: safe_snprintf(session, "\n" " %s\n" + " \n", ipset_data_setname(data), - type->name); + type->name, type->revision); break; default: break; diff --git a/tests/bitmap:ip.t b/tests/bitmap:ip.t index dc914d1..4389d8f 100644 --- a/tests/bitmap:ip.t +++ b/tests/bitmap:ip.t @@ -35,13 +35,13 @@ # Range: Add a range of elements 0 ipset -A test 2.0.0.128-2.0.0.131 timeout 4 # Range: List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list4 # Sleep 5s so that entries can time out 0 sleep 5s # Range: List set after timeout -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list0 # Range: Flush test set @@ -77,13 +77,13 @@ # Network: Delete the same element 0 ipset -D test 2.0.0.128 # Network: List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list5 # Sleep 5s so that entries can time out 0 sleep 5s # Network: List set -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list1 # Network: Flush test set @@ -119,13 +119,13 @@ # Subnets: Add a subnet of subnets 0 ipset -A test 10.8.0.0/16 timeout 4 # Subnets: List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo # Subnets: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list6 # Sleep 5s so that entries can time out 0 sleep 5s # Subnets: List set -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Subnets: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list2 # Subnets: Flush test set @@ -145,7 +145,7 @@ # Full: Test element not added to the set 1 ipset test test 0.1.0.0 # Full: List set -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Full: Check listing 0 diff -u -I 'Size in memory.*' .foo bitmap:ip.t.list3 # Full: flush set diff --git a/tests/hash:ip,port,ip.t b/tests/hash:ip,port,ip.t index 01132e8..26710c6 100644 --- a/tests/hash:ip,port,ip.t +++ b/tests/hash:ip,port,ip.t @@ -35,13 +35,13 @@ # Try to add value after second random value 0 ipset add test 2.1.0.1,128,2.2.2.2 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip,port,ip.t.list0 # Sleep 5s so that elements can time out 0 sleep 5 # List set -0 ipset list test > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip,port,ip.t.list1 # Flush test set diff --git a/tests/hash:ip,port,net.t b/tests/hash:ip,port,net.t index 446c512..dad551a 100644 --- a/tests/hash:ip,port,net.t +++ b/tests/hash:ip,port,net.t @@ -27,7 +27,7 @@ # Try to add value after second random value 0 ipset add test 2.1.0.1,128,10.0.0.0/17 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip,port,net.t.list0 # Sleep 5s so that elements can time out diff --git a/tests/hash:ip,port.t b/tests/hash:ip,port.t index c2bc0cc..cd1140e 100644 --- a/tests/hash:ip,port.t +++ b/tests/hash:ip,port.t @@ -27,13 +27,13 @@ # Try to add value after second random value 0 ipset add test 2.1.0.1,128 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip,port.t.list0 # Sleep 5s so that elements can time out 0 sleep 5 # List set -0 ipset list test > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip,port.t.list1 # Flush test set @@ -69,7 +69,7 @@ # Delete element with sctp 0 ipset del test 2.0.0.1,sctp:80 # List set -0 ipset list test > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip,port.t.list2 # Delete set diff --git a/tests/hash:ip.t b/tests/hash:ip.t index 8ae584f..6da4692 100644 --- a/tests/hash:ip.t +++ b/tests/hash:ip.t @@ -19,13 +19,13 @@ # 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 +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip.t.list2 # Sleep 5s so that element can time out 0 sleep 5 # IP: List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip.t.list0 # IP: Flush test set @@ -93,13 +93,13 @@ # 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 +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Network: Check listing 0 diff -u -I 'Size in memory.*' -I 'Size in memory.*' .foo hash:ip.t.list3 # Sleep 5s so that elements can time out 0 sleep 5 # Network: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip.t.list1 # Network: Flush test set diff --git a/tests/hash:ip6,port,ip6.t b/tests/hash:ip6,port,ip6.t index 078ab6c..80e1534 100644 --- a/tests/hash:ip6,port,ip6.t +++ b/tests/hash:ip6,port,ip6.t @@ -35,13 +35,13 @@ # Try to add value after second random value 0 ipset add test 2:1:0::1,128,2:2:2::2 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list0 # Sleep 5s so that elements can time out 0 sleep 5 # List set -0 ipset list test > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list1 # Flush test set diff --git a/tests/hash:ip6,port,net6.t b/tests/hash:ip6,port,net6.t index 1955cad..1c4e856 100644 --- a/tests/hash:ip6,port,net6.t +++ b/tests/hash:ip6,port,net6.t @@ -35,7 +35,7 @@ # Range: Try to add value after second random value 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 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6,port,net6.t.list0 # Range: Flush test set diff --git a/tests/hash:ip6,port.t b/tests/hash:ip6,port.t index 884933c..d583415 100644 --- a/tests/hash:ip6,port.t +++ b/tests/hash:ip6,port.t @@ -27,13 +27,13 @@ # Try to add value after second random value 0 ipset add test 2:1:0::1,128 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6,port.t.list0 # Sleep 5s so that elements can time out 0 sleep 5 # List set -0 ipset list test > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6,port.t.list1 # Flush test set diff --git a/tests/hash:ip6.t b/tests/hash:ip6.t index a913f22..4ab5f5b 100644 --- a/tests/hash:ip6.t +++ b/tests/hash:ip6.t @@ -21,7 +21,7 @@ # 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 +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6.t.list2 # IP: Save set @@ -29,7 +29,7 @@ # Sleep 5s so that element can time out 0 sleep 5 # IP: List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6.t.list0 # IP: Destroy set @@ -37,7 +37,7 @@ # IP: Restore saved set 0 ipset restore < hash:ip6.t.restore && rm hash:ip6.t.restore # IP: List set -0 ipset -L test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6.t.list2 # IP: Flush test set @@ -73,13 +73,13 @@ # 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 +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6.t.list3 # Sleep 5s so that elements can time out 0 sleep 5 # Network: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:ip6.t.list1 # Network: Flush test set @@ -89,11 +89,11 @@ # Check more complex restore commands 0 ipset restore < restore.t.restore # List restored set a -0 ipset l a > .foo0 && ./sort.sh .foo0 +0 ipset l a | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing of set a 0 diff -u -I 'Size in memory.*' .foo restore.t.list0 # List restored set b -0 ipset l b > .foo0 && ./sort.sh .foo0 +0 ipset l b | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing of set b 0 diff -u -I 'Size in memory.*' .foo restore.t.list1 # Destroy by restore diff --git a/tests/hash:net,iface.t b/tests/hash:net,iface.t index 779d77f..f40f10b 100644 --- a/tests/hash:net,iface.t +++ b/tests/hash:net,iface.t @@ -41,7 +41,7 @@ # Try to add IP address 0 ipset add test 2.0.0.1,eth0 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net,iface.t.list0 # Flush test set @@ -53,7 +53,7 @@ # Add networks in range notation 0 ipset add test 10.2.0.0-10.2.1.12,eth0 # List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net,iface.t.list2 # Flush test set @@ -117,7 +117,7 @@ # Add overlapping networks from /4 to /30 0 (set -e; for x in `seq 4 30`; do ipset add test 192.0.0.0/$x,eth$x; done) # List test set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net,iface.t.list1 # Test matching elements in all added networks from /30 to /24 @@ -131,7 +131,7 @@ # Add clashing elements 0 (set -e; for x in `seq 0 63`; do ipset add test 10.0.0.0/16,eth$x; done) # Check listing -0 n=`ipset list test | wc -l` && test $n -eq 70 +0 n=`ipset list test | grep -v Revision: | wc -l` && test $n -eq 70 # Delete test set 0 ipset destroy test # Create test set with timeout support diff --git a/tests/hash:net,port.t b/tests/hash:net,port.t index 5b60476..34b29f1 100644 --- a/tests/hash:net,port.t +++ b/tests/hash:net,port.t @@ -41,13 +41,13 @@ # Test ICMP by name 0 ipset test test 2.0.0.255,icmp:host-prohibited # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net,port.t.list0 # Sleep 5s so that element can time out 0 sleep 5 # IP: List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net,port.t.list1 # Flush test set diff --git a/tests/hash:net.t b/tests/hash:net.t index 10e75d9..14eed43 100644 --- a/tests/hash:net.t +++ b/tests/hash:net.t @@ -33,13 +33,13 @@ # Try to add IP address 0 ipset add test 2.0.0.1 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net.t.list0 # Sleep 5s so that element can time out 0 sleep 5 # List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net.t.list1 # Flush test set @@ -51,7 +51,7 @@ # Add networks in range notation 0 ipset add test 10.2.0.0-10.2.1.12 # List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net.t.list2 # Delete test set diff --git a/tests/hash:net6,port.t b/tests/hash:net6,port.t index 063b4c9..b022e06 100644 --- a/tests/hash:net6,port.t +++ b/tests/hash:net6,port.t @@ -41,7 +41,7 @@ # Test ICMPv6 by name 0 ipset test test 192:168:68::95,icmpv6:port-unreachable # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Save set 0 ipset save test > hash:net6,port.t.restore # Check listing @@ -49,7 +49,7 @@ # Sleep 5s so that element can time out 0 sleep 5 # IP: List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net6,port.t.list1 # Destroy set @@ -57,7 +57,7 @@ # Restore set 0 ipset restore < hash:net6,port.t.restore && rm hash:net6,port.t.restore # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net6,port.t.list0 # Flush test set diff --git a/tests/hash:net6.t b/tests/hash:net6.t index 2200362..d0c2652 100644 --- a/tests/hash:net6.t +++ b/tests/hash:net6.t @@ -33,13 +33,13 @@ # Try to add IP address 0 ipset add test 3:0:0::1 # List set -0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 +0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net6.t.list0 # Sleep 5s so that element can time out 0 sleep 5 # IP: List set -0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net6.t.list1 # Flush test set diff --git a/tests/iphash.t b/tests/iphash.t index 2196a34..8fd0836 100644 --- a/tests/iphash.t +++ b/tests/iphash.t @@ -23,7 +23,7 @@ # 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 +0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0 # IP: Check listing 0 diff -u -I 'Size in memory.*' .foo iphash.t.list0 # IP: Flush test set @@ -77,7 +77,7 @@ # 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 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo iphash.t.list1 # Network: Flush test set diff --git a/tests/ipmap.t b/tests/ipmap.t index a3bff10..684fb7d 100644 --- a/tests/ipmap.t +++ b/tests/ipmap.t @@ -49,13 +49,13 @@ # Range: Restore set 0 ipset -R < ipmap.t.restore && rm ipmap.t.restore # Range: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo ipmap.t.list0 # Range: Delete a range of elements 0 ipset -! -D test 2.0.0.128-2.0.0.132 # Range: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo ipmap.t.list1 # Range: Flush test set @@ -91,7 +91,7 @@ # Network: Delete the same element 0 ipset -D test 2.0.0.128 # Network: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo ipmap.t.list2 # Network: Flush test set @@ -127,7 +127,7 @@ # Subnets: Add a subnet of subnets 0 ipset -A test 10.8.0.0/16 # Subnets: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Subnets: Check listing 0 diff -u -I 'Size in memory.*' .foo ipmap.t.list3 # Subnets: FLush test set @@ -153,7 +153,7 @@ # Full: Delete same element 0 ipset -D test 0.1.0.0 # Full: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Full: Check listing 0 diff -u -I 'Size in memory.*' .foo ipmap.t.list4 # Full: Delete test set diff --git a/tests/ipporthash.t b/tests/ipporthash.t index 4875ed8..866c720 100644 --- a/tests/ipporthash.t +++ b/tests/ipporthash.t @@ -31,7 +31,7 @@ # Try to add value after second random value 0 ipset -A test 2.1.0.1,128 # List set -0 ipset -L test > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo ipporthash.t.list0 # Flush test set @@ -61,7 +61,7 @@ # Try to add value after second random value 0 ipset -A test 2.1.0.0,128 # List set -0 ipset -L test > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo ipporthash.t.list1 # Flush test set diff --git a/tests/ipportiphash.t b/tests/ipportiphash.t index ff65de0..5632433 100644 --- a/tests/ipportiphash.t +++ b/tests/ipportiphash.t @@ -39,7 +39,7 @@ # Try to add value after second random value 0 ipset -A test 2.1.0.1,128,2.2.2.2 # List set -0 ipset -L test > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo ipportiphash.t.list0 # Flush test set @@ -71,7 +71,7 @@ # Try to del value before first random value 0 ipset -D test 1.255.255.255,5,1.1.1.1 # List set -0 ipset -L test > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo ipportiphash.t.list1 # Flush test set diff --git a/tests/ipportnethash.t b/tests/ipportnethash.t index 120ff88..f5be27f 100644 --- a/tests/ipportnethash.t +++ b/tests/ipportnethash.t @@ -35,7 +35,7 @@ # Range: Try to add value after second random value 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 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo ipportnethash.t.list0 # Range: Flush test set @@ -65,7 +65,7 @@ # Network: Try to add value after second random value 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 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo ipportnethash.t.list1 # Network: Flush test set diff --git a/tests/iptree.t b/tests/iptree.t index 2185a9f..1e5f7ad 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 > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Static: Check listing 0 diff -u -I 'Size in memory.*' .foo iptree.t.list0 # Static: Flush test set diff --git a/tests/iptreemap.t b/tests/iptreemap.t index 5a4d307..8061b4f 100644 --- a/tests/iptreemap.t +++ b/tests/iptreemap.t @@ -49,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 > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo iptreemap.t.list0 # Flush test set diff --git a/tests/macipmap.t b/tests/macipmap.t index 19fb039..e10fe03 100644 --- a/tests/macipmap.t +++ b/tests/macipmap.t @@ -39,7 +39,7 @@ # Range: Delete the same element 0 ipset -D test 2.0.200.214 # Range: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo macipmap.t.list0 # Range: Flush test set @@ -79,7 +79,7 @@ # 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 +0 ipset -L test | grep -v Revision: > .foo # Network: Check listing 0 diff -u -I 'Size in memory.*' .foo macipmap.t.list1 # Network: Flush test set @@ -119,13 +119,13 @@ # 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 +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo macipmap.t.list3 # Range: sleep 5s so that elements can timeout 0 sleep 5 # Range: List set -0 ipset -L test | sed 's/timeout ./timeout x/' > .foo +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo macipmap.t.list2 # Range: Flush test set diff --git a/tests/nethash.t b/tests/nethash.t index 40f79fe..273ceeb 100644 --- a/tests/nethash.t +++ b/tests/nethash.t @@ -33,7 +33,7 @@ # Try to add IP address 0 ipset -A test 2.0.0.1 # List set -0 ipset -L test > .foo0 && ./sort.sh .foo0 +0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo nethash.t.list0 # Flush test set diff --git a/tests/portmap.t b/tests/portmap.t index c9856bf..36ad682 100644 --- a/tests/portmap.t +++ b/tests/portmap.t @@ -25,7 +25,7 @@ # Range: Delete the same element 0 ipset -D test 567 # Range: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Range: Check listing 0 diff -u -I 'Size in memory.*' .foo portmap.t.list0 # Range: Flush test set @@ -45,7 +45,7 @@ # Full: Test value not added to the set 1 ipset -T test 1 # Full: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Full: Check listing 0 diff -u -I 'Size in memory.*' .foo portmap.t.list1 # Full: Flush test set @@ -69,13 +69,13 @@ # Full: Delete the same element 0 ipset -D test 567 # Full: List set -0 ipset -L test | sed 's/timeout ./timeout x/' > .foo +0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo # Full: Check listing 0 diff -u -I 'Size in memory.*' .foo portmap.t.list3 # Full: sleep 5s so that elements can timeout 0 sleep 5 # Full: List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Full: Check listing # 0 diff -u -I 'Size in memory.*' .foo portmap.t.list2 # Full: Flush test set diff --git a/tests/setlist.t b/tests/setlist.t index 6f81afc..aa360b9 100644 --- a/tests/setlist.t +++ b/tests/setlist.t @@ -45,7 +45,7 @@ # Restore saved sets 0 ipset -R < setlist.t.r # List set -0 ipset -L test > .foo +0 ipset -L test | grep -v Revision: > .foo # Check listing 0 diff -u -I 'Size in memory.*' .foo setlist.t.list0 # Flush all sets @@ -61,7 +61,7 @@ # Add set a before b 0 ipset add test a before b # List test set -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Check listing 0 diff -u -I 'Size in memory.*' .foo setlist.t.list1 # Test a set before b @@ -71,17 +71,17 @@ # Delete b set before c 0 ipset del test b before c # List test set -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Check listing 0 diff -u -I 'Size in memory.*' .foo setlist.t.list2 # Delete c set after a 0 ipset del test c after a # List test set -0 ipset list test > .foo +0 ipset list test | grep -v Revision: > .foo # Check listing 0 diff -u -I 'Size in memory.*' .foo setlist.t.list3 # List all sets -0 ipset list > .foo +0 ipset list | grep -v Revision: > .foo # Check listing 0 diff -u -I 'Size in memory.*' .foo setlist.t.list4 # Flush sets -- cgit v1.2.3