pf tests: test ALTQ CBQ on top of if_vlan
The main purpose of this test is to verify that we can use ALTQ on top of if_vlan, but while we're here we also exercise the CBQ code. There's already a basis test for HFSC, so it makes sense to test another algorithm while we test if_vlan. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31649
This commit is contained in:
parent
2e5ff01d0a
commit
e62175df4e
@ -24,6 +24,13 @@ vnet_mkbridge()
|
||||
echo ${ifname}
|
||||
}
|
||||
|
||||
vnet_mkvlan()
|
||||
{
|
||||
ifname=$(ifconfig vlan create)
|
||||
echo ${ifname} >> created_interfaces.lst
|
||||
echo ${ifname}
|
||||
}
|
||||
|
||||
vnet_mkloopback()
|
||||
{
|
||||
ifname=$(ifconfig lo create)
|
||||
|
@ -86,9 +86,69 @@ match_cleanup()
|
||||
altq_cleanup
|
||||
}
|
||||
|
||||
atf_test_case "cbq_vlan" "cleanup"
|
||||
cbq_vlan_head()
|
||||
{
|
||||
atf_set descr 'CBQ over VLAN test'
|
||||
atf_set require.user root
|
||||
}
|
||||
|
||||
cbq_vlan_body()
|
||||
{
|
||||
altq_init
|
||||
is_altq_supported cbq
|
||||
|
||||
epair=$(vnet_mkepair)
|
||||
vnet_mkjail altq_cbq_vlan ${epair}b
|
||||
|
||||
vlan=$(vnet_mkvlan)
|
||||
ifconfig ${vlan} vlan 42 vlandev ${epair}a
|
||||
ifconfig ${vlan} 192.0.2.1/24 up
|
||||
ifconfig ${epair}a up
|
||||
|
||||
vlanj=$(jexec altq_cbq_vlan ifconfig vlan create)
|
||||
echo ${vlanj} >> created_interfaces.lst
|
||||
|
||||
jexec altq_cbq_vlan ifconfig ${epair}b up
|
||||
jexec altq_cbq_vlan ifconfig ${vlanj} vlan 42 vlandev ${epair}b
|
||||
jexec altq_cbq_vlan ifconfig ${vlanj} 192.0.2.2/24 up
|
||||
|
||||
# Sanity check
|
||||
atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2
|
||||
|
||||
jexec altq_cbq_vlan pfctl -e
|
||||
pft_set_rules altq_cbq_vlan \
|
||||
"altq on ${vlanj} bandwidth 14000b cbq queue { default }" \
|
||||
"queue default bandwidth 14000b cbq(default) { slow } " \
|
||||
"queue slow bandwidth 6000b cbq(borrow)" \
|
||||
"match proto icmp queue slow" \
|
||||
"match proto tcp queue default" \
|
||||
"pass"
|
||||
|
||||
# single ping succeeds just fine
|
||||
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
|
||||
|
||||
# "Saturate the link"
|
||||
ping -i .01 -c 50 -s 1200 192.0.2.2
|
||||
|
||||
# We should now be hitting the limits and get these packet dropped.
|
||||
rcv=$(ping -i .1 -c 5 -s 1200 192.0.2.2 | tr "," "\n" | awk '/packets received/ { print $1; }')
|
||||
echo "Received $rcv packets"
|
||||
if [ ${rcv} -gt 1 ]
|
||||
then
|
||||
atf_fail "Received ${rcv} packets in a saturated link"
|
||||
fi
|
||||
}
|
||||
|
||||
cbq_vlan_cleanup()
|
||||
{
|
||||
altq_cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case "hfsc"
|
||||
atf_add_test_case "match"
|
||||
atf_add_test_case "cbq_vlan"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user