Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dns-client-mirage support udp (#322)
* dns_client: connect provides the protocol and context * dns_client: connect provides the protocol * dns-client-mirage: allow UDP resolvers This adds support for either all udp or all tcp|tls resolvers. At a later stage, we can of course support mixed sets of resolvers (especially with the previous commit paving this path). * dns-stub / dns-client-mirage: add ?size and ?edns in Dns_client_mirage.connect This avoids the need to unmarshal the arguments for a Dns_stub.t instantiation, and makes the surface more uniform. * dns_mirage_client: randomize udp port similar to qubes-mirage-firewall (thanks @palainp), at initialization time a single udp_port is reserved as last resort. In general, the UDP source port is randomized, and UDP.listen/unlisten are executed on that port (which is as well registered / unregistered). If the port allocation fails, the last_udp_port is used, which is always listened to. * dns-client-mirage: in nameserver_of_string, describe the desired format. * Update mirage/client/dns_client_mirage.ml Co-authored-by: Reynir Björnsson <reynir@reynir.dk> * Update mirage/client/dns_client_mirage.ml Co-authored-by: Reynir Björnsson <reynir@reynir.dk> * dns-client: size is now cache_size (suggested by @reynir) * dns-client-mirage: unlisten in all cases (as suggested by @reynir) * dns-client-mirage: read_udp: only do something if the minimum DNS length was received (as reviewed by @reynir) * dns-client-mirage: simplify Set.Make by using OCaml 4.08 introduced Int module * dns-client-mirage: fix code for read_udp previously, the source port of the remote (usually 53) was checked against our source port (some random ephemeral), leading to no accepted reply. the mirage udp interface does not provide the destination port in the callback (report as mirage/mirage-tcpip#497). * dns-client-mirage: remove "last_udp_port" complexity, instead fail on no free port * Check dst in read_udp Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
- Loading branch information