summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-10-12 11:11:22 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-12 23:05:55 -0700
commit2d0d21c12dfa3851620f1fa9fe2d444538f1fad4 (patch)
tree8c2b19146533d7181ac7fb5ce4e3732e0c042c6b /tools
parentab104615e01c2c4cbe9ea4073a430d51f6547dd2 (diff)
downloadop-kernel-dev-2d0d21c12dfa3851620f1fa9fe2d444538f1fad4.zip
op-kernel-dev-2d0d21c12dfa3851620f1fa9fe2d444538f1fad4.tar.gz
selftests: rtnetlink: add a small macsec test case
Signed-off-by: Florian Westphal <fw@strlen.de> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/net/rtnetlink.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index a8a8cdf..5215493 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -461,6 +461,47 @@ kci_test_encap()
ip netns del "$testns"
}
+kci_test_macsec()
+{
+ msname="test_macsec0"
+ ret=0
+
+ ip macsec help 2>&1 | grep -q "^Usage: ip macsec"
+ if [ $? -ne 0 ]; then
+ echo "SKIP: macsec: iproute2 too old"
+ return 0
+ fi
+
+ ip link add link "$devdummy" "$msname" type macsec port 42 encrypt on
+ check_err $?
+ if [ $ret -ne 0 ];then
+ echo "FAIL: can't add macsec interface, skipping test"
+ return 1
+ fi
+
+ ip macsec add "$msname" tx sa 0 pn 1024 on key 01 12345678901234567890123456789012
+ check_err $?
+
+ ip macsec add "$msname" rx port 1234 address "1c:ed:de:ad:be:ef"
+ check_err $?
+
+ ip macsec add "$msname" rx port 1234 address "1c:ed:de:ad:be:ef" sa 0 pn 1 on key 00 0123456789abcdef0123456789abcdef
+ check_err $?
+
+ ip macsec show > /dev/null
+ check_err $?
+
+ ip link del dev "$msname"
+ check_err $?
+
+ if [ $ret -ne 0 ];then
+ echo "FAIL: macsec"
+ return 1
+ fi
+
+ echo "PASS: macsec"
+}
+
kci_test_rtnl()
{
kci_add_dummy
@@ -478,6 +519,7 @@ kci_test_rtnl()
kci_test_ifalias
kci_test_vrf
kci_test_encap
+ kci_test_macsec
kci_del_dummy
}
OpenPOWER on IntegriCloud