-
Notifications
You must be signed in to change notification settings - Fork 110
adapt bpf2go files in new kernel #1273
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
Conversation
Signed-off-by: lec-bit <[email protected]>
484fe24
to
407c425
Compare
Codecov ReportAttention: Patch coverage is
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Signed-off-by: lec-bit <[email protected]>
Signed-off-by: lec-bit <[email protected]>
bpf/include/bpf_common.h
Outdated
|
||
err = bpf_map_update_elem(&map_of_manager, &key, &value, BPF_ANY); | ||
if (err) | ||
BPF_LOG(ERR, KMESH, "record ip failed!, err is %d\n", err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BPF_LOG(ERR, KMESH, "record ip failed!, err is %d\n", err); | |
BPF_LOG(ERR, KMESH, "record ip failed, err is %d\n", err); |
bpf/include/bpf_common.h
Outdated
|
||
int err = bpf_map_delete_elem(&map_of_manager, &key); | ||
if (err && err != -ENOENT) | ||
BPF_LOG(ERR, KMESH, "remove ip failed!, err is %d\n", err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BPF_LOG(ERR, KMESH, "remove ip failed!, err is %d\n", err); | |
BPF_LOG(ERR, KMESH, "remove ip failed, err is %d\n", err); |
pkg/bpf/ads/loader.go
Outdated
bpf2go.KmeshSockopsObjects | ||
} | ||
|
||
func Bpf2goLoadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func Bpf2goLoadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { | |
func loadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { |
pkg/bpf/ads/loader.go
Outdated
return spec, err | ||
} | ||
|
||
func Bpf2goLoadKmeshSockOps() (*ebpf.CollectionSpec, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func Bpf2goLoadKmeshSockOps() (*ebpf.CollectionSpec, error) { | |
func loadKmeshSockOps() (*ebpf.CollectionSpec, error) { |
pkg/bpf/ads/loader_enhanced.go
Outdated
bpf2go.KmeshSockopsObjects | ||
} | ||
|
||
func Bpf2goLoadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func Bpf2goLoadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { | |
func loadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { |
pkg/bpf/ads/loader_enhanced.go
Outdated
return spec, err | ||
} | ||
|
||
func Bpf2goLoadKmeshSockOps() (*ebpf.CollectionSpec, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func Bpf2goLoadKmeshSockOps() (*ebpf.CollectionSpec, error) { | |
func loadKmeshSockOps() (*ebpf.CollectionSpec, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal interface of bpf2go uses this name 'loadKmeshSockOps'. To avoid duplicate names, I add a prefix of bpf2go.
Signed-off-by: lec-bit <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
After the ads mode adopts the new kernel modification solution, some adaptability work is not fully considered and needs to be fixed:
1.bpf2go files no longer distinguish between enhanced and unenhanced, sockops files are now always required
2.In the sockops hook point, it is necessary to determine whether it is managed by kmesh. Previously, the sockops hook point added to the ko file would come in and set the state_cb tag》The is_kmesh_manage function of sockops in the workload is mentioned in kmesh_common.h
3.compilate kmesh.ko before the compilation run
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: