[nat64] fetch NAT64 prefix from infrastructure interface and advertise it to netdata (#7619)

This commit fetches the NAT64 prefix on infrastructure interface and
advertise it to Network Data at medium preference.

- Use `getaddrinfo_a()` function to asynchronously lookup the ipv6
  address of the special domain `ipv4only.arpa`. The infrastructure
  NAT64 prefix is extracted from the domain answer.

- `mInfraIfNat64PrefixStaleTimer` is scheduled to monitor the presence
  and change of infrastructure NAT64 prefix.

- `EvaluateNat64Prefix` evaluates whether to advertise the
  infrastructure prefix or the local ULA prefix or neither. When there
  is a new infrastructure prefix, it will withdraw the legacy one and
  add the new one. When the infrastructure prefix no longer exists, it
  will withdraw the legacy one and add the local ULA prefix. When the
  infrastructure prefix presents again, it will add the infrastructure
  prefix and withdraw the local ULA prefix.

New tests are added to test the scenarios when infrastructure NAT64
prefix exists.  `DNS64` on OTBR is turned on to enable `bind9` with
NAT64 prefix on infrastructure interface for these tests. `bind9` is
explicitly turned off when testing local ULA prefix.  Since bind9 is
conflict with other components like dnssd, all nat64 tests are moved
under /nat64 directory and configured separately.

The case that two or more BRs have same infrastructure NAT64 prefix is
not covered by this commit and will be followed up later.
This commit is contained in:
Yi
2022-08-12 07:37:05 -07:00
committed by GitHub
parent 034fc826f3
commit 80565c58a9
30 changed files with 801 additions and 93 deletions
+5
View File
@@ -492,6 +492,11 @@ OT_TOOL_WEAK otError otPlatInfraIfSendIcmp6Nd(uint32_t, const otIp6Address *, co
{
return OT_ERROR_FAILED;
}
OT_TOOL_WEAK otError otPlatInfraIfDiscoverNat64Prefix(uint32_t)
{
return OT_ERROR_FAILED;
}
#endif
#if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE