-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
creating elf file #8
Comments
Hi! ebpf_prog/xdp.c:59:22: warning: cast to 'struct iphdr *' from smaller integer type 'int' [-Wint-to-pointer-cast]
struct iphdr *ip = (struct iphdr *)skb_network_header(skb); This is actually error, not warning - in So you can either:
|
This is most likely because you haven't defined So I'd suggest you to firstly try to get rid of all warnings, defined all missed functions and then hopefully this will gone away. |
Thanks for the reply. Looked at bpf_helpers.h. It already defines sk_buff. This look different from sk_buff(https://elixir.bootlin.com/linux/v4.9/source/include/linux/skbuff.h#L633). So, will copying help ? Also, from the sk_buff defined, it has remote_ip4 and local_ip4. Is there a way to tell if it tx or rx ? |
BTW, you don't have to use Regarding Lines 116 to 120 in 10d6705
This is minimal version taken from kernel |
BTW, what problem you're trying to solve with
|
|
Meanwhile I'll try to improve socket_filter example, but, it will take time. |
I can improve socket_filter with help. How about adding an example of capturing flow information src-ip, dst-ip, src-port, dst-port and protocol ? |
👍 |
Sure will do. As a first step, will do the IP 5 tuple info. I need to know how to get sk_buff info ?. In the example, you have is _skb_buff defined in buffers.h. Will copying skbuff from linux/skbuff.h to bpf_helpers.h help ? |
@kkbrat9 sorry I'm on PTO now and have limit access to github. It will help, but, original P.S recently #11 has been merged which could be used as example of how to bring kernel structures into |
@belyalov Sorry for late response. I was away to deal with some personal . Can work on this early next week onwards. Did see the recent update to bpf_helpers.h, it has bpf_sock_tuple which has ip-address information. Can i use them directly inside the bpf code ? |
@kkbrat9 yeah, absolutely, if it fits your needs.. :) |
I am trying to create my own elf file using examples suggested in the examples. .c file as below
LoadElf() failed: loadPrograms() failed: Invalid BPF instruction (at 0): &{133 0 1 0 4294967295}
The text was updated successfully, but these errors were encountered: