Skip to content

Commit

Permalink
Add context_header support (#607)
Browse files Browse the repository at this point in the history
* upgrade to 0.18, add context_header support

* fix bad typecast
  • Loading branch information
saxena-anurag authored Jul 26, 2024
1 parent cfff5d0 commit bed474a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/xdp/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ typedef struct _EBPF_PROG_TEST_RUN_CONTEXT {
} EBPF_PROG_TEST_RUN_CONTEXT;

typedef struct _EBPF_XDP_MD {
EBPF_CONTEXT_HEADER;
xdp_md_t Base;
EBPF_PROG_TEST_RUN_CONTEXT* ProgTestRunContext;
} EBPF_XDP_MD;
Expand Down Expand Up @@ -120,7 +121,7 @@ XdpCreateContext(
XdpMd->Base.ingress_ifindex = xdp_context->ingress_ifindex;
}

*Context = XdpMd;
*Context = &XdpMd->Base;
XdpMd = NULL;

EbpfResult = EBPF_SUCCESS;
Expand Down Expand Up @@ -154,7 +155,7 @@ XdpDeleteContext(
goto Exit;
}

XdpMd = (EBPF_XDP_MD*)Context;
XdpMd = CONTAINING_RECORD(Context, EBPF_XDP_MD, Base);

// Copy the packet data to the output buffer.
if (DataOut != NULL && DataSizeOut != NULL && XdpMd->Base.data != NULL) {
Expand Down Expand Up @@ -653,6 +654,7 @@ static const ebpf_program_data_t EbpfXdpProgramData = {
.context_create = XdpCreateContext,
.context_destroy = XdpDeleteContext,
.required_irql = DISPATCH_LEVEL,
.capabilities = {.supports_context_header = TRUE},
};

static const NPI_MODULEID EbpfXdpProgramInfoProviderModuleId = {
Expand Down

0 comments on commit bed474a

Please sign in to comment.