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

improve: add missing eBPF maps parameters. #405

Merged
merged 2 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions kern/bash_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct event {

struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} events SEC(".maps");

struct {
Expand Down
3 changes: 3 additions & 0 deletions kern/boringssl_masterkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ struct ssl3_handshake_st {
// bpf map
struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} mastersecret_events SEC(".maps");

struct {
Expand Down
3 changes: 3 additions & 0 deletions kern/gnutls_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ struct ssl_data_event_t {

struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} gnutls_events SEC(".maps");

/***********************************************************
Expand Down
6 changes: 6 additions & 0 deletions kern/gotls_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ struct mastersecret_gotls_t {
// bpf map
struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} mastersecret_go_events SEC(".maps");

struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} events SEC(".maps");

struct {
Expand Down
3 changes: 3 additions & 0 deletions kern/mysqld_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ struct {

struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} events SEC(".maps");

SEC("uprobe/dispatch_command")
Expand Down
3 changes: 3 additions & 0 deletions kern/nspr_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ struct ssl_data_event_t {

struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} nspr_events SEC(".maps");

/***********************************************************
Expand Down
3 changes: 3 additions & 0 deletions kern/postgres_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct data_t {

struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(u32));
__uint(value_size, sizeof(u32));
__uint(max_entries, 1024);
} events SEC(".maps");

// https://github.com/postgres/postgres/blob/7b7ed046cb2ad9f6efac90380757d5977f0f563f/src/backend/tcop/postgres.c#L987-L992
Expand Down
4 changes: 2 additions & 2 deletions kern/tc.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ static __always_inline int capture_packets(struct __sk_buff *skb, bool is_ingres
}

// egress_cls_func is called for packets that are going out of the network
SEC("classifier/egress")
SEC("classifier")
int egress_cls_func(struct __sk_buff *skb) {
return capture_packets(skb, false);
};

// ingress_cls_func is called for packets that are coming into the network
SEC("classifier/ingress")
SEC("classifier")
int ingress_cls_func(struct __sk_buff *skb) {
return capture_packets(skb, true);
};
Expand Down