Merge branch 'mirror-to-gretap-tests'
Petr Machata says: ==================== Test mirror-to-gretap with bridge in UL This patchset adds more tests to the mirror-to-gretap suite where bridge is present in the underlay. Specifically it adds tests for bridge VLAN handling, FDB, and bridge port STP status. In patches #1-#3, the codebase is refactored to support the new tests. In patch #4, an STP test is added to the mirroring library, that will later be called from bridge tests. In patches #5-#8, the test for mirror-to-gretap with an 802.1q bridge in underlay is adapted and more tests are added. In patch #9, an STP test is added to the test suite for mirror-to-gretap with an 802.1d bridge in underlay. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Коммит
07f7ee6ec0
|
@ -514,6 +514,29 @@ icmp6_capture_uninstall()
|
|||
__icmp_capture_add_del del 100 v6 "$@"
|
||||
}
|
||||
|
||||
__vlan_capture_add_del()
|
||||
{
|
||||
local add_del=$1; shift
|
||||
local pref=$1; shift
|
||||
local dev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
tc filter $add_del dev "$dev" ingress \
|
||||
proto 802.1q pref $pref \
|
||||
flower $filter \
|
||||
action pass
|
||||
}
|
||||
|
||||
vlan_capture_install()
|
||||
{
|
||||
__vlan_capture_add_del add 100 "$@"
|
||||
}
|
||||
|
||||
vlan_capture_uninstall()
|
||||
{
|
||||
__vlan_capture_add_del del 100 "$@"
|
||||
}
|
||||
|
||||
matchall_sink_create()
|
||||
{
|
||||
local dev=$1; shift
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
test_gretap_stp
|
||||
test_ip6gretap_stp
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
|
@ -80,6 +82,16 @@ test_ip6gretap()
|
|||
test_vlan_match gt6 'vlan_id 555 vlan_ethtype ipv6' "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_gretap_stp()
|
||||
{
|
||||
full_test_span_gre_stp gt4 $swp3.555 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_stp()
|
||||
{
|
||||
full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
|
|
|
@ -96,3 +96,35 @@ full_test_span_gre_dir_vlan()
|
|||
{
|
||||
full_test_span_gre_dir_vlan_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
full_test_span_gre_stp_ips()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local nbpdev=$1; shift
|
||||
local what=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
local h3mac=$(mac_get $h3)
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
|
||||
|
||||
bridge link set dev $nbpdev state disabled
|
||||
sleep 1
|
||||
fail_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
|
||||
|
||||
bridge link set dev $nbpdev state forwarding
|
||||
sleep 1
|
||||
quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: STP state ($tcflags)"
|
||||
}
|
||||
|
||||
full_test_span_gre_stp()
|
||||
{
|
||||
full_test_span_gre_stp_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
|
|
@ -10,8 +10,16 @@
|
|||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
test_gretap_forbidden
|
||||
test_ip6gretap_forbidden
|
||||
test_gretap_forbidden_cpu
|
||||
test_ip6gretap_forbidden_cpu
|
||||
test_gretap_forbidden_egress
|
||||
test_ip6gretap_forbidden_egress
|
||||
test_gretap_untagged_egress
|
||||
test_ip6gretap_untagged_egress
|
||||
test_gretap_fdb_roaming
|
||||
test_ip6gretap_fdb_roaming
|
||||
test_gretap_stp
|
||||
test_ip6gretap_stp
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
|
@ -43,12 +51,14 @@ setup_prepare()
|
|||
|
||||
ip link set dev $swp3 master br1
|
||||
bridge vlan add dev $swp3 vid 555
|
||||
bridge vlan add dev $swp2 vid 555
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
pre_cleanup
|
||||
|
||||
ip link set dev $swp2 nomaster
|
||||
ip link set dev $swp3 nomaster
|
||||
vlan_destroy $h3 555
|
||||
vlan_destroy br1 555
|
||||
|
@ -77,7 +87,7 @@ test_ip6gretap()
|
|||
test_vlan_match gt6 'vlan_id 555 vlan_ethtype ipv6' "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_span_gre_forbidden()
|
||||
test_span_gre_forbidden_cpu()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local what=$1; shift
|
||||
|
@ -91,24 +101,144 @@ test_span_gre_forbidden()
|
|||
# Now forbid the VLAN at the bridge and see it fail.
|
||||
bridge vlan del dev br1 vid 555 self
|
||||
sleep 1
|
||||
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
bridge vlan add dev br1 vid 555 self
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: vlan forbidden at a bridge ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap_forbidden()
|
||||
test_gretap_forbidden_cpu()
|
||||
{
|
||||
test_span_gre_forbidden gt4 "mirror to gretap"
|
||||
test_span_gre_forbidden_cpu gt4 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_forbidden()
|
||||
test_ip6gretap_forbidden_cpu()
|
||||
{
|
||||
test_span_gre_forbidden gt4 "mirror to ip6gretap"
|
||||
test_span_gre_forbidden_cpu gt6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_span_gre_forbidden_egress()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local what=$1; shift
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
|
||||
bridge vlan del dev $swp3 vid 555
|
||||
sleep 1
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
|
||||
bridge vlan add dev $swp3 vid 555
|
||||
# Re-prime FDB
|
||||
arping -I br1.555 192.0.2.130 -fqc 1
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: vlan forbidden at a bridge egress ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap_forbidden_egress()
|
||||
{
|
||||
test_span_gre_forbidden_egress gt4 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_forbidden_egress()
|
||||
{
|
||||
test_span_gre_forbidden_egress gt6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_span_gre_untagged_egress()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local what=$1; shift
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_vlan_dir $h3 555 ingress
|
||||
|
||||
bridge vlan add dev $swp3 vid 555 pvid untagged
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_vlan_dir $h3 555 ingress
|
||||
|
||||
bridge vlan add dev $swp3 vid 555
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_vlan_dir $h3 555 ingress
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: vlan untagged at a bridge egress ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap_untagged_egress()
|
||||
{
|
||||
test_span_gre_untagged_egress gt4 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_untagged_egress()
|
||||
{
|
||||
test_span_gre_untagged_egress gt6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_span_gre_fdb_roaming()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local what=$1; shift
|
||||
local h3mac=$(mac_get $h3)
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
|
||||
bridge fdb del dev $swp3 $h3mac vlan 555 master
|
||||
bridge fdb add dev $swp2 $h3mac vlan 555 master
|
||||
sleep 1
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
|
||||
bridge fdb del dev $swp2 $h3mac vlan 555 master
|
||||
# Re-prime FDB
|
||||
arping -I br1.555 192.0.2.130 -fqc 1
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: MAC roaming ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap_fdb_roaming()
|
||||
{
|
||||
test_span_gre_fdb_roaming gt4 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_fdb_roaming()
|
||||
{
|
||||
test_span_gre_fdb_roaming gt6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_gretap_stp()
|
||||
{
|
||||
full_test_span_gre_stp gt4 $swp3 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_stp()
|
||||
{
|
||||
full_test_span_gre_stp gt6 $swp3 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
|
|
|
@ -92,3 +92,41 @@ test_span_dir()
|
|||
{
|
||||
test_span_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
do_test_span_vlan_dir_ips()
|
||||
{
|
||||
local expect=$1; shift
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local direction=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
# Install the capture as skip_hw to avoid double-counting of packets.
|
||||
# The traffic is meant for local box anyway, so will be trapped to
|
||||
# kernel.
|
||||
vlan_capture_install $dev "skip_hw vlan_id $vid"
|
||||
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
|
||||
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
|
||||
vlan_capture_uninstall $dev
|
||||
}
|
||||
|
||||
quick_test_span_vlan_dir_ips()
|
||||
{
|
||||
do_test_span_vlan_dir_ips 10 "$@"
|
||||
}
|
||||
|
||||
fail_test_span_vlan_dir_ips()
|
||||
{
|
||||
do_test_span_vlan_dir_ips 0 "$@"
|
||||
}
|
||||
|
||||
quick_test_span_vlan_dir()
|
||||
{
|
||||
quick_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
fail_test_span_vlan_dir()
|
||||
{
|
||||
fail_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
|
|
@ -76,44 +76,6 @@ test_vlan()
|
|||
test_vlan_dir egress 0 8
|
||||
}
|
||||
|
||||
vlan_capture_add_del()
|
||||
{
|
||||
local add_del=$1; shift
|
||||
local pref=$1; shift
|
||||
local dev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
tc filter $add_del dev "$dev" ingress \
|
||||
proto 802.1q pref $pref \
|
||||
flower $filter \
|
||||
action pass
|
||||
}
|
||||
|
||||
vlan_capture_install()
|
||||
{
|
||||
vlan_capture_add_del add 100 "$@"
|
||||
}
|
||||
|
||||
vlan_capture_uninstall()
|
||||
{
|
||||
vlan_capture_add_del del 100 "$@"
|
||||
}
|
||||
|
||||
do_test_span_vlan_dir_ips()
|
||||
{
|
||||
local expect=$1; shift
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local direction=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
vlan_capture_install $dev "vlan_id $vid"
|
||||
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
|
||||
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
|
||||
vlan_capture_uninstall $dev
|
||||
}
|
||||
|
||||
test_tagged_vlan_dir()
|
||||
{
|
||||
local direction=$1; shift
|
||||
|
|
Загрузка…
Ссылка в новой задаче