Re: [dev] Suckless DNS server

From: Jeremy <jer_AT_jer.cx>
Date: Wed, 19 Jul 2023 15:20:21 -0700

On 07/20/23 12:09AM, NRK wrote:
> FYI I'm not exactly interested in defending dq because I know nothing
> about it, but the above criticism at least seems more like knee jerk
> reaction due to something being different rather than actual/technical
> criticism.
>
> - NRK
>

Thanks for your response. Though it was a knee-jerk response, in my
experience, reimplementing libc(being different) without acknowledging
it is pretty effective heuristic for spotting non-portable code.

For example, in the ip_packet function, the author writes:
        numanswers = uint16_unpack_big(data + 6);
        ...
        while (numanswers--) {
                ...
        }

The uint16_unpack_big definition:
crypto_uint16 uint16_unpack_big(const unsigned char *x)
    crypto_uint16 y;

    y = x[0]; y <<= 8;
    y |= x[1];

    return y;
}

As you're probably already aware, if there were 3 answers, and you
were running this on a Big Endian machine, the program would attempt to
iterate over 768 answers. Instead, one can use htons(byteorder.3).

That may be another knee-jerk criticism, but I have trouble seeing any
point looking further.

Jeremy
Received on Thu Jul 20 2023 - 00:20:21 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 20 2023 - 00:24:08 CEST