Skip to content
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

rewrite sock_op program with libbpf 1.0+ #84

Merged
merged 1 commit into from
Dec 6, 2023
Merged

Conversation

SirHao
Copy link
Contributor

@SirHao SirHao commented Dec 6, 2023

Description

This commit rewrite the src/29-sockops with libbpf provided in third-party, where current code cannot work. ( See issue75)

Fixes # (issue) 75

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Complie, Load and Attach
$ make && ./load.sh
...load sucess...
$ bpftool prog show
107: sock_ops  name bpf_sockops_handler  tag e22e1120368ab3cc  gpl
        loaded_at 2023-12-06T13:04:56+0800  uid 0
        xlated 360B  jited 209B  memlock 4096B  map_ids 42,40
        btf_id 159
114: sk_msg  name bpf_redir  tag 907de5919d920159  gpl
        loaded_at 2023-12-06T13:04:56+0800  uid 0
        xlated 248B  jited 167B  memlock 4096B  map_ids 40
        btf_id 165
  • Iperf with bpf_output and tcpdump
./trace_bpf_output.sh # trace the output of sock_op

After start iperf as below, we can see the output of connection tracing from the script above

$ nohup iperf -s &
$ iperf -c 127.0.0.1

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@SirHao
Copy link
Contributor Author

SirHao commented Dec 6, 2023

@yunwei37 Can u please help me to review this PR? Thanks a lot

@yunwei37
Copy link
Member

yunwei37 commented Dec 6, 2023

Thanks a lot for your contribution!

@yunwei37
Copy link
Member

yunwei37 commented Dec 6, 2023

Would you like to update the CI in GitHub actions so it can be tested automatically?

@yunwei37
Copy link
Member

yunwei37 commented Dec 6, 2023

@SirHao
Copy link
Contributor Author

SirHao commented Dec 6, 2023

Would you like to update the CI in GitHub actions so it can be tested automatically?

@yunwei37 I am sorry although the current version are built with Makefile, it dosen't have an userspace binary to load the bpf program. (em... just like the previous version works with bpftool shell script). The makefile is just used to fetch the in-project depedencies and enable the program run with latest libbpf syntax.

@yunwei37
Copy link
Member

yunwei37 commented Dec 6, 2023

That's ok. Maybe you can add another workflow to test it. You can use commands you like and not limited to makefile.

If you are not familiar with GitHub actions, I can merge this first : ) That's ok

@SirHao
Copy link
Contributor Author

SirHao commented Dec 6, 2023

That's ok. Maybe you can add another workflow to test it. You can use commands you like and not limited to makefile.

If you are not familiar with GitHub actions, I can merge this first : ) That's ok

@yunwei37 I am indeed not familiar with Github action. Thus I have made a double check in another one environment and this project still can works. Just merge it please~

@yunwei37
Copy link
Member

yunwei37 commented Dec 6, 2023

Ok. Thanks again!

@yunwei37 yunwei37 merged commit 6a008e9 into eunomia-bpf:main Dec 6, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants