1 // SPDX-License-Identifier: GPL-2.0
2 /* fails to load without expected_attach_type = BPF_XDP_DEVMAP
3 * because of access to egress_ifindex
6 #include <bpf/bpf_helpers.h>
9 int xdpdm_devlog(struct xdp_md
*ctx
)
11 char fmt
[] = "devmap redirect: dev %u -> dev %u len %u\n";
12 void *data_end
= (void *)(long)ctx
->data_end
;
13 void *data
= (void *)(long)ctx
->data
;
14 unsigned int len
= data_end
- data
;
16 bpf_trace_printk(fmt
, sizeof(fmt
),
17 ctx
->ingress_ifindex
, ctx
->egress_ifindex
, len
);
22 char _license
[] SEC("license") = "GPL";