| .. | .. |
|---|
| 1 | 1 | #!/bin/bash |
|---|
| 2 | 2 | # SPDX-License-Identifier: GPL-2.0 |
|---|
| 3 | 3 | |
|---|
| 4 | | -ALL_TESTS="shared_block_test" |
|---|
| 4 | +ALL_TESTS="shared_block_test match_indev_test" |
|---|
| 5 | 5 | NUM_NETIFS=4 |
|---|
| 6 | 6 | source tc_common.sh |
|---|
| 7 | 7 | source lib.sh |
|---|
| .. | .. |
|---|
| 70 | 70 | log_test "shared block ($tcflags)" |
|---|
| 71 | 71 | } |
|---|
| 72 | 72 | |
|---|
| 73 | +match_indev_test() |
|---|
| 74 | +{ |
|---|
| 75 | + RET=0 |
|---|
| 76 | + |
|---|
| 77 | + tc filter add block 22 protocol ip pref 1 handle 101 flower \ |
|---|
| 78 | + $tcflags indev $swp1 dst_mac $swmac action drop |
|---|
| 79 | + tc filter add block 22 protocol ip pref 2 handle 102 flower \ |
|---|
| 80 | + $tcflags indev $swp2 dst_mac $swmac action drop |
|---|
| 81 | + |
|---|
| 82 | + $MZ $h1 -c 1 -p 64 -a $h1mac -b $swmac -A 192.0.2.1 -B 192.0.2.2 \ |
|---|
| 83 | + -t ip -q |
|---|
| 84 | + |
|---|
| 85 | + tc_check_packets "block 22" 101 1 |
|---|
| 86 | + check_err $? "Did not match first incoming packet on a block" |
|---|
| 87 | + |
|---|
| 88 | + $MZ $h2 -c 1 -p 64 -a $h2mac -b $swmac -A 192.0.2.1 -B 192.0.2.2 \ |
|---|
| 89 | + -t ip -q |
|---|
| 90 | + |
|---|
| 91 | + tc_check_packets "block 22" 102 1 |
|---|
| 92 | + check_err $? "Did not match second incoming packet on a block" |
|---|
| 93 | + |
|---|
| 94 | + tc filter del block 22 protocol ip pref 1 handle 101 flower |
|---|
| 95 | + tc filter del block 22 protocol ip pref 2 handle 102 flower |
|---|
| 96 | + |
|---|
| 97 | + log_test "indev match ($tcflags)" |
|---|
| 98 | +} |
|---|
| 99 | + |
|---|
| 73 | 100 | setup_prepare() |
|---|
| 74 | 101 | { |
|---|
| 75 | 102 | h1=${NETIFS[p1]} |
|---|