Re: [PATCH bpf-next] selftests/bpf: convert test_xdp_features.sh to test_progs

From: Alexis Lothoré
Date: Tue Sep 10 2024 - 03:15:47 EST


Hey Maxime,

On 9/9/24 23:18, Maxime Chevallier wrote:
> Hi Alexis,
>
> On Mon, 09 Sep 2024 22:02:07 +0200
> Alexis Lothoré (eBPF Foundation) <alexis.lothore@xxxxxxxxxxx> wrote:

[...]

>> +static void *run_dut_echo_thread(void *arg)
>> +{
>> + struct test_data *t = (struct test_data *)arg;
>> + __u32 magic;
>> +
>> + while (!t->quit_dut_echo_thread) {
>> + struct sockaddr_storage addr;
>> + socklen_t addrlen;
>> + size_t n;
>> +
>> + n = recvfrom(t->echo_server_sock, &magic, sizeof(magic),
>> + MSG_WAITALL, (struct sockaddr *)&addr, &addrlen);
>> + if (n != sizeof(magic)) {
>> + usleep(LOOP_DELAY_US);
>> + continue;
>> + }
>> +
>> + if (htonl(magic) != CMD_ECHO)
>> + continue;
>
> Shouldn't it be ntohl here ? The former code used the ntohs helper for
> that command, and you're sending the magic in send_echo_msg with a
> htonl() so I guess here you might want to convert the value back to
> host endianness.

You are right, silly mistake from me here :) That will be fixed in v2. I'll
delay a bit before sending it to allow others to take a look at v1 too.

Thanks,

Alexis
>
> Thanks,
>
> Maxime
>

--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com