Skip to content

Commit

Permalink
fix broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien-curutchet committed Jan 20, 2025
1 parent f9a4f48 commit 38ac4d2
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,25 +381,12 @@ static void xdp_veth_broadcast_redirect(u32 flags)

}

SYS_NOFAIL("ip netns exec %s arping -q -c 2 -I %s -w 1 %s > /dev/null ",
net_config[0].namespace, net_config[0].remote_veth, IP_NEIGH);
SYS_NOFAIL("ip netns exec %s arping -q -c 2 -I %s -w 1 10.1.1.254 > /dev/null ",
net_config[0].namespace, net_config[0].remote_veth);

SYS_NOFAIL("ip netns exec %s ping %s -i 0.1 -c 4 -W1 > /dev/null ",
net_config[0].namespace, IP_NEIGH);

usleep(500000);

protocol = ETH_P_ARP;
for (i = 0; i < VETH_PAIRS_COUNT; i++) {
err = bpf_map_lookup_elem(cnt_map[i], &protocol, &cnt);
if (!ASSERT_OK(err, "get ARP cnt"))
goto destroy_xdp_redirect_map;

/* All remote_veth should receive the ARP request */
if (!ASSERT_EQ(cnt, 2, "compare ARP cnt"))
goto destroy_xdp_redirect_map;
}

protocol = ETH_P_IP;
for (i = 0; i < VETH_PAIRS_COUNT; i++) {
err = bpf_map_lookup_elem(cnt_map[i], &protocol, &cnt);
Expand All @@ -409,8 +396,17 @@ static void xdp_veth_broadcast_redirect(u32 flags)
/* veth11 shouldn't receive the ICMP requests
* Ohters should
*/
if (!ASSERT_EQ(cnt, i ? 4 : 0, "compare IP cnt"))
ASSERT_EQ(cnt, i ? 4 : 0, "compare IP cnt");
}

protocol = ETH_P_ARP;
for (i = 0; i < VETH_PAIRS_COUNT; i++) {
err = bpf_map_lookup_elem(cnt_map[i], &protocol, &cnt);
if (!ASSERT_OK(err, "get ARP cnt"))
goto destroy_xdp_redirect_map;

/* All remote_veth should receive the ARP request */
ASSERT_EQ(cnt, 2, "compare ARP cnt");
}

destroy_xdp_redirect_map:
Expand Down

0 comments on commit 38ac4d2

Please sign in to comment.