Skip to content

Instantly share code, notes, and snippets.

@chantra
Created February 1, 2024 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chantra/b9ea112d3a9fbd75e2e73d000dc9fd65 to your computer and use it in GitHub Desktop.
Save chantra/b9ea112d3a9fbd75e2e73d000dc9fd65 to your computer and use it in GitHub Desktop.
diff --git a/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c b/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c
index b5b9e74b1044..f27e411baeff 100644
--- a/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c
+++ b/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c
@@ -145,7 +145,9 @@ static int expect_icmp(char *buf, ssize_t len)
if (len < (ssize_t)sizeof(*eth))
return -1;
- if (eth->h_proto == htons(ETH_P_IP))
+ int proto = ntohs(eth->h_proto);
+ printf("Received packet for protocol 0x%04X with length %ld\n", proto, len);
+ if (proto == ETH_P_IP)
return __expect_icmp_ipv4((char *)(eth + 1), len - sizeof(*eth));
return -1;
@@ -168,6 +170,7 @@ static void send_and_capture_test_packets(const char *test_name, int tap_fd,
filter_t filter = need_mac ? expect_icmp : expect_icmp_nomac;
+ sleep(5);
ping_dev(target_dev, false);
ret = wait_for_packet(tap_fd, filter, &timeo);
@@ -203,7 +206,6 @@ static int setup_redirect_target(const char *target_dev, bool need_mac)
if (!ASSERT_GE(target_index, 0, "if_nametoindex"))
goto fail;
- SYS(fail, "sysctl -w net.ipv6.conf.all.disable_ipv6=1");
SYS(fail, "ip link add link_err type dummy");
SYS(fail, "ip link set lo up");
SYS(fail, "ip addr add dev lo " LOCAL_SRC "/32");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment