# Range: List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list4 && rm .foo
+0 diff -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
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list0
# Range: Flush test set
0 ipset flush test
# Range: Delete test set
# Network: List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list5 && rm .foo
+0 diff -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
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list1
# Network: Flush test set
0 ipset flush test
# Network: Delete test set
# Subnets: List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo
# Subnets: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list6 && rm .foo
+0 diff -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
# Subnets: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list2 && rm .foo
+0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list2
# Subnets: Flush test set
0 ipset flush test
# Subnets: Delete test set
# Full: List set
0 ipset list test > .foo
# Full: Check listing
-0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list3 && rm .foo
+0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list3
# Full: flush set
0 ipset flush test
# Full: add element with 1s timeout
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list0 && rm .foo
+0 diff -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
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list1
# Flush test set
0 ipset flush test
# Add multiple elements in one step
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip,port,net.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip,port,net.t.list0
# Sleep 5s so that elements can time out
0 sleep 5
# List set
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list0 && rm .foo
+0 diff -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
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list1
# Flush test set
0 ipset flush test
# Add multiple elements in one step
# List set
0 ipset list test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list2 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list2
# Delete set
0 ipset destroy test
# eof
# 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
+0 diff -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
# IP: Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip.t.list0
# IP: Flush test set
0 ipset -F test
# IP: Add multiple elements in one step
# 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
+0 diff -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
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip.t.list1
# Network: Flush test set
0 ipset -F test
# Network: add element with 1s timeout
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list0 && rm .foo
+0 diff -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
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list1
# Flush test set
0 ipset flush test
# Add multiple elements in one step
# 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
+0 diff -I 'Size in memory.*' .foo hash:ip6,port,net6.t.list0
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list0 && rm .foo
+0 diff -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
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list1
# Flush test set
0 ipset flush test
# Add multiple elements in one step
# 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
+0 diff -I 'Size in memory.*' .foo hash:ip6.t.list2
# IP: Save set
0 ipset save test > hash:ip6.t.restore
# Sleep 5s so that element can time out
# 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
+0 diff -I 'Size in memory.*' .foo hash:ip6.t.list0
# IP: Destroy set
0 ipset x test
# IP: Restore saved set
# 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
+0 diff -I 'Size in memory.*' .foo hash:ip6.t.list2
# IP: Flush test set
0 ipset -F test
# IP: Try to add multiple elements in one step
# 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
+0 diff -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
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo hash:ip6.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:ip6.t.list1
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
# List restored set b
0 ipset l b > .foo0 && ./sort.sh .foo0
# Check listing of set b
-0 diff -I 'Size in memory.*' .foo restore.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo restore.t.list1
# Destroy by restore
0 ipset restore < restore.t.destroy
# eof
# 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,port.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net,port.t.list1
# Flush test set
0 ipset flush test
# Add multiple elements in one step
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:net.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net.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
# IP: Check listing
-0 diff -I 'Size in memory.*' .foo hash:net.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net.t.list1
# Flush test set
0 ipset flush test
# Delete test set
# Save set
0 ipset save test > hash:net6,port.t.restore
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:net6,port.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net6,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
# IP: Check listing
-0 diff -I 'Size in memory.*' .foo hash:net6,port.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net6,port.t.list1
# Destroy set
0 ipset x test
# Restore set
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:net6,port.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net6,port.t.list0
# Flush test set
0 ipset flush test
# Add multiple elements in one step
# List set
0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo hash:net6.t.list0 && rm .foo
+0 diff -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
# IP: Check listing
-0 diff -I 'Size in memory.*' .foo hash:net6.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo hash:net6.t.list1
# Flush test set
0 ipset flush test
# Delete test set
# IP: List set
0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0
# IP: Check listing
-0 diff -I 'Size in memory.*' .foo iphash.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo iphash.t.list0
# IP: Flush test set
0 ipset -F test
# IP: Delete test set
# 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.*
+0 (grep add iphash.t.restore | sort > .foo.1) && (ipset -S test | grep add | sort > .foo.2) && cmp .foo.1 .foo.2
# 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 (grep add iphash.t.restore | sort > .foo.1) && (ipset -S test | grep add | 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
# IP: Flush test set
0 ipset -F test
# IP: Delete test set
# IP: Save the restored set
0 ipset save test | sort > .foo.1
# IP: Compare save and restore
-0 (sort iphash.t.large > .foo.2) && (cmp .foo.1 .foo.2) && rm .foo.*
+0 (sort iphash.t.large > .foo.2) && (cmp .foo.1 .foo.2)
# IP: Delete test set
0 ipset x test
# Network: Create a set
# Network: List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo iphash.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo iphash.t.list1
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
# Range: List set
0 ipset -L test > .foo
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo ipmap.t.list0 && rm .foo
+0 diff -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
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo ipmap.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipmap.t.list1
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
# Network: List set
0 ipset -L test > .foo
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo ipmap.t.list2 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipmap.t.list2
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
# Subnets: List set
0 ipset -L test > .foo
# Subnets: Check listing
-0 diff -I 'Size in memory.*' .foo ipmap.t.list3 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipmap.t.list3
# Subnets: FLush test set
0 ipset -F test
# Subnets: Delete test set
# Full: List set
0 ipset -L test > .foo
# Full: Check listing
-0 diff -I 'Size in memory.*' .foo ipmap.t.list4 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipmap.t.list4
# Full: Delete test set
0 ipset -X test
# eof
# List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo ipporthash.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipporthash.t.list0
# Flush test set
0 ipset -F test
# Delete test set
# List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo ipporthash.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipporthash.t.list1
# Flush test set
0 ipset -F test
# Delete test set
# List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo ipportiphash.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipportiphash.t.list0
# Flush test set
0 ipset -F test
# Delete test set
# List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo ipportiphash.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipportiphash.t.list1
# Flush test set
0 ipset -F test
# Delete test set
# Range: List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo ipportnethash.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipportnethash.t.list0
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
# Network: List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo ipportnethash.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo ipportnethash.t.list1
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
# Static: List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Static: Check listing
-0 diff -I 'Size in memory.*' .foo iptree.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo iptree.t.list0
# Static: Flush test set
0 ipset -F test
# Static: Delete test set
# List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo iptreemap.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo iptreemap.t.list0
# Flush test set
0 ipset -F test
# Delete test set
# Range: List set
0 ipset -L test > .foo
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo macipmap.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo macipmap.t.list0
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
# Network: List set
0 ipset -L test > .foo
# Network: Check listing
-0 diff -I 'Size in memory.*' .foo macipmap.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo macipmap.t.list1
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
# Range: List set
0 ipset -L test | sed 's/timeout ./timeout x/' > .foo
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo macipmap.t.list3 && rm .foo
+0 diff -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
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo macipmap.t.list2 && rm .foo
+0 diff -I 'Size in memory.*' .foo macipmap.t.list2
# Range: Flush test set
0 ipset -F test
# Range: add element with 1s timeout
# List set
0 ipset -L test > .foo0 && ./sort.sh .foo0
# Check listing
-0 diff -I 'Size in memory.*' .foo nethash.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo nethash.t.list0
# Flush test set
0 ipset -F test
# Delete test set
# Range: List set
0 ipset -L test > .foo
# Range: Check listing
-0 diff -I 'Size in memory.*' .foo portmap.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo portmap.t.list0
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
# Full: List set
0 ipset -L test > .foo
# Full: Check listing
-0 diff -I 'Size in memory.*' .foo portmap.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo portmap.t.list1
# Full: Flush test set
0 ipset -F test
# Full: Delete test set
# Full: List set
0 ipset -L test | sed 's/timeout ./timeout x/' > .foo
# Full: Check listing
-0 diff -I 'Size in memory.*' .foo portmap.t.list3 && rm .foo
+0 diff -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
# Full: Check listing
-# 0 diff -I 'Size in memory.*' .foo portmap.t.list2 && rm .foo
+# 0 diff -I 'Size in memory.*' .foo portmap.t.list2
# Full: Flush test set
0 ipset -F test
# Full: add element with 1s timeout
esac
done
rmmod ip_set >/dev/null 2>&1
-rm -f .foo.err
+rm -f .foo*
echo "All tests are passed"
# List set
0 ipset -L test > .foo
# Check listing
-0 diff -I 'Size in memory.*' .foo setlist.t.list0 && rm .foo
+0 diff -I 'Size in memory.*' .foo setlist.t.list0
# Flush all sets
0 ipset -F
# Delete all sets
# List test set
0 ipset list test > .foo
# Check listing
-0 diff -I 'Size in memory.*' .foo setlist.t.list1 && rm .foo
+0 diff -I 'Size in memory.*' .foo setlist.t.list1
# Test a set before b
0 ipset test test a before b
# Test c set after b
# List test set
0 ipset list test > .foo
# Check listing
-0 diff -I 'Size in memory.*' .foo setlist.t.list2 && rm .foo
+0 diff -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
# Check listing
-0 diff -I 'Size in memory.*' .foo setlist.t.list3 && rm .foo
+0 diff -I 'Size in memory.*' .foo setlist.t.list3
# Flush sets
0 ipset flush
# Destroy sets