[Edited Message Follows]

Hi!

Is it possible to pass full ethernet packet from XDP to user-mode app using BCC?
I wrote C code like this:

BPF_PERF_OUTPUT(captured_data);
int capture(struct xdp_md *ctx)
{
captured_data.perf_submit(ctx, ...);
return XDP_PASS;
}

But there is no flags argument in perf_submit function (but 
bpf_perf_event_output has such argument).

Without BCC I can write such code to pass full packet to user-mode:

struct packet_info
{
uint32_t packet_len;
uint32_t iface_id;
};

struct bpf_map_def SEC("maps") captured_data =
{
.type        = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
.key_size    = sizeof(u32),
.value_size  = sizeof(u32),
.max_entries = MAX_CPUS
};

SEC("xdp")
int capture_kern(struct xdp_md *ctx)
{
u32 len = ctx->data_end - ctx->data;
u64 flags = BPF_F_CURRENT_CPU;
flags |= (u64)len << 32;
struct packet_info info = {len, ctx->ingress_ifindex};
bpf_perf_event_output(ctx, &captured_data, flags, &info, sizeof(info));

return XDP_PASS;
}

How can I do the same when using BCC?


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#1976): https://lists.iovisor.org/g/iovisor-dev/message/1976
Mute This Topic: https://lists.iovisor.org/mt/81425283/21656
Group Owner: [email protected]
Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to