From b60b8e0e3a1dfbe664d693512d978e2cd1880704 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Mon, 10 Sep 2012 21:22:23 +0200 Subject: Add /0 network support to hash:net,iface type Now it is possible to setup a single hash:net,iface type of set and a single ip6?tables match which covers all egress/ingress filtering. --- tests/hash:net,iface.t | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'tests/hash:net,iface.t') diff --git a/tests/hash:net,iface.t b/tests/hash:net,iface.t index 0ae4d4e..779d77f 100644 --- a/tests/hash:net,iface.t +++ b/tests/hash:net,iface.t @@ -1,13 +1,17 @@ # Create a set 0 ipset create test hash:net,iface hashsize 128 # Add zero valued element -1 ipset add test 0.0.0.0/0,eth0 +0 ipset add test 0.0.0.0/0,eth0 # Test zero valued element -1 ipset test test 0.0.0.0/0,eth0 +0 ipset test test 0.0.0.0/0,eth0 # Delete zero valued element -1 ipset del test 0.0.0.0/0,eth0 -# Try to add /0 -1 ipset add test 1.1.1.1/0,eth0 +0 ipset del test 0.0.0.0/0,eth0 +# Add 1.1.1.1/0 +0 ipset add test 1.1.1.1/0,eth0 +# Test 1.1.1.1/0 +0 ipset test test 1.1.1.1/0,eth0 +# Delete 1.1.1.1/0 +0 ipset del test 1.1.1.1/0,eth0 # Try to add /32 0 ipset add test 1.1.1.1/32,eth0 # Add almost zero valued element @@ -52,6 +56,34 @@ 0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0 # Check listing 0 diff -u -I 'Size in memory.*' .foo hash:net,iface.t.list2 +# Flush test set +0 ipset flush test +# Add 0/0,eth0 +0 ipset add test 0/0,eth0 +# Add 10.0.0.0/16,eth1 +0 ipset add test 10.0.0.0/16,eth1 +# Add 10.0.0.0/24,eth0 +0 ipset add test 10.0.0.0/24,eth0 +# Add 10.0.0.0/16,eth2 +0 ipset add test 10.0.0.0/16,eth2 +# Check 10.0.1.1 with eth1 +0 ipset test test 10.0.1.1,eth1 +# Check 10.0.1.1 with eth2 +0 ipset test test 10.0.1.1,eth2 +# Check 10.0.1.1 with eth0 +1 ipset test test 10.0.1.1,eth0 +# Check 10.0.0.1 with eth1 +1 ipset test test 10.0.0.1,eth1 +# Check 10.0.0.1 with eth2 +1 ipset test test 10.0.0.1,eth2 +# Check 10.0.0.1 with eth0 +0 ipset test test 10.0.0.1,eth0 +# Check 1.0.1.1 with eth1 +1 ipset test test 1.0.1.1,eth1 +# Check 1.0.1.1 with eth2 +1 ipset test test 1.0.1.1,eth2 +# Check 1.0.1.1 with eth0 +0 ipset test test 1.0.1.1,eth0 # Delete test set 0 ipset destroy test # Create test set -- cgit v1.2.3