smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.79k stars 427 forks source link

Is `smoltcp::socket::dns` only a DNS client or also a DNS server? #785

Open vi opened 1 year ago

vi commented 1 year ago

smoltcp::socket::dns has no module-level documentation.

smoltcp::socket::dns::Socket's documentation ("A Domain Name System socket. A UDP socket is bound to a specific endpoint, and owns transmit and receive packet buffers.") also does not make clear which features are supported and which are not.

Dirbaio commented 1 year ago

Can it do recursive DNS lookup?

No.

Can it used for implementing a DNS server, not for using DNS server?

No, client only.

Can it decode captured DNS query and/or answer (not the one created by smoltcp::socket::dns)?

Not sure what you mean. It parses the answer, you can obtain the IP address list from it with this function https://docs.rs/smoltcp/latest/smoltcp/socket/dns/struct.Socket.html#method.get_query_result

vi commented 1 year ago

Thanks for the answer. This should be in the docs.

I expected there to be something like dns_parser::Packet::parse. Smoltcp's analogue seems to be smoltcp::wire::DnsPacket, though it exposes only basic things. Existence of DNS-related code on wire level can also acknowledged in smoltcp::socket::dns docs, as this module is the first search result when looking up "dns".