Commit 7aceeb73 authored by David S. Miller's avatar David S. Miller

Merge branch 'tc-mpls-selftests'

Guillaume Nault says:

====================
selftests: tc: Test tc-flower's MPLS features

A couple of patches for exercising the MPLS filters of tc-flower.

Patch 1 tests basic MPLS matching features: those that only work on the
first label stack entry (that is, the mpls_label, mpls_tc, mpls_bos and
mpls_ttl options).

Patch 2 tests the more generic "mpls" and "lse" options, which allow
matching MPLS fields beyond the first stack entry.

In both patches, special care is taken to skip these new tests for
incompatible versions of tc.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4098ced4 c09bfd9a
......@@ -10,6 +10,7 @@ CONFIG_NET_ACT_MIRRED=m
CONFIG_NET_ACT_MPLS=m
CONFIG_NET_ACT_VLAN=m
CONFIG_NET_CLS_FLOWER=m
CONFIG_NET_CLS_MATCHALL=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_ACT_GACT=m
CONFIG_VETH=m
......
......@@ -42,6 +42,47 @@ check_tc_version()
fi
}
# Old versions of tc don't understand "mpls_uc"
check_tc_mpls_support()
{
local dev=$1; shift
tc filter add dev $dev ingress protocol mpls_uc pref 1 handle 1 \
matchall action pipe &> /dev/null
if [[ $? -ne 0 ]]; then
echo "SKIP: iproute2 too old; tc is missing MPLS support"
return 1
fi
tc filter del dev $dev ingress protocol mpls_uc pref 1 handle 1 \
matchall
}
# Old versions of tc produce invalid json output for mpls lse statistics
check_tc_mpls_lse_stats()
{
local dev=$1; shift
local ret;
tc filter add dev $dev ingress protocol mpls_uc pref 1 handle 1 \
flower mpls lse depth 2 \
action continue &> /dev/null
if [[ $? -ne 0 ]]; then
echo "SKIP: iproute2 too old; tc-flower is missing extended MPLS support"
return 1
fi
tc -j filter show dev $dev ingress protocol mpls_uc | jq . &> /dev/null
ret=$?
tc filter del dev $dev ingress protocol mpls_uc pref 1 handle 1 \
flower
if [[ $ret -ne 0 ]]; then
echo "SKIP: iproute2 too old; tc-flower produces invalid json output for extended MPLS filters"
return 1
fi
}
check_tc_shblock_support()
{
tc filter help 2>&1 | grep block &> /dev/null
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment