Package: bpftrace
Version: 0.11.3-5
Tags: patch fixed-upstream
array indexing in bpftrace in debian stable is broken it always indexes
with 0:
Example:
#!/usr/bin/env bpftrace
#include
#include
kprobe:tcp_connect
{
$sk = ((struct sock *) arg0);
if ($sk->__sk_common.skc_family == AF_INET6) {
$d0 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[0];
$d1 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[1];
$d2 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[2];
$d3 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[3];
printf("%X %X %X %X\n", $d0, $d1, $d2, $d3);
}
}
$ bpftrace tcpconnect.bt
$ curl -v http://[:::127.0.0.1]
output:
Attaching 1 probe...
0 0 0 0
expected:
0 0 17F
This has been fixed upstream with this patch:
https://github.com/iovisor/bpftrace/pull/1457