From: Daniel Borkmann <daniel@iogearbox.net>
To: martin.lau@kernel.org
Cc: razor@blackwall.org, bpf@vger.kernel.org, netdev@vger.kernel.org,
Daniel Borkmann <daniel@iogearbox.net>
Subject: [PATCH bpf v2 3/4] selftests/bpf: Add netkit tests for mac address
Date: Fri, 24 May 2024 18:36:18 +0200 [thread overview]
Message-ID: <20240524163619.26001-3-daniel@iogearbox.net> (raw)
In-Reply-To: <20240524163619.26001-1-daniel@iogearbox.net>
This adds simple tests around setting MAC addresses in the different
netkit modes.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
tools/testing/selftests/bpf/prog_tests/tc_netkit.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/tc_netkit.c b/tools/testing/selftests/bpf/prog_tests/tc_netkit.c
index 15ee7b2fc410..18b2e969a456 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_netkit.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_netkit.c
@@ -73,6 +73,16 @@ static int create_netkit(int mode, int policy, int peer_policy, int *ifindex,
"up primary");
ASSERT_OK(system("ip addr add dev " netkit_name " 10.0.0.1/24"),
"addr primary");
+
+ if (mode == NETKIT_L3) {
+ ASSERT_EQ(system("ip link set dev " netkit_name
+ " addr ee:ff:bb:cc:aa:dd 2> /dev/null"), 512,
+ "set hwaddress");
+ } else {
+ ASSERT_OK(system("ip link set dev " netkit_name
+ " addr ee:ff:bb:cc:aa:dd"),
+ "set hwaddress");
+ }
if (same_netns) {
ASSERT_OK(system("ip link set dev " netkit_peer " up"),
"up peer");
--
2.34.1
next prev parent reply other threads:[~2024-05-24 16:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 16:36 [PATCH bpf v2 1/4] netkit: Fix setting mac address in l2 mode Daniel Borkmann
2024-05-24 16:36 ` [PATCH bpf v2 2/4] netkit: Fix pkt_type override upon netkit pass verdict Daniel Borkmann
2024-05-24 16:36 ` Daniel Borkmann [this message]
2024-05-24 16:36 ` [PATCH bpf v2 4/4] selftests/bpf: Add netkit test for pkt_type Daniel Borkmann
2024-05-24 22:05 ` Martin KaFai Lau
2024-05-25 17:55 ` Alexei Starovoitov
2024-05-26 10:12 ` Daniel Borkmann
2024-05-24 18:23 ` [PATCH bpf v2 1/4] netkit: Fix setting mac address in l2 mode Stanislav Fomichev
2024-05-25 18:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240524163619.26001-3-daniel@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.