elfadel / vtl

Virtual Transport Layer (VTL)
https://vtl-project.net
GNU General Public License v3.0
3 stars 2 forks source link

【bpf_load_program() failed. -- err=22】 #5

Closed Stitches-114 closed 2 years ago

Stitches-114 commented 2 years ago

I met this problem,with a wrong message that _bpf_loadprogram() failed. -- err=22, would u tell me how to solve it.

elfadel commented 2 years ago

@Stitches-114 please, provides me with more details. Which VTL's component triggers the error (hooker, UI, etc.)? Have you correctly configure your environment for eBPF (iproute2, LLVM/Clang, etc.) ? What is your kernel version?

Stitches-114 commented 2 years ago

When I do the step Test and run Hooker in ubuntu20.04, execute the command _sudo ./vtlui in the terminal of the bin folder, select Deploy TF, Activate Hooker, and select an available device, then the error _[LAUNCHER]: bpf_loadprogram() failed. -- err=22 appeared. I think my ebpf environment is all configured and my kernel version is 5.13. By the way, what is your vtl kernel version? Thanks.

elfadel commented 2 years ago

By the way, what is your vtl kernel version?

v5.3.5

Stitches-114 commented 2 years ago

We did it again with this version of the kernel and still encountered the same problem

elfadel commented 2 years ago

@Stitches-114 I will provide with a fix soon.

elfadel commented 2 years ago

@Stitches-114 please, retry with the new instructions on 'dev' branch. Let me know if it works in order to merge and close the issue.

Stitches-114 commented 2 years ago

Sorry to bother you again,we encountered some new problems.

We launched two laptops(laptop A running a server program ,laptop B running client program) in a LAN to communicate with each other in TCP while both two machines had activated the Hooker.

Then we used Wireshark to capture packets to see which protocol is used, at first, it was TCP for sure.

After we used the hooker daemon to change the protocol from TCP to UDP in laptop A and B ,we let laptop B resend some messages to laptop A , but the package captured by the Wireshark showed that it was still using TCP.

That’s where we feel confused, we think we haven’t fully understood how the system is being used, or maybe we didn’t use the hk-daemon correctly.

Here are all problems confused us as following:

(1) We don’t know what the ‘inputmode’ and ‘outputmode’ is used for. Would you show me how to choose these modes by order?

(2) We activated the hk-daemon by using the command

' sudo ./hk-daemon 17 server’ in sever laptop, and the command

' sudo ./hk-daemon 17 client’ in client laptop.

Is that the parama of filled right?

(3) After we started using the user daemon, we just launched the TCP application to communicate, we wonder if there are any further steps that we need to complete ?

elfadel commented 2 years ago

Hello @Stitches-114

(1) We don’t know what the ‘inputmode’ and ‘outputmode’ is used for. Would you show me how to choose these modes by order?

These modes are not related to Hooker component. You need to use them if only you are using the Service API provided by VTL as well as the associated customized L4 protocols.

2) We activated the hk-daemon by using the command ' sudo ./hk-daemon 17 server’ in sever laptop, and the command ' sudo ./hk-daemon 17 client’ in client laptop. Is that the parama of filled right?

Yep. You are doing well.

(3) After we started using the user daemon, we just launched the TCP application to communicate, we wonder if there are any further steps that we need to complete ?

Nope, you don't have to do any additional manipulations.

Here is the thing: I think you are using a TCP application not registered and handled by the Hooker. In fact, Hooker handles the packets of TCP applications that port are passed to it from here link.

This is hard-coded for now. Feel free to extend this feature in order to allow dynamic port register.

So, here, for every receive/hooked packet, we first check if it belongs to a registered TCP application before process it further. You can retry again, but now using TCP applications provided in tests/legacy_client and tests/legacy_server.