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

Enable eBPF support. #3893

Merged
merged 16 commits into from
Aug 16, 2024
Merged

Enable eBPF support. #3893

merged 16 commits into from
Aug 16, 2024

Conversation

EternalARK
Copy link
Contributor

Basic functionalities were enabled. Firewall rules can be simplified in order to reduce firewall workload.

@EternalARK
Copy link
Contributor Author

image
Functionality preview.

@vernesong vernesong changed the base branch from master to dev May 26, 2024 01:47
@vernesong
Copy link
Owner

Could not start on my router
1、capsh cannot set CAP_PERFMON,cap_bpf
2、I do not know what package need to installed for kernel on openwrt to make bpf work, should firgueed in makefile

@EternalARK
Copy link
Contributor Author

Could not start on my router 1、capsh cannot set CAP_PERFMON,cap_bpf 2、I do not know what package need to installe for kernel on openwrt to make bpf work, should firgueed in makefile

Yes, this functionality requires some kernel capabilities. Perhaps you need to recompile the kernel. But without kernel capabilities I thought capsh can perform enable. I will add code to switch capability sets for system configures.

@vernesong
Copy link
Owner

meta core:
level=error msg="Attached tc ebpf program error: cannot add clsact qdisc: no such file or directory"

premium core:
No client connections into the core when enabled

@EternalARK
Copy link
Contributor Author

meta core:
level=error msg="Attached tc ebpf program error: cannot add clsact qdisc: no such file or directory"

premium core:
No client connections into the core when enabled

Your kernel does not support ebpf. You should re-edit configure page settings and program will omit ebpf configurations I guess.

@EternalARK
Copy link
Contributor Author

meta core:
level=error msg="Attached tc ebpf program error: cannot add clsact qdisc: no such file or directory"

premium core:
No client connections into the core when enabled
meta core:
level=error msg="Attached tc ebpf program error: cannot add clsact qdisc: no such file or directory"

premium core:
No client connections into the core when enabled

And it only supports meta core I guess. Never tried on premium core.

@vernesong
Copy link
Owner

are you sure it works for you? you code is defined the firewall rule always works

@EternalARK
Copy link
Contributor Author

are you sure it works for you? you code is defined the firewall rule always works

I will do more reliability research. According to ebpf's handling, no firewall redirect should be needed, it will dial all conections out of selected interface through the program before firewall procedure. And I've tested it's true. But I've asked upperstream that DIRECT method cannot accept passthrough so likely it will not improve performance.

@EternalARK
Copy link
Contributor Author

are you sure it works for you? you code is defined the firewall rule always works

I will do more reliability research. According to ebpf's handling, no firewall redirect should be needed, it will dial all conections out of selected interface through the program before firewall procedure. And I've tested it's true. But I've asked upperstream that DIRECT method cannot accept passthrough so likely it will not improve performance.

are you sure it works for you? you code is defined the firewall rule always works

image
And it's already been changed I guess.

@EternalARK
Copy link
Contributor Author

I've compiled and run it on my arm router. It should be fine by now.

@EternalARK
Copy link
Contributor Author

luci-app-openclash_0.46.015-beta_all.zip
Try it in case you want.

@EternalARK
Copy link
Contributor Author

Please tell me if I should do more work to adapt ebpf functionality. In the future I will alter Clash Meta to impove DIRECT route out of tunnel therefore you don't need to update openclash to bypass traffic, it would be done inside clash and complete through ebpf preroute traffic program.

@vernesong vernesong merged commit 2c6edf7 into vernesong:dev Aug 16, 2024
vernesong added a commit that referenced this pull request Aug 16, 2024
* Add bypass overseas for China IP Route

* fix(init):fix typo (#3959)

* Enable eBPF support. (#3893)

* Prerequisits for eBPF settings

* Add basic eBPF function support. But firewall rule
should be investigated in order to reduce system load.

* Disable firewall when using eBPF function.

* Fix firewall settings.

* chore: add translates

* chore: fix error

* Update openclash

---------

Co-authored-by: sangyishuje1123 <152784766+sangyishuje1123@users.noreply.github.com>
Co-authored-by: vernesong <42875168+vernesong@users.noreply.github.com>

* Add bypass overseas for China IP Route

---------

Co-authored-by: sqliuchang <35466227+sqliuchang@users.noreply.github.com>
Co-authored-by: EternalARK <30522559+EternalARK@users.noreply.github.com>
Co-authored-by: sangyishuje1123 <152784766+sangyishuje1123@users.noreply.github.com>
Co-authored-by: vernesong <42875168+vernesong@users.noreply.github.com>
@ydoKFVJQDymJcb
Copy link

MetaCubeX/mihomo@0793998
...

oppen321 pushed a commit to oppen321/OpenClash that referenced this pull request Sep 21, 2024
* Prerequisits for eBPF settings

* Add basic eBPF function support. But firewall rule
should be investigated in order to reduce system load.

* Disable firewall when using eBPF function.

* Fix firewall settings.

* chore: add translates

* chore: fix error

* Update openclash

---------

Co-authored-by: sangyishuje1123 <152784766+sangyishuje1123@users.noreply.github.com>
Co-authored-by: vernesong <42875168+vernesong@users.noreply.github.com>
oppen321 pushed a commit to oppen321/OpenClash that referenced this pull request Sep 21, 2024
* Add bypass overseas for China IP Route

* fix(init):fix typo (vernesong#3959)

* Enable eBPF support. (vernesong#3893)

* Prerequisits for eBPF settings

* Add basic eBPF function support. But firewall rule
should be investigated in order to reduce system load.

* Disable firewall when using eBPF function.

* Fix firewall settings.

* chore: add translates

* chore: fix error

* Update openclash

---------

Co-authored-by: sangyishuje1123 <152784766+sangyishuje1123@users.noreply.github.com>
Co-authored-by: vernesong <42875168+vernesong@users.noreply.github.com>

* Add bypass overseas for China IP Route

---------

Co-authored-by: sqliuchang <35466227+sqliuchang@users.noreply.github.com>
Co-authored-by: EternalARK <30522559+EternalARK@users.noreply.github.com>
Co-authored-by: sangyishuje1123 <152784766+sangyishuje1123@users.noreply.github.com>
Co-authored-by: vernesong <42875168+vernesong@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants