xref: /freebsd/tests/sys/netpfil/pf/altq.sh (revision bfc99943b04b46a6c1c885ce7bcc6f235b7422aa)
1. $(atf_get_srcdir)/utils.subr
2
3atf_test_case "hfsc" "cleanup"
4hfsc_head()
5{
6	atf_set descr 'Basic HFSC test'
7	atf_set require.user root
8}
9
10hfsc_body()
11{
12	altq_init
13	is_altq_supported hfsc
14
15	epair=$(vnet_mkepair)
16	vnet_mkjail altq_hfsc ${epair}b
17
18	ifconfig ${epair}a 192.0.2.1/24 up
19	jexec altq_hfsc ifconfig ${epair}b 192.0.2.2/24 up
20
21	# Sanity check
22	atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2
23
24	jexec altq_hfsc pfctl -e
25	pft_set_rules altq_hfsc \
26	    "altq on ${epair}b bandwidth 100b hfsc queue { default }" \
27	    "queue default hfsc(default linkshare 80b)" \
28	    "pass proto icmp "
29
30	# single ping succeeds just fine
31	atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
32
33	# "Saturate the link"
34	ping -i .1 -c 5 -s 1200 192.0.2.2
35
36	# We should now be hitting the limits and get this packet dropped.
37	atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2
38}
39
40hfsc_cleanup()
41{
42	altq_cleanup
43}
44
45atf_init_test_cases()
46{
47	atf_add_test_case "hfsc"
48}
49
50