Open huchen2021 opened 2 years ago
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
SEC("xdp")
int xdp_prog_func(struct xdp_md *ctx) {
char ip_str[18] = {};
const char fmt[] = "hello";
bpf_snprintf(ip_str, sizeof(ip_str), fmt);
// Additional code logic
return XDP_PASS;
}
char _license[] SEC("license") = "GPL";
When I use BPF_SNPRINTF on my xdp.c, it reports the following error. If I don’t use BPF_SNPRINTF, the error is gone. Any hints will be appreaciated: