Skip to content

Commit 998ffeb

Browse files
borkmannAlexei Starovoitov
authored and
Alexei Starovoitov
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 3998d18 commit 998ffeb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/testing/selftests/bpf/prog_tests/tc_netkit.c

+10
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ static int create_netkit(int mode, int policy, int peer_policy, int *ifindex,
7373
"up primary");
7474
ASSERT_OK(system("ip addr add dev " netkit_name " 10.0.0.1/24"),
7575
"addr primary");
76+
77+
if (mode == NETKIT_L3) {
78+
ASSERT_EQ(system("ip link set dev " netkit_name
79+
" addr ee:ff:bb:cc:aa:dd 2> /dev/null"), 512,
80+
"set hwaddress");
81+
} else {
82+
ASSERT_OK(system("ip link set dev " netkit_name
83+
" addr ee:ff:bb:cc:aa:dd"),
84+
"set hwaddress");
85+
}
7686
if (same_netns) {
7787
ASSERT_OK(system("ip link set dev " netkit_peer " up"),
7888
"up peer");

0 commit comments

Comments
 (0)