|
8 | 8 | lib_dir=$(dirname $0)/../../../../net/forwarding
|
9 | 9 |
|
10 | 10 | ALL_TESTS="single_mask_test identical_filters_test two_masks_test \
|
11 |
| - multiple_masks_test ctcam_edge_cases_test delta_simple_test" |
| 11 | + multiple_masks_test ctcam_edge_cases_test delta_simple_test \ |
| 12 | + bloom_simple_test" |
12 | 13 | NUM_NETIFS=2
|
13 | 14 | source $lib_dir/tc_common.sh
|
14 | 15 | source $lib_dir/lib.sh
|
@@ -404,6 +405,60 @@ delta_simple_test()
|
404 | 405 | log_test "delta simple test ($tcflags)"
|
405 | 406 | }
|
406 | 407 |
|
| 408 | +bloom_simple_test() |
| 409 | +{ |
| 410 | + # Bloom filter requires that the eRP table is used. This test |
| 411 | + # verifies that Bloom filter is not harming correctness of ACLs. |
| 412 | + # First, make sure that eRP table is used and then set rule patterns |
| 413 | + # which are distant enough and will result skipping a lookup after |
| 414 | + # consulting the Bloom filter. Although some eRP lookups are skipped, |
| 415 | + # the correct filter should be hit. |
| 416 | + |
| 417 | + RET=0 |
| 418 | + |
| 419 | + tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \ |
| 420 | + $tcflags dst_ip 192.0.2.2 action drop |
| 421 | + tc filter add dev $h2 ingress protocol ip pref 5 handle 104 flower \ |
| 422 | + $tcflags dst_ip 198.51.100.2 action drop |
| 423 | + tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \ |
| 424 | + $tcflags dst_ip 192.0.0.0/8 action drop |
| 425 | + |
| 426 | + $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ |
| 427 | + -t ip -q |
| 428 | + |
| 429 | + tc_check_packets "dev $h2 ingress" 101 1 |
| 430 | + check_err $? "Two filters - did not match highest priority" |
| 431 | + |
| 432 | + $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 198.51.100.1 -B 198.51.100.2 \ |
| 433 | + -t ip -q |
| 434 | + |
| 435 | + tc_check_packets "dev $h2 ingress" 104 1 |
| 436 | + check_err $? "Single filter - did not match" |
| 437 | + |
| 438 | + tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower |
| 439 | + |
| 440 | + $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ |
| 441 | + -t ip -q |
| 442 | + |
| 443 | + tc_check_packets "dev $h2 ingress" 103 1 |
| 444 | + check_err $? "Low prio filter - did not match" |
| 445 | + |
| 446 | + tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \ |
| 447 | + $tcflags dst_ip 198.0.0.0/8 action drop |
| 448 | + |
| 449 | + $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 198.51.100.1 -B 198.51.100.2 \ |
| 450 | + -t ip -q |
| 451 | + |
| 452 | + tc_check_packets "dev $h2 ingress" 102 1 |
| 453 | + check_err $? "Two filters - did not match highest priority after add" |
| 454 | + |
| 455 | + tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower |
| 456 | + tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower |
| 457 | + tc filter del dev $h2 ingress protocol ip pref 5 handle 104 flower |
| 458 | + |
| 459 | + log_test "bloom simple test ($tcflags)" |
| 460 | +} |
| 461 | + |
407 | 462 | setup_prepare()
|
408 | 463 | {
|
409 | 464 | h1=${NETIFS[p1]}
|
|
0 commit comments