Skip to content

Commit

Permalink
libbpf-tools: Fix bindsnoop types usage
Browse files Browse the repository at this point in the history
Similarly to tcpconnect [1] and tcpconnlat [2], bindsnoop is also making
use of the __int128 type and that is not defined for 32-bit platforms.

Replace __int128 with a portable array of __u8 and adjust the usage
sites as needed.

[1] iovisor@f270073
[2] iovisor@9931ea3

Signed-off-by: Jesus Sanchez-Palencia <[email protected]>
  • Loading branch information
jeez authored and yonghong-song committed Oct 25, 2023
1 parent 425d2b6 commit b8b943a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libbpf-tools/bindsnoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ static void handle_event(void *ctx, int cpu, void *data, __u32 data_sz)
i++;
}
if (e->ver == 4) {
inet_ntop(AF_INET, &e->addr, addr, sizeof(addr));
inet_ntop(AF_INET, e->addr, addr, sizeof(addr));
} else {
inet_ntop(AF_INET6, &e->addr, addr, sizeof(addr));
inet_ntop(AF_INET6, e->addr, addr, sizeof(addr));
}
printf("%-7d %-16s %-3d %-5s %-5s %-4d %-5d %-48s\n",
e->pid, e->task, e->ret, proto, opts, e->bound_dev_if, e->port, addr);
Expand Down
2 changes: 1 addition & 1 deletion libbpf-tools/bindsnoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define TASK_COMM_LEN 16

struct bind_event {
unsigned __int128 addr;
__u8 addr[16];
__u64 ts_us;
__u32 pid;
__u32 bound_dev_if;
Expand Down

0 comments on commit b8b943a

Please sign in to comment.