[Thread] allow disabling SRP server wait for border routing
It's default enabled that it waits for border routing establishment before starting the SRP server. But there are also use cases where the user may want to know what are the devices in the Thread network before actually reach to the devices, or it doesn't depend on border routing to reach to a Thread device. Given that, this commit adds the support of starting SRP server without waiting for border routing by adding a new Runtime Resource Overlay configuration parameter: config_thread_srp_server_wait_for_border_routing_enabled Test: it's difficult to assert on the SRP server starts up timing. But manually verified that the SRP server starts without waiting for the routing manager when the RRO config is flipped: ``` 01-09 20:18:35.835 7555 7555 I ot-daemon: [I] RoutingManager: RsSender: Sent RS 1/3 01-09 20:18:35.835 7555 7555 I ot-daemon: [I] RoutingManager: Received RS from fe80:0:0:0:98af:44ff:fe2e:fa80 on infra netif 17 01-09 20:18:35.835 7555 7555 I ot-daemon: [I] RoutingManager: Will evaluate routing policy in 00:00.150 (150 msec) 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] NetDataPublshr: DNS/SRP service - State: Adding -> Added 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] SrpServer-----: Start listening on port 53536 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] NetworkData---: Sent ServerData 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] NetworkData---: Received ServerData 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] NetworkData---: Allocated Service ID = 1 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] NetworkData---: Sent ServerData ack 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] Notifier------: StateChanged (0x00000200) [NetData] 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] Mle-----------: Send Data Response (ff02:0:0:0:0:0:0:1) 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] BbrLeader-----: PBBR state: Unchanged 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] BbrLeader-----: Rloc16:0x8800, seqno:69, delay:5, timeout:3600 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] RoutingManager: Will evaluate routing policy in 00:03.558 (3558 msec) 01-09 20:18:35.926 7555 7555 I ot-daemon: [I] NetDataPublshr: DNS/SRP service (state:Added) in netdata - total:1, preferred:0, desired:2 ``` Bug: 378587036 Change-Id: Ib768014f3c44dca89390cec823a1c2acac38ab0d
This commit is contained in:
parent
bd579b4658
commit
fad62be2d2
2 changed files with 20 additions and 2 deletions
|
|
@ -623,12 +623,14 @@ final class ThreadNetworkControllerService extends IThreadNetworkController.Stub
|
|||
mNat64CidrController.maybeUpdateNat64Cidr();
|
||||
}
|
||||
|
||||
private static OtDaemonConfiguration newOtDaemonConfig(
|
||||
@NonNull ThreadConfiguration threadConfig) {
|
||||
private OtDaemonConfiguration newOtDaemonConfig(ThreadConfiguration threadConfig) {
|
||||
int srpServerConfig = R.bool.config_thread_srp_server_wait_for_border_routing_enabled;
|
||||
boolean srpServerWaitEnabled = mResources.get().getBoolean(srpServerConfig);
|
||||
return new OtDaemonConfiguration.Builder()
|
||||
.setBorderRouterEnabled(threadConfig.isBorderRouterEnabled())
|
||||
.setNat64Enabled(threadConfig.isNat64Enabled())
|
||||
.setDhcpv6PdEnabled(threadConfig.isDhcpv6PdEnabled())
|
||||
.setSrpServerWaitForBorderRoutingEnabled(srpServerWaitEnabled)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,6 +231,9 @@ public final class ThreadNetworkControllerServiceTest {
|
|||
|
||||
when(mConnectivityResources.get()).thenReturn(mResources);
|
||||
when(mResources.getBoolean(eq(R.bool.config_thread_default_enabled))).thenReturn(true);
|
||||
when(mResources.getBoolean(
|
||||
eq(R.bool.config_thread_srp_server_wait_for_border_routing_enabled)))
|
||||
.thenReturn(true);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_name)))
|
||||
.thenReturn(TEST_VENDOR_NAME);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_oui)))
|
||||
|
|
@ -285,6 +288,9 @@ public final class ThreadNetworkControllerServiceTest {
|
|||
|
||||
@Test
|
||||
public void initialize_resourceOverlayValuesAreSetToOtDaemon() throws Exception {
|
||||
when(mResources.getBoolean(
|
||||
eq(R.bool.config_thread_srp_server_wait_for_border_routing_enabled)))
|
||||
.thenReturn(false);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_name)))
|
||||
.thenReturn(TEST_VENDOR_NAME);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_oui)))
|
||||
|
|
@ -297,6 +303,7 @@ public final class ThreadNetworkControllerServiceTest {
|
|||
mService.initialize();
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
assertThat(mFakeOtDaemon.getConfiguration().srpServerWaitForBorderRoutingEnabled).isFalse();
|
||||
MeshcopTxtAttributes meshcopTxts = mFakeOtDaemon.getOverriddenMeshcopTxtAttributes();
|
||||
assertThat(meshcopTxts.vendorName).isEqualTo(TEST_VENDOR_NAME);
|
||||
assertThat(meshcopTxts.vendorOui).isEqualTo(TEST_VENDOR_OUI_BYTES);
|
||||
|
|
|
|||
Loading…
Reference in a new issue