Cleanup IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION flag.
This feature has been enabled by default and roll out via M-2024-11
mainline train, cleanup the experiment flag in the production code.
Bug: 382194967
Test: atest NetworkStackIntegrationTests
Test: atest NetworkStackRootTests
Test: atest NetworkStackTests
Change-Id: I4710283b3ccf22486b69a48e1253c06a2d593280
diff --git a/src/android/net/ip/IpReachabilityMonitor.java b/src/android/net/ip/IpReachabilityMonitor.java
index 9cdbc5d..9be274a 100644
--- a/src/android/net/ip/IpReachabilityMonitor.java
+++ b/src/android/net/ip/IpReachabilityMonitor.java
@@ -23,7 +23,6 @@
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_INCOMPLETE_IPV6_DEFAULT_ROUTER_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_INCOMPLETE_IPV6_DNS_SERVER_VERSION;
-import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_ORGANIC_NUD_FAILURE_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_MCAST_RESOLICIT_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_ROUTER_MAC_CHANGE_FAILURE_ONLY_AFTER_ROAM_VERSION;
@@ -247,7 +246,6 @@
private final boolean mIgnoreIncompleteIpv6DefaultRouterEnabled;
private final boolean mMacChangeFailureOnlyAfterRoam;
private final boolean mIgnoreOrganicNudFailure;
- private final boolean mIgnoreNeverReachableNeighbor;
// A set to track whether a neighbor has ever entered NUD_REACHABLE state before.
private final Set<InetAddress> mEverReachableNeighbors = new ArraySet<>();
@@ -281,8 +279,6 @@
IP_REACHABILITY_ROUTER_MAC_CHANGE_FAILURE_ONLY_AFTER_ROAM_VERSION);
mIgnoreOrganicNudFailure = dependencies.isFeatureEnabled(context,
IP_REACHABILITY_IGNORE_ORGANIC_NUD_FAILURE_VERSION);
- mIgnoreNeverReachableNeighbor = dependencies.isFeatureNotChickenedOut(context,
- IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION);
mMetricsLog = metricsLog;
mNetd = netd;
Preconditions.checkNotNull(mNetd);
@@ -477,13 +473,8 @@
@NonNull final NeighborEvent event) {
// mIgnoreNeverReachableNeighbor already takes care of incomplete IPv6 neighbors, so do not
// apply this logic.
- if (mIgnoreNeverReachableNeighbor) return false;
-
- // For on-link IPv4/v6 DNS server or default router that never ever responds to
- // address resolution(e.g. ARP or NS), kernel will send RTM_NEWNEIGH with NUD_FAILED
- // to user space directly, and there is no netlink neighbor events related to this
- // neighbor received before.
- return (prev == null && event.nudState == StructNdMsg.NUD_FAILED);
+ // TODO: clean up the flags related to the incomplete IPv6 neighbors.
+ return false;
}
private void handleNeighborLost(@Nullable final NeighborEvent prev,
@@ -508,7 +499,7 @@
// Pretend neighbors that have never been reachable are still there. Leaving them
// inside whatIfLp has the benefit that the logic that compares provisioning loss
// below works consistently independent of the current event being processed.
- if (mIgnoreNeverReachableNeighbor && !mEverReachableNeighbors.contains(ip)) continue;
+ if (!mEverReachableNeighbors.contains(ip)) continue;
for (RouteInfo route : mLinkProperties.getRoutes()) {
if (ip.equals(route.getGateway())) {
@@ -593,7 +584,7 @@
// Skip the neighbor which is never ever reachable, we ignore the NUD failure for it,
// pretend neighbor that has never been reachable is still there no matter of neighbor
// event state.
- if (mIgnoreNeverReachableNeighbor && !mEverReachableNeighbors.contains(ip)) continue;
+ if (!mEverReachableNeighbors.contains(ip)) continue;
// If an entry is null, consider that probing for that neighbour has completed.
if (val == null || val.nudState != StructNdMsg.NUD_REACHABLE) return;
diff --git a/src/com/android/networkstack/util/NetworkStackUtils.java b/src/com/android/networkstack/util/NetworkStackUtils.java
index 93abeb3..3bbf201 100755
--- a/src/com/android/networkstack/util/NetworkStackUtils.java
+++ b/src/com/android/networkstack/util/NetworkStackUtils.java
@@ -234,13 +234,6 @@
"ip_reachability_ignore_organic_nud_failure_version";
/**
- * Experiment flag to ignore all NUD failures from the neighbor that has never ever entered the
- * reachable state.
- */
- public static final String IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION =
- "ip_reachability_ignore_never_reachable_neighbor_version";
-
- /**
* Experiment flag to enable DHCPv6 Prefix Delegation(RFC8415) in IpClient.
*/
public static final String IPCLIENT_DHCPV6_PREFIX_DELEGATION_VERSION =
diff --git a/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java b/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java
index e752a6b..7899e8a 100644
--- a/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java
+++ b/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java
@@ -88,7 +88,6 @@
import static com.android.networkstack.util.NetworkStackUtils.IPCLIENT_POPULATE_LINK_ADDRESS_LIFETIME_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_INCOMPLETE_IPV6_DEFAULT_ROUTER_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_INCOMPLETE_IPV6_DNS_SERVER_VERSION;
-import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_NUD_FAILURE_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_ORGANIC_NUD_FAILURE_VERSION;
import static com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_ROUTER_MAC_CHANGE_FAILURE_ONLY_AFTER_ROAM_VERSION;
@@ -4835,7 +4834,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
public void testIpReachabilityMonitor_ignoreNeverReachableIpv6Dns() throws Exception {
runIpReachabilityMonitorAddressResolutionTest(IPV6_ON_LINK_DNS_SERVER,
ipv6Addr(IPV6_ON_LINK_DNS_SERVER),
@@ -4844,7 +4842,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
public void testIpReachabilityMonitor_ignoreNeverReachableIpv6Dns_butEverReachable()
throws Exception {
runIpReachabilityMonitorEverReachableIpv6NeighborTest(IPV6_ON_LINK_DNS_SERVER,
@@ -4852,7 +4849,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
public void testIpReachabilityMonitor_ignoreNeverReachableIpv6DefaultRouter() throws Exception {
runIpReachabilityMonitorAddressResolutionTest(IPV6_OFF_LINK_DNS_SERVER,
ROUTER_LINK_LOCAL,
@@ -4861,7 +4857,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
public void testIpReachabilityMonitor_ignoreNeverReachableIpv6DefaultRouter_butEverReachable()
throws Exception {
runIpReachabilityMonitorEverReachableIpv6NeighborTest(IPV6_ON_LINK_DNS_SERVER,
diff --git a/tests/unit/src/android/net/ip/IpReachabilityMonitorTest.kt b/tests/unit/src/android/net/ip/IpReachabilityMonitorTest.kt
index 518cec7..343848b 100644
--- a/tests/unit/src/android/net/ip/IpReachabilityMonitorTest.kt
+++ b/tests/unit/src/android/net/ip/IpReachabilityMonitorTest.kt
@@ -59,7 +59,6 @@
import com.android.net.module.util.netlink.StructNdMsg.NUD_REACHABLE
import com.android.net.module.util.netlink.StructNdMsg.NUD_STALE
import com.android.networkstack.metrics.IpReachabilityMonitorMetrics
-import com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION
import com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_IGNORE_ORGANIC_NUD_FAILURE_VERSION
import com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_MCAST_RESOLICIT_VERSION
import com.android.networkstack.util.NetworkStackUtils.IP_REACHABILITY_ROUTER_MAC_CHANGE_FAILURE_ONLY_AFTER_ROAM_VERSION
@@ -334,6 +333,10 @@
fun testLoseProvisioning_FirstProbeIsFailed() {
reachabilityMonitor.updateLinkProperties(TEST_LINK_PROPERTIES)
+ // Make the IPv4 DNS as reachable first.
+ neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_DNS, NUD_REACHABLE))
+ handlerThread.waitForIdle(TEST_TIMEOUT_MS)
+
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_DNS, NUD_FAILED))
verify(callback, timeout(TEST_TIMEOUT_MS)).notifyLost(
anyString(),
@@ -341,6 +344,10 @@
)
}
+ // Given the flag which ignores the NUD failure from the neighbor that is never reachable
+ // before has been enabled by default, we have to make the neighbor as reachable first and
+ // simulate a NUD failure by making a new NUD_FAILED neighbor message. So change the param
+ // "everReachable" to true always.
private fun runLoseProvisioningTest(
newLp: LinkProperties,
lostNeighbor: InetAddress,
@@ -350,7 +357,7 @@
newLp,
lostNeighbor,
eventType,
- false, /* everReachable */
+ true, /* everReachable */
true /* expectedNotifyLost */
)
}
@@ -368,11 +375,21 @@
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV6_GATEWAY, NUD_STALE))
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_DNS, NUD_STALE))
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV6_DNS, NUD_STALE))
+ neighborMonitor.enqueuePacket(
+ makeNewNeighMessage(TEST_IPV6_LINKLOCAL_SCOPED_GATEWAY, NUD_STALE)
+ )
+ neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_GATEWAY_DNS, NUD_STALE))
+
+ // Make all neighbors used in the test as reachable.
if (everReachable) {
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_DNS, NUD_REACHABLE))
- neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_GATEWAY, NUD_REACHABLE))
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV6_DNS, NUD_REACHABLE))
neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV6_GATEWAY, NUD_REACHABLE))
+ neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_GATEWAY, NUD_REACHABLE))
+ neighborMonitor.enqueuePacket(
+ makeNewNeighMessage(TEST_IPV6_LINKLOCAL_SCOPED_GATEWAY, NUD_REACHABLE)
+ )
+ neighborMonitor.enqueuePacket(makeNewNeighMessage(TEST_IPV4_GATEWAY_DNS, NUD_REACHABLE))
}
neighborMonitor.enqueuePacket(makeNewNeighMessage(lostNeighbor, NUD_PROBE))
@@ -517,7 +534,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_ignoreNeverReachableIpv6GatewayLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -529,7 +545,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_ignoreNeverReachableIpv6DnsLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -541,7 +556,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_notIgnoreEverReachableIpv6GatewayLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -553,7 +567,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_notIgnoreEverReachableIpv6DnsLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -565,7 +578,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_ignoreNeverReachableIpv4DnsLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -577,7 +589,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_notIgnoreEverReachableIpv4GatewayLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -589,7 +600,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_notIgnoreEverReachableIpv4DnsLost() {
runLoseProvisioningTest(
TEST_LINK_PROPERTIES,
@@ -601,7 +611,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_ignoreNeverReachableIpv6GatewayLost_withTwoIPv6DnsServers() {
reachabilityMonitor.updateLinkProperties(TEST_DUAL_LINK_PROPERTIES)
@@ -639,7 +648,6 @@
}
@Test
- @Flag(name = IP_REACHABILITY_IGNORE_NEVER_REACHABLE_NEIGHBOR_VERSION, enabled = true)
fun testLoseProvisioning_ignoreNeverReachableIpv6DnsLost_withTwoIPv6Routes() {
val TEST_DUAL_IPV6_ROUTERS_LINK_PROPERTIES = LinkProperties().apply {
interfaceName = TEST_IFACE.name
@@ -861,7 +869,7 @@
TEST_IPV6_LINKLOCAL_SCOPED_GATEWAY,
NUD_CONFIRM_FAILED_CRITICAL,
IPV6,
- NUD_NEIGHBOR_GATEWAY
+ NUD_NEIGHBOR_GATEWAY
)
}
@@ -927,7 +935,7 @@
TEST_IPV6_LINKLOCAL_SCOPED_GATEWAY,
NUD_ORGANIC_FAILED_CRITICAL,
IPV6,
- NUD_NEIGHBOR_GATEWAY
+ NUD_NEIGHBOR_GATEWAY
)
}