netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: rtnetlink: add a small macsec test case
@ 2017-10-12  9:11 Florian Westphal
  2017-10-12 10:10 ` Sabrina Dubroca
  2017-10-13  6:06 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Westphal @ 2017-10-12  9:11 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 tools/testing/selftests/net/rtnetlink.sh | 42 ++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index a8a8cdf726b2..5215493166c9 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
 }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: rtnetlink: add a small macsec test case
  2017-10-12  9:11 [PATCH net-next] selftests: rtnetlink: add a small macsec test case Florian Westphal
@ 2017-10-12 10:10 ` Sabrina Dubroca
  2017-10-12 10:52   ` Florian Westphal
  2017-10-13  6:06 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Sabrina Dubroca @ 2017-10-12 10:10 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netdev

2017-10-12, 11:11:22 +0200, Florian Westphal wrote:
> Signed-off-by: Florian Westphal <fw@strlen.de>

Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>

Just a small detail: the "ip macsec" commands actually use genetlink
and not rtnetlink.

-- 
Sabrina

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: rtnetlink: add a small macsec test case
  2017-10-12 10:10 ` Sabrina Dubroca
@ 2017-10-12 10:52   ` Florian Westphal
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2017-10-12 10:52 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: Florian Westphal, netdev

Sabrina Dubroca <sd@queasysnail.net> wrote:
> 2017-10-12, 11:11:22 +0200, Florian Westphal wrote:
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> 
> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>

Thanks for reviewing.

> Just a small detail: the "ip macsec" commands actually use genetlink
> and not rtnetlink.

Right, but it implements rtnl link ops so it ends up
interacting with rtnetlink too...

I also added sysfs-based change of device aliases to this script,
and I'm sure I will end up adding test cases that interact with
rtnetlink via ioctl, setsockopts and so on.

rtnl_lock() is all over the place so I think it makes sense to
cover as much callsites/call paths as possible even if the entry
point is not via rtnetlink socket.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: rtnetlink: add a small macsec test case
  2017-10-12  9:11 [PATCH net-next] selftests: rtnetlink: add a small macsec test case Florian Westphal
  2017-10-12 10:10 ` Sabrina Dubroca
@ 2017-10-13  6:06 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-10-13  6:06 UTC (permalink / raw)
  To: fw; +Cc: netdev

From: Florian Westphal <fw@strlen.de>
Date: Thu, 12 Oct 2017 11:11:22 +0200

> Signed-off-by: Florian Westphal <fw@strlen.de>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-13  6:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12  9:11 [PATCH net-next] selftests: rtnetlink: add a small macsec test case Florian Westphal
2017-10-12 10:10 ` Sabrina Dubroca
2017-10-12 10:52   ` Florian Westphal
2017-10-13  6:06 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).