summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2024-05-24 18:36:18 +0200
committerAlexei Starovoitov <ast@kernel.org>2024-05-25 10:48:57 -0700
commit998ffeb2738e26f134dc8e63b5dcaece22573957 (patch)
tree32d71431910f2beba683c40b443997986f08ba81 /tools
parent3998d184267dfcff858aaa84d3de17429253629d (diff)
downloadlinux-stable-998ffeb2738e26f134dc8e63b5dcaece22573957.tar.gz
linux-stable-998ffeb2738e26f134dc8e63b5dcaece22573957.tar.bz2
linux-stable-998ffeb2738e26f134dc8e63b5dcaece22573957.zip
selftests/bpf: Add netkit tests for mac address
This adds simple tests around setting MAC addresses in the different netkit modes. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/r/20240524163619.26001-3-daniel@iogearbox.net Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/tc_netkit.c10
1 files changed, 10 insertions, 0 deletions
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");