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

Alan Maguire
2025-07-03T20:24:00Z

On 03/07/2025 20:03, Kris Van Hees wrote:
> On Thu, Jul 03, 2025 at 07:41:41PM +0100, Alan Maguire wrote:
>> On 03/07/2025 19:26, Kris Van Hees wrote:
>>> On Thu, Jul 03, 2025 at 07:02:57PM +0100, Alan Maguire wrote:
>>>> On 03/07/2025 18:06, Eugene Loh wrote:
>>>>> On 7/3/25 12:59, Alan Maguire wrote:
>>>>>
>>>>>> On 03/07/2025 17:43, Eugene Loh wrote:
>>>>>>
>>>>>>> I tested and it looks good (modulo the OL8 UEK6 issue mentioned in the
>>>>>>> patch 3/4 feedback).
>>>>>>>
>>>>>> Sorry I couldn't find that issue; is this the 5.15 problem with the ip
>>>>>> send probes?
>>>>>
>>>>>     dtrace: failed to compile script /dev/stdin:
>>>>>     ".../build/dlibs/5.2/tcp.d", line 177: failed to resolve type of
>>>>> inet_ntoa arg#1 (ipaddr_t *):
>>>>>     Unknown type name
>>>>>
>>>>
>>>> Ah, sorry yep I have a fix for that one in the next round. Basically we
>>>> need to add it to the core set of typedefs and add a type for a pointer
>>>> to ipaddr_t; we can't rely on the #pragma to include net.d unfortunately.
>>>
>>> Why can't we rely on the pragma? That is how e.g. the ip provider manages
>>> this I believe?
>>>
>>
>> Unfortunately the #pragma include doesn't do enough; it just defines a
>> type for ipaddr_t , not a type for a _pointer_ to an ipaddr_t , which is
>> what we need as a parameter to inet_ntoa(). I tried adding the ipaddr_t
>> typedef to net.d and doing the pointer lookup/addition but that doesn't
>> work either. Seems we need the core typedef + pointer addition or we hit
>> this failure.
>
> Actually, if you move 'typedef __be32 ipaddr_t;' from ip.d to net.d,
> you should be set. That is what I did in my priliminary tcp provider impl.
> I do believe that works. Either way, we use inet_ntoa() in the ip.d
> translators and that works with that typedef in the file, so this really ought
> to work.
>

Yep, I tried that in the v2 patch series; Eugene hit the undefined error
in one test and I now hit it consistently for all tcp/ip tests
unfortunately with "typedef __be32 ipaddr_t;" in net.d.

My assumption (probably wrong) is that the include of the library does
happen but nothing triggers the pointer type generation for "ipaddr *"
in the CTF dict. If there was a way to force that type generation at the
.d file level that would be great, not sure I see a way currently tho.

Alan

>>> I'd really rather not add a type like this to the core set of typedefs we
>>> can avoid it, because it really isn't a core type.
>>>
>>
>> I can't see another way round this currently unfortunately.
>>
>> Alan