dns_cache: address record should only flush on the same network #261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When debugging an issue in Discussions #260 , I installed
docker
on macOS, and the test caseintegration_success
fails intermittently.With some digging, it seems that: there are IPv6 interfaces that have more than 1 IPv6 address configured. I.e. same interface name same interface index, but different IPv6 address. Because IPv6 sockets joins multicast using their index, not the address, there are two sockets receive packets for both addresses. Depends on the timing, one of the addresses could be flushed by another one and cause the resolved service has less addresses than expected.
The following log shows this happened with two cases, and resolved 16 addr(s) instead of expected 18 addr(s):
This patch adds a check for cache flush: for address records, we only flush if the incoming address and the existing address are on the same network of the interface.
Also, changed a error log into a debug log per the discussions comment.