Skip to content

Commit

Permalink
Fix MRP SessionIdleInterval per spec to 500ms (project-chip#32124)
Browse files Browse the repository at this point in the history
* Fix MRP SessionIdleInterval per spec to 500ms

Spec has the default SESSION_IDLE_INTERVAL defined as 500ms
https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/1.2/src/secure_channel/Message_Reliability_MRP.adoc#8-parameters-and-constants

Originally defined as 300ms, this change was introduced as part of spec PR
CHIP-Specifications/connectedhomeip-spec#7186

* Update Sleepy -> Session in context of active/idle intervals

Reflecting the spec update
CHIP-Specifications/connectedhomeip-spec#7186
  • Loading branch information
samadDotDev authored and raul-marquez-csa committed Feb 16, 2024
1 parent 8fbb0d6 commit 9d96812
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/app/tests/suites/TestDiscovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ tests:
- name: "productId"
value: productId

- label: "Optional TXT key for MRP Sleepy Idle Interval (SII)"
- label: "Optional TXT key for MRP Session Idle Interval (SII)"
PICS: MCORE.SC.SII_COMM_DISCOVERY_KEY
cluster: "DiscoveryCommands"
command: "FindCommissionable"
Expand All @@ -214,7 +214,7 @@ tests:
minValue: 0
maxValue: 3600000

- label: "Optional TXT key for MRP Sleepy Active Interval (SAI)"
- label: "Optional TXT key for MRP Session Active Interval (SAI)"
PICS: MCORE.SC.SAI_COMM_DISCOVERY_KEY
cluster: "DiscoveryCommands"
command: "FindCommissionable"
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/suites/certification/Test_TC_SC_3_3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ tests:
responderSessionID is of uint16
sigma2ResumeMIC is of Octet String maximum of length 16 bytes
responderSEDParams is from any one of the following:
SLEEPY_IDLE_INTERVAL - Verify that it is of uint32
SLEEPY_ACTIVE_INTERVAL - Verify that it is of uint32
SESSION_IDLE_INTERVAL - Verify that it is of uint32
SESSION_ACTIVE_INTERVAL - Verify that it is of uint32
[1683973658.044236][21637:21637] CHIP:EM: Rxd Ack; Removing MessageCounter:113416101 from Retrans Table on exchange 32995r
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/suites/certification/Test_TC_SC_4_10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tests:
verification: |
avahi-browse -rt _matter._tcp
On the TH(Chip-tool) Log: Verify the DUT is advertising for:
-SII key is higher than the SLEEPY_IDLE_INTERVAL default value (> 300 milliseconds)
- SII key is higher than the SESSION_IDLE_INTERVAL default value (> 500 milliseconds)
- SII key and SAI key is less than 3600000 (1hour in milliseconds)
+ eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dnssd/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct CommonResolutionData

bool IsDeviceTreatedAsSleepy(const ReliableMessageProtocolConfig * defaultMRPConfig) const
{
// If either sleepy interval (Idle - SII, Active - SAI) has a value and that value is greater
// If either session interval (Idle - SII, Active - SAI) has a value and that value is greater
// than the value passed to this function, then the peer device will be treated as if it is
// a Sleepy End Device (SED)
return (mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) ||
Expand Down
6 changes: 3 additions & 3 deletions src/lib/dnssd/tests/TestIncrementalResolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void TestParseOperational(nlTestSuite * inSuite, void * inContext)
{
const char * entries[] = {
"foo=bar", // unused data
"SII=23" // sleepy idle interval
"SII=23" // session idle interval
};

CallOnRecord(inSuite, resolver, TxtResourceRecord(kTestOperationalName.Full(), entries));
Expand Down Expand Up @@ -369,7 +369,7 @@ void TestParseCommissionable(nlTestSuite * inSuite, void * inContext)
{
const char * entries[] = {
"some", "foo=bar", "x=y=z", "a=", // unused data
"SII=123" // Sleepy idle interval
"SII=123" // session idle interval
};

CallOnRecord(inSuite, resolver, TxtResourceRecord(kTestHostName.Full(), entries));
Expand All @@ -381,7 +381,7 @@ void TestParseCommissionable(nlTestSuite * inSuite, void * inContext)
{
const char * entries[] = {
"foo=bar", // unused data
"SAI=321", // sleepy active interval
"SAI=321", // session active interval
"D=22345", // Long discriminator
"VP=321+654", // VendorProduct
"DN=mytest" // Device name
Expand Down
4 changes: 2 additions & 2 deletions src/messaging/ReliableMessageProtocolConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ void ClearLocalMRPConfigOverride()

ReliableMessageProtocolConfig GetDefaultMRPConfig()
{
// Default MRP intervals are defined in spec <2.11.3. Parameters and Constants>
static constexpr const System::Clock::Milliseconds32 idleRetransTimeout = 300_ms32;
// Default MRP intervals are defined in spec <4.12.8. Parameters and Constants>
static constexpr const System::Clock::Milliseconds32 idleRetransTimeout = 500_ms32;
static constexpr const System::Clock::Milliseconds32 activeRetransTimeout = 300_ms32;
static constexpr const System::Clock::Milliseconds16 activeThresholdTime = 4000_ms16;
return ReliableMessageProtocolConfig(idleRetransTimeout, activeRetransTimeout, activeThresholdTime);
Expand Down
4 changes: 2 additions & 2 deletions src/messaging/ReliableMessageProtocolConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace chip {
* timeout when it sends a message to the present node and the present node is
* perceived by the peer as active.
*
* This value is announced to the peer using SAI (Sleepy Active Interval) key
* This value is announced to the peer using SAI (Session Active Interval) key
* in the advertised DNS Service Discovery TXT records. Additionally, it is
* exchanged in the initial phase of the PASE/CASE session establishment.
*
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace chip {
#if CHIP_ENABLE_OPENTHREAD && !CHIP_DEVICE_LAYER_TARGET_LINUX
#define CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL (800_ms32)
#else
#define CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL (300_ms32)
#define CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL (500_ms32)
#endif
#endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL && !CHIP_DEVICE_LAYER_TARGET_LINUX

Expand Down
2 changes: 1 addition & 1 deletion src/messaging/tests/MessagingContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MessagingContext : public PlatformMemoryUser
enum MRPMode
{
kDefault = 1, // This adopts the default MRP values for idle/active as per the spec.
// i.e IDLE = 4s, ACTIVE = 300ms
// i.e IDLE = 500ms, ACTIVE = 300ms

kResponsive = 2, // This adopts values that are better suited for loopback tests that
// don't actually go over a network interface, and are tuned much lower
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/secure_channel/RendezvousParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace chip {
// The largest supported value for Rendezvous discriminators
const uint16_t kMaxRendezvousDiscriminatorValue = 0xFFF;

// The largest supported value for sleepy idle interval and sleepy active interval
inline constexpr uint32_t kMaxSleepyInterval = 3600000;
// The largest supported value for session idle interval and session active interval
inline constexpr uint32_t kMaxSessionIdleInterval = 3600000;

class RendezvousParameters
{
Expand Down

0 comments on commit 9d96812

Please sign in to comment.