xdp-project / xdp-tools

Utilities and example programs for use with XDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

very new to bpf, possible to help answer this question regarding bpf_printk?

hiqsociety opened this issue · comments

for xdp-filter, trying to print

bpf_printk("d : %d", (*(value) & (mask)));     \ 

i can compile but it wont load into the interface. it's the issue of the line above.
how do i print "value" and also "key"

bpf_printk("t : %llu, %s", *(value), key); \

pls help. thx

#define CHECK_MAP(map, key, mask)                               \
        do {                                                    \
                __u64 *value;                                   \
                value = bpf_map_lookup_elem(map, key);          \
                bpf_printk("t9 : %d", (*(value) & (mask)));     \
                if ((value) && (*(value) & (mask)) == (mask)) { \
                        return VERDICT_HIT;                     \
                }                                               \
                return VERDICT_HIT;                     \
        } while (0)

Please don't use this issue tracker as a support forum for BPF programming. Try the the Slack channel instead: https://ebpf.io/slack/