Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
shankarseal committed Dec 8, 2023
1 parent 646b74c commit 3659f71
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/ebpf_program_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <guiddef.h>
#if !defined(NO_CRT) && !defined(_NO_CRT_STDIO_INLINE)
#include <stdbool.h>
#include <stdint.h>
#else
typedef unsigned char uint8_t;
Expand Down
23 changes: 23 additions & 0 deletions tests/end_to_end/netsh_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/sample/unsafe/xdp_adjust_head_unsafe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 3659f71

Please sign in to comment.