bpf_trace_printk result in LoadElf() failed: loadPrograms() failed: map '' doesn't exist
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 82
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
when I add bpf_trace_printk in example below, it compiles fine, when run the program, it result in error below:
[root@centos-dev basic_firewall]# ./main -drop 10.169.72.0/24 -iface ens192
LoadElf() failed: loadPrograms() failed: map '' doesn't exist
the diff
```
diff --git a/examples/xdp/basic_firewall/ebpf_prog/xdp_fw.c b/examples/xdp/basic_firewall/ebpf_prog/xdp_fw.c
index 6d399fb..b9aa66c 100644
--- a/examples/xdp/basic_firewall/ebpf_prog/xdp_fw.c
+++ b/examples/xdp/basic_firewall/ebpf_prog/xdp_fw.c
@@ -80,6 +80,8 @@ int firewall(struct xdp_md *ctx) {
key.prefixlen = 32;
key.saddr = ip->saddr;
+ bpf_trace_printk("Matched with protocol %d and sAddr %lu.\n", ip->protocol, ip->saddr);
+
// Lookup SRC IP in blacklisted IPs
__u64 *rule_idx = bpf_map_lookup_elem(&blacklist, &key);
if (rule_idx) {
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.