diff --git a/include/ebpf_program_types.h b/include/ebpf_program_types.h index 6e0708276e..ffefc41092 100644 --- a/include/ebpf_program_types.h +++ b/include/ebpf_program_types.h @@ -7,6 +7,7 @@ #include #if !defined(NO_CRT) && !defined(_NO_CRT_STDIO_INLINE) +#include #include #else typedef unsigned char uint8_t; diff --git a/tests/end_to_end/netsh_test.cpp b/tests/end_to_end/netsh_test.cpp index a9f99a3020..2de826c5a0 100644 --- a/tests/end_to_end/netsh_test.cpp +++ b/tests/end_to_end/netsh_test.cpp @@ -356,6 +356,29 @@ TEST_CASE("show verification droppacket_unsafe.o", "[netsh][verification]") "\n"); } +TEST_CASE("show verification xdp_adjust_head_unsafe.o", "[netsh][verification]") +{ + _test_helper_netsh test_helper; + test_helper.initialize(); + + int result; + std::string output = + _run_netsh_command(handle_ebpf_show_verification, L"xdp_adjust_head_unsafe.o", L"xdp", nullptr, &result); + REQUIRE(result == ERROR_SUPPRESS_OUTPUT); + output = strip_paths(output); + REQUIRE( + output == "Verification failed\n" + "\n" + "Verification report:\n" + "\n" + "; ./tests/sample/unsafe/xdp_adjust_head_unsafe.c:38\n" + "; ethernet_header->Type = 0x0800;\n" + "16: Upper bound must be at most packet_size (valid_access(r1.offset+26, width=2) for write)\n" + "\n" + "1 errors\n" + "\n"); +} + TEST_CASE("show verification printk_unsafe.o", "[netsh][verification]") { _test_helper_netsh test_helper; diff --git a/tests/sample/unsafe/xdp_adjust_head_unsafe.c b/tests/sample/unsafe/xdp_adjust_head_unsafe.c index 3b46efaa1c..a07016fdfa 100644 --- a/tests/sample/unsafe/xdp_adjust_head_unsafe.c +++ b/tests/sample/unsafe/xdp_adjust_head_unsafe.c @@ -12,7 +12,7 @@ #include "net/ip.h" #include "net/udp.h" -SEC("xdp/xdp_adjust_head_unsafe") +SEC("xdp") int xdp_adjust_head_unsafe(xdp_md_t* ctx) {