hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 3eed986989ddd2a7473f6896ba5751b6a51b0a37
parent 17089efd9e51eb2ea9b835bc89350c8dbc284f6a
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 21 Jun 2021 13:02:51 -0400

net::dns: minor fixes

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mnet/dns/query.ha | 7++++---
Mscripts/gen-stdlib | 3++-
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/dns/query.ha b/net/dns/query.ha @@ -3,8 +3,9 @@ use net::udp; use unix::resolvconf; // Performs a DNS query using the provided list of DNS servers. The caller must -// free the return value with [[message_free]]. If no DNS servers are provided, -// the system defaults (if any) are used. +// free the return value with [[message_free]]. +// +// If no DNS servers are provided, the system default servers (if any) are used. export fn query(query: *message, addr: ip::addr...) (*message | error) = { if (len(addr) == 0) { addr = resolvconf::load(); @@ -31,7 +32,7 @@ export fn query(query: *message, addr: ip::addr...) (*message | error) = { let header = header { ... }; let dec = decoder_init(recvbuf[..z]); decode_header(&dec, &header)?; - if (header.id != query.header.id) { + if (header.id != query.header.id || header.op.qr != qr::RESPONSE) { continue; }; diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib @@ -556,7 +556,8 @@ net_dns() { encoding.ha \ query.ha \ types.ha - gen_ssa net::dns ascii endian net net::udp net::ip fmt unix::resolvconf + gen_ssa net::dns ascii endian net net::udp net::ip fmt \ + unix::resolvconf } gensrcs_net_ip() {