Hi,

I'm new to eBPF and bcc and I hope this is the right platform for my question. I have the following problem while working with a bpf program array map:

I have a C file that contains a program map like this:
BPF_TABLE("prog", int, int, prog_array, 2);

Later on it is called with
prog_array.call(ebpf_packet, 1);

The respective part of my python file looks like this:
b = BPF(src_file="./output.c")

prog = """
            int hello(struct __sk_buff* ebpf_packet) {
            bpf_trace_printk("Hello, World!\\n");
            return 0;
            }
            """

hw = BPF(text=prog)
hello_fn = hw.load_func("hello", BPF.SCHED_CLS)

prog_array = b["prog_array"]
prog_array[ctypes.c_int(1)] = ctypes.c_int(hello_fn.fd)

print prog_array.items()

The output of the last line is just an empty array [] and the subprogram "hello" is not called when I run the program. There is no error. I have also hash bpf tables where I can assign key and leaf without any problems and these tables are accessed correctly during the run.

Do you have any idea where my mistake could be?

Best regards,
Tanja
_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to