[dns-client] add support address resolution query for IPv4 directly (#7441)

This commit adds a new mechanism in `Dns::Client` along with a new
public OT API `otDnsClientResolveIp4Address()` and its related CLI
sub-command to allow a user to request an address resolution DNS
query specifically for A records or IPv4 addresses for a given host
name.

This API requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` to be
enabled. Upon receiving a successful query response the addresses are
reported to user (in callback) as NAT64 IPv6 translated version of
the IPv4 addresses from the received query response.

The new API is added in addition to the existing behavior where address
resolution query from `otDnsClientResolveAddress()` first queries for
IPv6 addresses and only if no IPv6 address is found and NAT64 is
enabled and allowed by the query config, `Dns::Client` implementation
tries to perform an IPv4 query. The new API directly starts with IPv4
query and can be useful in situations where Thread devices are
connected through BRs to a network without global IPv6 connectivity.
This commit is contained in:
Abtin Keshavarzian
2022-03-08 17:18:44 -08:00
committed by GitHub
parent 2612fbc927
commit 05d8e81988
9 changed files with 171 additions and 43 deletions
+10
View File
@@ -40,8 +40,18 @@ expect_line "Done"
wait_for "state" "leader"
expect_line "Done"
send "route add 2001:dead:beef:cafe::/64 s n med\n"
expect_line "Done"
send "netdata register\n"
expect_line "Done"
send "dns resolve ipv6.google.com ::1 53\n"
expect "DNS response for ipv6.google.com"
expect_line "Done"
send "dns resolve4 ipv6.google.com ::1 53\n"
expect "DNS response for ipv6.google.com"
expect_line "Done"
dispose_all