** What version of lws **
v4.3.3 and v4.5.2 (both verified on the wire); same logic on current main.
** What platform and arch? **
Ubuntu 24.04 x86_64, built with -DLWS_WITH_IPV6=ON -DLWS_WITH_SYS_ASYNC_DNS=ON.
** What parts of lws does it involve? **
websocket client with async-dns (lib/system/async-dns/async-dns.c)
** Describe the bug **
Two observations, confirmed by capturing qtypes at the nameserver.
1. The AAAA query is sent before A
Observed: wire order is AAAA(28), A(1), contradicting both the in-code comment in
lws_async_dns_query() and READMEs/README.async-dns.md ("it always requests first
A and then immediately afterwards AAAA").
Cause: in lws_async_dns_writeable(), on the first send both counters are 0, so
which evaluates to 1 (= AAAA):
which = q->sent[0] >= q->sent[1]; /* 0 >= 0 -> 1, AAAA goes first */
2. LWS_SERVER_OPTION_DISABLE_IPV6 does not suppress AAAA queries
Observed: a context created with LWS_SERVER_OPTION_DISABLE_IPV6 still emits AAAA
queries.
Cause: the A/AAAA decision in lws_async_dns_writeable() is guarded only by
compile-time LWS_WITH_IPV6; the runtime option is never consulted in the async
resolver:
#if defined(LWS_WITH_IPV6)
if (!q->responded) {
/* must pick between ipv6 and ipv4 */
which = q->sent[0] >= q->sent[1];
...
q->asked = 3; /* want results for 4 & 6 before done */
}
...
#else
which = 0;
q->asked = 1;
#endif
Are these intended design or bugs? If the latter, I'd like to try providing a patch.
** What version of lws **
v4.3.3 and v4.5.2 (both verified on the wire); same logic on current
main.** What platform and arch? **
Ubuntu 24.04 x86_64, built with
-DLWS_WITH_IPV6=ON -DLWS_WITH_SYS_ASYNC_DNS=ON.** What parts of lws does it involve? **
websocket client with async-dns (
lib/system/async-dns/async-dns.c)** Describe the bug **
Two observations, confirmed by capturing qtypes at the nameserver.
1. The AAAA query is sent before A
Observed: wire order is
AAAA(28), A(1), contradicting both the in-code comment inlws_async_dns_query()andREADMEs/README.async-dns.md("it always requests firstA and then immediately afterwards AAAA").
Cause: in
lws_async_dns_writeable(), on the first send both counters are 0, sowhichevaluates to 1 (= AAAA):2.
LWS_SERVER_OPTION_DISABLE_IPV6does not suppress AAAA queriesObserved: a context created with
LWS_SERVER_OPTION_DISABLE_IPV6still emits AAAAqueries.
Cause: the A/AAAA decision in
lws_async_dns_writeable()is guarded only bycompile-time
LWS_WITH_IPV6; the runtime option is never consulted in the asyncresolver:
Are these intended design or bugs? If the latter, I'd like to try providing a patch.