diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2019-11-03 00:02:41 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2019-11-04 03:03:44 +0900 |
commit | ae70143d7940e67b479954a12516b54e99296fac (patch) | |
tree | 6cfc6237445eb9d85127495cfaed4fedac89a71c /src | |
parent | 82a3cf69c90dc22533d1c1f24ad02fc417a38913 (diff) |
Always expire servers when receiving a zero-lifetime RDNSS option
When receiving a zero-lifetime RDNSS option for DNS servers that
is already configured, the code first sets the lifetime of the
servers to zero, and then runs code that prunes expired servers.
Because expired servers are pruned only if "expiry < now", if the
pruning happens in the same millisecond as the update, the
servers aren't actually pruned. This can happen multiple times,
so if the code runs fast enough, the server will never expire.
Fix this by using <= instead of <.
Fix: 143806550
Test: makes the new IpClientIntegrationTest#testRaRdnss not flaky
Change-Id: Icf6893efdc028859b178eb234f6f1a42b24e2936
Diffstat (limited to 'src')
-rw-r--r-- | src/android/net/ip/IpClientLinkObserver.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/android/net/ip/IpClientLinkObserver.java b/src/android/net/ip/IpClientLinkObserver.java index 8ad99aa..3f399e9 100644 --- a/src/android/net/ip/IpClientLinkObserver.java +++ b/src/android/net/ip/IpClientLinkObserver.java @@ -326,7 +326,7 @@ public class IpClientLinkObserver implements NetworkObserver { // Prune excess or expired entries. for (int i = mAllServers.size() - 1; i >= 0; i--) { - if (i >= NUM_SERVERS || mAllServers.get(i).expiry < now) { + if (i >= NUM_SERVERS || mAllServers.get(i).expiry <= now) { DnsServerEntry removed = mAllServers.remove(i); mIndex.remove(removed.address); changed |= mCurrentServers.remove(removed.address); |