From b8b943a19132936751e1a5d67360a34050f4c2e0 Mon Sep 17 00:00:00 2001 From: Jesus Sanchez-Palencia Date: Mon, 23 Oct 2023 13:06:43 -0700 Subject: [PATCH] libbpf-tools: Fix bindsnoop types usage 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] https://github.com/iovisor/bcc/pull/3051/commits/f2700731ac6c7770f12cfb42e9dfb167c17c2bb0 [2] https://github.com/iovisor/bcc/pull/3053/commits/9931ea3e6109760cbce4ec549410c712559f1398 Signed-off-by: Jesus Sanchez-Palencia --- libbpf-tools/bindsnoop.c | 4 ++-- libbpf-tools/bindsnoop.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libbpf-tools/bindsnoop.c b/libbpf-tools/bindsnoop.c index cd120358c988..00cc834c97a0 100644 --- a/libbpf-tools/bindsnoop.c +++ b/libbpf-tools/bindsnoop.c @@ -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); diff --git a/libbpf-tools/bindsnoop.h b/libbpf-tools/bindsnoop.h index fa7b19de0d49..855e62f338f3 100644 --- a/libbpf-tools/bindsnoop.h +++ b/libbpf-tools/bindsnoop.h @@ -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;