Re: [DTrace-devel] [PATCH] test/utils: add more reliable "get remote address" approach

Kris Van Hees
2025-07-08T20:13:58Z

On Tue, Jul 08, 2025 at 08:04:41PM +0100, Alan Maguire wrote:
<< omitted >>
> thanks; tried with build/run-dtrace with same result. However by adding
> some debug logging I think I've discovered the root cause; the order of
> .d file sorting seems to be different in the build/dlibs versus
> /usr/lib64/dtrace case, and the problem is that tcp.d actually
> implicitly relies on ip.d for ipinfo_t . We get lucky in the sort order for
> /usr/lib64/dtrace, and because an ipaddr_t * gets added during ip.d
> processing, by the time we lookup "ipaddr_t *" in tcp.d it's already in
> the D CTF dict. I _think_ the ipaddr_t * gets added as a side effect of
> the fact that there are fields of type ipaddr_t in the translated
> ipv4info_t in ip.d
>
> However in the problematic case with build/run-dtrace , net.d is still
> loaded first, and then tcp.d is loaded immediately after without an
> intervening load of ip.d. As a result we have no "ipaddr_t *", hence
>
> dtrace: invalid probe specifier ip:::send /args[4]->ipv4_protocol ==
> IPPROTO_TCP/ { @c[args[2]->ip_saddr, args[4]->ipv4_protocol] = count();
> } END { printa(@c); }:
> "/home/opc/src/dtrace-utils/build/dlibs/6.10/tcp.d", line 183: failed to
> resolve type of inet_ntoa arg#1 (ipaddr_t *): Unknown type name
>
> To fix this I think the right answer is to change the dependency tcp.d
> has on ip.d, from
>
> #pragma D depends_on provider ip
>
> to
>
> #pragma D depends_on library ip.d
>
> This is needed for other reasons (ipinfo_t declaration for example), but
> with that change the problem is resolved.

Sounds like a good solution!