Skip to content

Commit

Permalink
chore(driver/modern_bpf,userspace/libpman): properly use `BPF_PROG_TY…
Browse files Browse the repository at this point in the history
…PE_TRACING` in `pman_prepare_progs_before_loading`.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
  • Loading branch information
2 people authored and poiana committed Feb 11, 2025
1 parent ad06e92 commit 10970f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions driver/modern_bpf/helpers/store/auxmap_store_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ static __always_inline void auxmap__store_socktuple_param(struct auxiliary_map *
switch(socket_family) {
case AF_INET: {
struct inet_sock *inet = (struct inet_sock *)sk;
struct sockaddr_in usrsockaddr_in = {};

uint32_t ipv4_local = 0;
uint16_t port_local = 0;
Expand All @@ -691,6 +690,7 @@ static __always_inline void auxmap__store_socktuple_param(struct auxiliary_map *
* of an UDP connection). We fallback to the address from userspace when the kernel-provided
* address is NULL */
if(port_remote == 0 && usrsockaddr != NULL) {
struct sockaddr_in usrsockaddr_in = {};
bpf_probe_read_user(&usrsockaddr_in,
bpf_core_type_size(struct sockaddr_in),
(void *)usrsockaddr);
Expand Down Expand Up @@ -725,7 +725,6 @@ static __always_inline void auxmap__store_socktuple_param(struct auxiliary_map *

case AF_INET6: {
struct inet_sock *inet = (struct inet_sock *)sk;
struct sockaddr_in6 usrsockaddr_in6 = {};

uint32_t ipv6_local[4] = {0, 0, 0, 0};
uint16_t port_local = 0;
Expand All @@ -741,6 +740,7 @@ static __always_inline void auxmap__store_socktuple_param(struct auxiliary_map *
* of an UDP connection). We fallback to the address from userspace when the kernel-provided
* address is NULL */
if(port_remote == 0 && usrsockaddr != NULL) {
struct sockaddr_in6 usrsockaddr_in6 = {};
bpf_probe_read_user(&usrsockaddr_in6,
bpf_core_type_size(struct sockaddr_in6),
(void *)usrsockaddr);
Expand Down
3 changes: 1 addition & 2 deletions userspace/libpman/src/lifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ int pman_prepare_progs_before_loading() {
bool should_disable = chosen_idx != -1;
if(!should_disable) {
if(progs[idx].feat > 0 &&
libbpf_probe_bpf_helper(BPF_PROG_TYPE_RAW_TRACEPOINT, progs[idx].feat, NULL) ==
0) {
libbpf_probe_bpf_helper(BPF_PROG_TYPE_TRACING, progs[idx].feat, NULL) == 0) {
snprintf(msg,
MAX_ERROR_MESSAGE_LEN,
"BPF program '%s' did not satisfy required feature [%d]",
Expand Down

0 comments on commit 10970f3

Please sign in to comment.