Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/netpfil/common/dummynet.sh
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | pipe_body() | ||||
# Sanity check | # Sanity check | ||||
atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 | atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 | ||||
jexec alcatraz dnctl pipe 1 config bw 30Byte/s | jexec alcatraz dnctl pipe 1 config bw 30Byte/s | ||||
firewall_config alcatraz ${fw} \ | firewall_config alcatraz ${fw} \ | ||||
"ipfw" \ | "ipfw" \ | ||||
"ipfw add 1000 pipe 1 ip from any to any" | "ipfw add 1000 pipe 1 ip from any to any" \ | ||||
"pf" \ | |||||
"pass dnpipe 1" | |||||
# single ping succeeds just fine | # single ping succeeds just fine | ||||
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 | atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 | ||||
# Saturate the link | # Saturate the link | ||||
ping -i .1 -c 5 -s 1200 192.0.2.2 | ping -i .1 -c 5 -s 1200 192.0.2.2 | ||||
# We should now be hitting the limits and get this packet dropped. | # We should now be hitting the limits and get this packet dropped. | ||||
Show All 25 Lines | pipe_v6_body() | ||||
# Sanity check | # Sanity check | ||||
atf_check -s exit:0 -o ignore ping6 -i .1 -c 3 -s 1200 2001:db8:42::2 | atf_check -s exit:0 -o ignore ping6 -i .1 -c 3 -s 1200 2001:db8:42::2 | ||||
jexec alcatraz dnctl pipe 1 config bw 100Byte/s | jexec alcatraz dnctl pipe 1 config bw 100Byte/s | ||||
firewall_config alcatraz ${fw} \ | firewall_config alcatraz ${fw} \ | ||||
"ipfw" \ | "ipfw" \ | ||||
"ipfw add 1000 pipe 1 ip6 from any to any" | "ipfw add 1000 pipe 1 ip6 from any to any" \ | ||||
"pf" \ | |||||
"pass dnpipe 1" | |||||
# Single ping succeeds | # Single ping succeeds | ||||
atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 | atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 | ||||
# Saturate the link | # Saturate the link | ||||
ping6 -i .1 -c 5 -s 1200 2001:db8:42::2 | ping6 -i .1 -c 5 -s 1200 2001:db8:42::2 | ||||
# We should now be hitting the limit and get this packet dropped. | # We should now be hitting the limit and get this packet dropped. | ||||
Show All 37 Lines | queue_body() | ||||
jexec alcatraz dnctl sched 1 config pipe 1 type wf2q+ | jexec alcatraz dnctl sched 1 config pipe 1 type wf2q+ | ||||
jexec alcatraz dnctl queue 100 config sched 1 weight 99 mask all | jexec alcatraz dnctl queue 100 config sched 1 weight 99 mask all | ||||
jexec alcatraz dnctl queue 200 config sched 1 weight 1 mask all | jexec alcatraz dnctl queue 200 config sched 1 weight 1 mask all | ||||
firewall_config alcatraz ${fw} \ | firewall_config alcatraz ${fw} \ | ||||
"ipfw" \ | "ipfw" \ | ||||
"ipfw add 1000 queue 100 tcp from 192.0.2.2 to any out" \ | "ipfw add 1000 queue 100 tcp from 192.0.2.2 to any out" \ | ||||
"ipfw add 1001 queue 200 icmp from 192.0.2.2 to any out" \ | "ipfw add 1001 queue 200 icmp from 192.0.2.2 to any out" \ | ||||
"ipfw add 1002 allow ip from any to any" | "ipfw add 1002 allow ip from any to any" \ | ||||
"pf" \ | |||||
"pass in proto tcp dnqueue (0, 100)" \ | |||||
"pass in proto icmp dnqueue (0, 200)" | |||||
# Single ping succeeds | # Single ping succeeds | ||||
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 | atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 | ||||
# Unsaturated TCP succeeds | # Unsaturated TCP succeeds | ||||
reply=$(echo "foo" | nc -w 5 -N 192.0.2.2 7) | reply=$(echo "foo" | nc -w 5 -N 192.0.2.2 7) | ||||
if [ "$reply" != "foo" ]; | if [ "$reply" != "foo" ]; | ||||
then | then | ||||
Show All 22 Lines | then | ||||
atf_fail "We failed prioritisation ${fails} times" | atf_fail "We failed prioritisation ${fails} times" | ||||
fi | fi | ||||
# This will fail if we reverse the pola^W priority | # This will fail if we reverse the pola^W priority | ||||
firewall_config alcatraz ${fw} \ | firewall_config alcatraz ${fw} \ | ||||
"ipfw" \ | "ipfw" \ | ||||
"ipfw add 1000 queue 200 tcp from 192.0.2.2 to any out" \ | "ipfw add 1000 queue 200 tcp from 192.0.2.2 to any out" \ | ||||
"ipfw add 1001 queue 100 icmp from 192.0.2.2 to any out" \ | "ipfw add 1001 queue 100 icmp from 192.0.2.2 to any out" \ | ||||
"ipfw add 1002 allow ip from any to any" | "ipfw add 1002 allow ip from any to any" \ | ||||
"pf" \ | |||||
"pass in proto tcp dnqueue (0, 200)" \ | |||||
"pass in proto icmp dnqueue (0, 100)" | |||||
jexec alcatraz ping -f -s 1300 192.0.2.1 & | jexec alcatraz ping -f -s 1300 192.0.2.1 & | ||||
sleep 1 | sleep 1 | ||||
fails=0 | fails=0 | ||||
for i in `seq 1 3` | for i in `seq 1 3` | ||||
do | do | ||||
result=$(dd if=/dev/zero bs=1024 count=2000 | timeout 3 nc -w 5 -N 192.0.2.2 7 | wc -c) | result=$(dd if=/dev/zero bs=1024 count=2000 | timeout 3 nc -w 5 -N 192.0.2.2 7 | wc -c) | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | queue_v6_body() | ||||
jexec alcatraz dnctl queue 200 config sched 1 weight 1 mask all | jexec alcatraz dnctl queue 200 config sched 1 weight 1 mask all | ||||
firewall_config alcatraz ${fw} \ | firewall_config alcatraz ${fw} \ | ||||
"ipfw" \ | "ipfw" \ | ||||
"ipfw add 1001 queue 100 tcp from 2001:db8:42::2 to any out" \ | "ipfw add 1001 queue 100 tcp from 2001:db8:42::2 to any out" \ | ||||
"ipfw add 1000 queue 200 ipv6-icmp from 2001:db8:42::2 to any out" \ | "ipfw add 1000 queue 200 ipv6-icmp from 2001:db8:42::2 to any out" \ | ||||
"ipfw add 1002 allow ip6 from any to any" \ | "ipfw add 1002 allow ip6 from any to any" \ | ||||
"pf" \ | "pf" \ | ||||
"pass out proto tcp dnqueue 100" \ | "pass in proto tcp dnqueue (0, 100)" \ | ||||
"pass out proto icmp6 dnqueue 200" | "pass in proto icmp6 dnqueue (0, 200)" | ||||
# Single ping succeeds | # Single ping succeeds | ||||
atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 | atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 | ||||
# Unsaturated TCP succeeds | # Unsaturated TCP succeeds | ||||
reply=$(echo "foo" | nc -w 5 -N 2001:db8:42::2 7) | reply=$(echo "foo" | nc -w 5 -N 2001:db8:42::2 7) | ||||
if [ "$reply" != "foo" ]; | if [ "$reply" != "foo" ]; | ||||
then | then | ||||
Show All 24 Lines | queue_v6_body() | ||||
# What happens if we prioritise ICMP over TCP? | # What happens if we prioritise ICMP over TCP? | ||||
firewall_config alcatraz ${fw} \ | firewall_config alcatraz ${fw} \ | ||||
"ipfw" \ | "ipfw" \ | ||||
"ipfw add 1001 queue 200 tcp from 2001:db8:42::2 to any out" \ | "ipfw add 1001 queue 200 tcp from 2001:db8:42::2 to any out" \ | ||||
"ipfw add 1000 queue 100 ipv6-icmp from 2001:db8:42::2 to any out" \ | "ipfw add 1000 queue 100 ipv6-icmp from 2001:db8:42::2 to any out" \ | ||||
"ipfw add 1002 allow ip6 from any to any" \ | "ipfw add 1002 allow ip6 from any to any" \ | ||||
"pf" \ | "pf" \ | ||||
"pass out proto tcp dnqueue 200" \ | "pass in proto tcp dnqueue (0, 200)" \ | ||||
"pass out proto icmp6 dnqueue 100" | "pass in proto icmp6 dnqueue (0, 100)" | ||||
fails=0 | fails=0 | ||||
for i in `seq 1 3` | for i in `seq 1 3` | ||||
do | do | ||||
result=$(dd if=/dev/zero bs=1024 count=1000 | timeout 3 nc -w 5 -N 2001:db8:42::2 7 | wc -c) | result=$(dd if=/dev/zero bs=1024 count=1000 | timeout 3 nc -w 5 -N 2001:db8:42::2 7 | wc -c) | ||||
if [ $result -ne 1024000 ]; | if [ $result -ne 1024000 ]; | ||||
then | then | ||||
echo "Failed to prioritise TCP traffic. Got only $result bytes" | echo "Failed to prioritise TCP traffic. Got only $result bytes" | ||||
Show All 9 Lines | |||||
queue_v6_cleanup() | queue_v6_cleanup() | ||||
{ | { | ||||
firewall_cleanup $1 | firewall_cleanup $1 | ||||
} | } | ||||
setup_tests \ | setup_tests \ | ||||
pipe \ | pipe \ | ||||
ipfw \ | ipfw \ | ||||
pf \ | |||||
pipe_v6 \ | pipe_v6 \ | ||||
ipfw \ | ipfw \ | ||||
pf \ | |||||
queue \ | queue \ | ||||
ipfw \ | ipfw \ | ||||
pf \ | |||||
queue_v6 \ | queue_v6 \ | ||||
ipfw | ipfw \ | ||||
pf |