Skip to content

Commit 10d1409

Browse files
DNS-SD: Remove calls to set T flag (project-chip#32083)
* DNS-SD: Remove calls to set T flag Nothing currently supports TCP, therefore nothing should be setting this flag. Per the new spec text, it is now forbidden to have the lowest bit marked. This will bring the SDK examples into compliance with 1.3. Note that this PR does not fix the advertising parameters API. We will need a new API for this flag when TCP support lands. Leaving this for a follow up PR as changing the API should happen separately from bringing the examples into conformance as it may affect the platforms, who have implementations outside of the SDK. Test: tested with all-clusters and avahi. Also fixed tests to omit this flag and ensure it does not appear in the TXT record. Automated cert test for operational records is in progress and requires this PR to pass. * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 63c614d commit 10d1409

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/app/server/Dnssd.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ CHIP_ERROR DnssdServer::AdvertiseOperational()
181181
.SetPort(GetSecuredPort())
182182
.SetInterfaceId(GetInterfaceId())
183183
.SetLocalMRPConfig(GetLocalMRPConfig())
184-
.SetTcpSupported(Optional<bool>(INET_CONFIG_ENABLE_TCP_ENDPOINT))
185184
.EnableIpV4(true);
186185

187186
#if CHIP_CONFIG_ENABLE_ICD_SERVER
@@ -255,7 +254,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi
255254
advertiseParameters.SetDeviceName(chip::Optional<const char *>::Value(deviceName));
256255
}
257256

258-
advertiseParameters.SetLocalMRPConfig(GetLocalMRPConfig()).SetTcpSupported(Optional<bool>(INET_CONFIG_ENABLE_TCP_ENDPOINT));
257+
advertiseParameters.SetLocalMRPConfig(GetLocalMRPConfig());
259258

260259
#if CHIP_CONFIG_ENABLE_ICD_SERVER
261260
AddICDKeyToAdvertisement(advertiseParameters);

src/lib/dnssd/Advertiser.h

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class BaseAdvertisingParams
9494
return *reinterpret_cast<Derived *>(this);
9595
}
9696
const Optional<ReliableMessageProtocolConfig> & GetLocalMRPConfig() const { return mLocalMRPConfig; }
97+
98+
// NOTE: The SetTcpSupported API is deprecated and not compliant with 1.3. T flag should not be set.
9799
Derived & SetTcpSupported(Optional<bool> tcpSupported)
98100
{
99101
mTcpSupported = tcpSupported;

src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ OperationalAdvertisingParameters operationalParams1 =
8080
.SetMac(ByteSpan(kMac))
8181
.SetPort(CHIP_PORT)
8282
.EnableIpV4(true)
83-
.SetTcpSupported(chip::Optional<bool>(false))
8483
.SetLocalMRPConfig(chip::Optional<ReliableMessageProtocolConfig>::Value(
8584
32_ms32, 30_ms32)); // Match SII, SAI. SAT not provided so it uses default 4000ms
8685
OperationalAdvertisingParameters operationalParams2 =
@@ -93,7 +92,7 @@ OperationalAdvertisingParameters operationalParams5 =
9392
OperationalAdvertisingParameters().SetPeerId(kPeerId5).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true);
9493
OperationalAdvertisingParameters operationalParams6 =
9594
OperationalAdvertisingParameters().SetPeerId(kPeerId6).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true);
96-
const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "SAT=4000", "T=0" };
95+
const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "SAT=4000" };
9796
PtrResourceRecord ptrOperationalService = PtrResourceRecord(kDnsSdQueryName, kMatterOperationalQueryName);
9897
PtrResourceRecord ptrOperational1 = PtrResourceRecord(kMatterOperationalQueryName, kInstanceName1);
9998
SrvResourceRecord srvOperational1 = SrvResourceRecord(kInstanceName1, kHostnameName, CHIP_PORT);
@@ -181,14 +180,12 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced =
181180
.SetPairingInstruction(chip::Optional<const char *>("Pair me"))
182181
.SetProductId(chip::Optional<uint16_t>(897))
183182
.SetRotatingDeviceId(chip::Optional<const char *>("id_that_spins"))
184-
.SetTcpSupported(chip::Optional<bool>(true))
185183
.SetICDOperatingAsLIT(chip::Optional<bool>(false))
186184
// 3600005 is more than the max so should be adjusted down
187185
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(3600000_ms32, 3600005_ms32, 65535_ms16));
188186
QNamePart txtCommissionableNodeParamsLargeEnhancedParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000",
189187
"DN=testy-test", "RI=id_that_spins", "PI=Pair me", "PH=3",
190-
"SAI=3600000", "SII=3600000", "SAT=65535", "T=1",
191-
"ICD=0" };
188+
"SAI=3600000", "SII=3600000", "SAT=65535", "ICD=0" };
192189
FullQName txtCommissionableNodeParamsLargeEnhancedName = FullQName(txtCommissionableNodeParamsLargeEnhancedParts);
193190
TxtResourceRecord txtCommissionableNodeParamsLargeEnhanced =
194191
TxtResourceRecord(instanceName, txtCommissionableNodeParamsLargeEnhancedName);
@@ -207,13 +204,12 @@ CommissionAdvertisingParameters commissionableNodeParamsEnhancedAsICDLIT =
207204
.SetPairingHint(chip::Optional<uint16_t>(3))
208205
.SetPairingInstruction(chip::Optional<const char *>("Pair me"))
209206
.SetProductId(chip::Optional<uint16_t>(897))
210-
.SetTcpSupported(chip::Optional<bool>(true))
211207
.SetICDOperatingAsLIT(chip::Optional<bool>(true))
212208
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(3600000_ms32, 3600000_ms32, 65535_ms16));
213209
// With ICD Operation as LIT, SII key will not be added to the advertisement
214210
QNamePart txtCommissionableNodeParamsEnhancedAsICDLITParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000",
215211
"DN=testy-test", "PI=Pair me", "PH=3", "SAI=3600000",
216-
"SAT=65535", "T=1", "ICD=1" };
212+
"SAT=65535", "ICD=1" };
217213
FullQName txtCommissionableNodeParamsEnhancedAsICDLITName = FullQName(txtCommissionableNodeParamsEnhancedAsICDLITParts);
218214
TxtResourceRecord txtCommissionableNodeParamsEnhancedAsICDLIT =
219215
TxtResourceRecord(instanceName, txtCommissionableNodeParamsEnhancedAsICDLITName);

src/lib/dnssd/platform/tests/TestPlatform.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ OperationalAdvertisingParameters operationalParams2 =
5353
.SetPort(CHIP_PORT)
5454
.EnableIpV4(true)
5555
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(32_ms32, 30_ms32, 10_ms16)) // SII and SAI to match below
56-
.SetTcpSupported(Optional<bool>(true))
5756
.SetICDOperatingAsLIT(Optional<bool>(false));
5857
test::ExpectedCall operationalCall2 = test::ExpectedCall()
5958
.SetProtocol(DnssdServiceProtocol::kDnssdProtocolTcp)
@@ -64,7 +63,6 @@ test::ExpectedCall operationalCall2 = test::ExpectedCall()
6463
.AddTxt("SII", "32")
6564
.AddTxt("SAI", "30")
6665
.AddTxt("SAT", "10")
67-
.AddTxt("T", "1")
6866
.AddTxt("ICD", "0");
6967

7068
CommissionAdvertisingParameters commissionableNodeParamsSmall =
@@ -97,7 +95,6 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeBasic =
9795
.SetPairingInstruction(Optional<const char *>("Pair me"))
9896
.SetProductId(Optional<uint16_t>(897))
9997
.SetRotatingDeviceId(Optional<const char *>("id_that_spins"))
100-
.SetTcpSupported(Optional<bool>(true))
10198
.SetICDOperatingAsLIT(Optional<bool>(false))
10299
// 3600005 is over the max, so this should be adjusted by the platform
103100
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(3600000_ms32, 3600005_ms32, 65535_ms16));
@@ -114,7 +111,6 @@ test::ExpectedCall commissionableLargeBasic = test::ExpectedCall()
114111
.AddTxt("RI", "id_that_spins")
115112
.AddTxt("PI", "Pair me")
116113
.AddTxt("PH", "3")
117-
.AddTxt("T", "1")
118114
.AddTxt("ICD", "0")
119115
.AddTxt("SII", "3600000")
120116
.AddTxt("SAI", "3600000")

0 commit comments

Comments
 (0)