Skip to content

Commit 28c6c8e

Browse files
committed
Merge remote-tracking branch 'PeterC1965/whm-follow-up-part1' into whm-follow-up-part1
2 parents f5de5aa + fab10c7 commit 28c6c8e

File tree

43 files changed

+278
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+278
-162
lines changed

docs/ERROR_CODES.md

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ This file was **AUTOMATICALLY** generated by
118118
| 165 | 0xA5 | `CHIP_ERROR_ACCESS_DENIED` |
119119
| 166 | 0xA6 | `CHIP_ERROR_UNKNOWN_RESOURCE_ID` |
120120
| 167 | 0xA7 | `CHIP_ERROR_VERSION_MISMATCH` |
121+
| 168 | 0xA8 | `CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL` |
121122
| 171 | 0xAB | `CHIP_ERROR_EVENT_ID_FOUND` |
122123
| 172 | 0xAC | `CHIP_ERROR_INTERNAL` |
123124
| 173 | 0xAD | `CHIP_ERROR_OPEN_FAILED` |
@@ -252,6 +253,7 @@ This file was **AUTOMATICALLY** generated by
252253
| 1426 | 0x592 | `DATA_VERSION_MISMATCH` |
253254
| 1428 | 0x594 | `TIMEOUT` |
254255
| 1436 | 0x59C | `BUSY` |
256+
| 1437 | 0x59D | `ACCESS_RESTRICTED` |
255257
| 1475 | 0x5C3 | `UNSUPPORTED_CLUSTER` |
256258
| 1477 | 0x5C5 | `NO_UPSTREAM_SUBSCRIPTION` |
257259
| 1478 | 0x5C6 | `NEEDS_TIMED_INTERACTION` |

docs/guides/fabric_synchronization_guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fabricsync add-local-bridge 1
107107
Pair the Ecosystem 2 bridge to Ecosystem 1 with node ID 2:
108108

109109
```
110-
fabricsync add-bridge 2 <e2-fabric-bridge-ip>
110+
fabricsync add-bridge 2 <setup-pin-code> <e2-fabric-bridge-ip> <e2-fabric-bridge-port>
111111
```
112112

113113
This command will initiate the reverse commissioning process. After a few

examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ CHIP_ERROR FabricSyncAddBridgeCommand::RunCommand(NodeId remoteId)
104104
pairingCommand->RegisterCommissioningDelegate(this);
105105
mBridgeNodeId = remoteId;
106106

107-
DeviceMgr().PairRemoteFabricBridge(remoteId, reinterpret_cast<const char *>(mRemoteAddr.data()));
107+
DeviceMgr().PairRemoteFabricBridge(remoteId, mSetupPINCode, reinterpret_cast<const char *>(mRemoteAddr.data()), mRemotePort);
108108

109109
return CHIP_NO_ERROR;
110110
}
@@ -207,6 +207,15 @@ CHIP_ERROR FabricSyncAddLocalBridgeCommand::RunCommand(NodeId deviceId)
207207
pairingCommand->RegisterCommissioningDelegate(this);
208208
mLocalBridgeNodeId = deviceId;
209209

210+
if (mSetupPINCode.HasValue())
211+
{
212+
DeviceMgr().SetLocalBridgeSetupPinCode(mSetupPINCode.Value());
213+
}
214+
if (mLocalPort.HasValue())
215+
{
216+
DeviceMgr().SetLocalBridgePort(mLocalPort.Value());
217+
}
218+
210219
DeviceMgr().PairLocalFabricBridge(deviceId);
211220

212221
return CHIP_NO_ERROR;

examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h

+11-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ class FabricSyncAddBridgeCommand : public CHIPCommand, public CommissioningDeleg
3131
public:
3232
FabricSyncAddBridgeCommand(CredentialIssuerCommands * credIssuerCommands) : CHIPCommand("add-bridge", credIssuerCommands)
3333
{
34-
AddArgument("nodeid", 0, UINT64_MAX, &mNodeId);
35-
AddArgument("device-remote-ip", &mRemoteAddr);
34+
AddArgument("node-id", 0, UINT64_MAX, &mNodeId);
35+
AddArgument("setup-pin-code", 0, 0x7FFFFFF, &mSetupPINCode, "Setup PIN code for the remote bridge device.");
36+
AddArgument("device-remote-ip", &mRemoteAddr, "The IP address of the remote bridge device.");
37+
AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort, "The secured device port of the remote bridge device.");
3638
}
3739

3840
void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override;
@@ -45,7 +47,9 @@ class FabricSyncAddBridgeCommand : public CHIPCommand, public CommissioningDeleg
4547
private:
4648
chip::NodeId mNodeId;
4749
chip::NodeId mBridgeNodeId;
50+
uint32_t mSetupPINCode;
4851
chip::ByteSpan mRemoteAddr;
52+
uint16_t mRemotePort;
4953

5054
CHIP_ERROR RunCommand(NodeId remoteId);
5155
};
@@ -73,7 +77,9 @@ class FabricSyncAddLocalBridgeCommand : public CHIPCommand, public Commissioning
7377
FabricSyncAddLocalBridgeCommand(CredentialIssuerCommands * credIssuerCommands) :
7478
CHIPCommand("add-local-bridge", credIssuerCommands)
7579
{
76-
AddArgument("nodeid", 0, UINT64_MAX, &mNodeId);
80+
AddArgument("node-id", 0, UINT64_MAX, &mNodeId);
81+
AddArgument("setup-pin-code", 0, 0x7FFFFFF, &mSetupPINCode, "Setup PIN code for the local bridge device.");
82+
AddArgument("local-port", 0, UINT16_MAX, &mLocalPort, "The secured device port of the local bridge device.");
7783
}
7884

7985
void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) override;
@@ -85,6 +91,8 @@ class FabricSyncAddLocalBridgeCommand : public CHIPCommand, public Commissioning
8591

8692
private:
8793
chip::NodeId mNodeId;
94+
chip::Optional<uint32_t> mSetupPINCode;
95+
chip::Optional<uint16_t> mLocalPort;
8896
chip::NodeId mLocalBridgeNodeId;
8997

9098
CHIP_ERROR RunCommand(chip::NodeId deviceId);

examples/fabric-admin/device_manager/DeviceManager.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ using namespace chip::app::Clusters;
3030

3131
namespace {
3232

33-
// Constants
34-
constexpr uint32_t kSetupPinCode = 20202021;
35-
constexpr uint16_t kRemoteBridgePort = 5540;
36-
constexpr uint16_t kLocalBridgePort = 5540;
3733
constexpr uint16_t kWindowTimeout = 300;
3834
constexpr uint16_t kIteration = 1000;
3935
constexpr uint16_t kSubscribeMinInterval = 0;
@@ -137,7 +133,7 @@ void DeviceManager::OpenRemoteDeviceCommissioningWindow(EndpointId remoteEndpoin
137133
// that is part of a different fabric, accessed through a fabric bridge.
138134
StringBuilder<kMaxCommandSize> commandBuilder;
139135

140-
// Use random discriminator to have less chance of collission.
136+
// Use random discriminator to have less chance of collision.
141137
uint16_t discriminator =
142138
Crypto::GetRandU16() % (kMaxDiscriminatorLength + 1); // Include the upper limit kMaxDiscriminatorLength
143139

@@ -148,12 +144,13 @@ void DeviceManager::OpenRemoteDeviceCommissioningWindow(EndpointId remoteEndpoin
148144
PushCommand(commandBuilder.c_str());
149145
}
150146

151-
void DeviceManager::PairRemoteFabricBridge(NodeId nodeId, const char * deviceRemoteIp)
147+
void DeviceManager::PairRemoteFabricBridge(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp,
148+
uint16_t deviceRemotePort)
152149
{
153150
StringBuilder<kMaxCommandSize> commandBuilder;
154151

155152
commandBuilder.Add("pairing already-discovered ");
156-
commandBuilder.AddFormat("%lu %d %s %d", nodeId, kSetupPinCode, deviceRemoteIp, kRemoteBridgePort);
153+
commandBuilder.AddFormat("%lu %d %s %d", nodeId, setupPINCode, deviceRemoteIp, deviceRemotePort);
157154

158155
PushCommand(commandBuilder.c_str());
159156
}
@@ -173,7 +170,7 @@ void DeviceManager::PairLocalFabricBridge(NodeId nodeId)
173170
StringBuilder<kMaxCommandSize> commandBuilder;
174171

175172
commandBuilder.Add("pairing already-discovered ");
176-
commandBuilder.AddFormat("%lu %d ::1 %d", nodeId, kSetupPinCode, kLocalBridgePort);
173+
commandBuilder.AddFormat("%lu %d ::1 %d", nodeId, mLocalBridgeSetupPinCode, mLocalBridgePort);
177174

178175
PushCommand(commandBuilder.c_str());
179176
}

examples/fabric-admin/device_manager/DeviceManager.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include <set>
2626

27+
constexpr uint32_t kDefaultSetupPinCode = 20202021;
28+
constexpr uint16_t kDefaultLocalBridgePort = 5540;
2729
constexpr uint16_t kResponseTimeoutSeconds = 30;
2830

2931
class Device
@@ -61,6 +63,8 @@ class DeviceManager : public PairingDelegate
6163

6264
void SetRemoteBridgeNodeId(chip::NodeId nodeId) { mRemoteBridgeNodeId = nodeId; }
6365

66+
void SetLocalBridgePort(uint16_t port) { mLocalBridgePort = port; }
67+
void SetLocalBridgeSetupPinCode(uint32_t pinCode) { mLocalBridgeSetupPinCode = pinCode; }
6468
void SetLocalBridgeNodeId(chip::NodeId nodeId) { mLocalBridgeNodeId = nodeId; }
6569

6670
bool IsAutoSyncEnabled() const { return mAutoSyncEnabled; }
@@ -125,9 +129,11 @@ class DeviceManager : public PairingDelegate
125129
126130
* @param nodeId The user-defined ID for the node being commissioned. It doesn’t need to be the same ID,
127131
* as for the first fabric.
132+
* @param setupPINCode The setup PIN code used to authenticate the pairing process.
128133
* @param deviceRemoteIp The IP address of the remote device that is being paired as part of the fabric bridge.
134+
* @param deviceRemotePort The secured device port of the remote device that is being paired as part of the fabric bridge.
129135
*/
130-
void PairRemoteFabricBridge(chip::NodeId nodeId, const char * deviceRemoteIp);
136+
void PairRemoteFabricBridge(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, uint16_t deviceRemotePort);
131137

132138
/**
133139
* @brief Pair a remote Matter device to the current fabric.
@@ -190,6 +196,8 @@ class DeviceManager : public PairingDelegate
190196
// This represents the bridge on the other ecosystem.
191197
chip::NodeId mRemoteBridgeNodeId = chip::kUndefinedNodeId;
192198

199+
uint16_t mLocalBridgePort = kDefaultLocalBridgePort;
200+
uint32_t mLocalBridgeSetupPinCode = kDefaultSetupPinCode;
193201
// The Node ID of the local bridge used for Fabric-Sync
194202
// This represents the bridge within its own ecosystem.
195203
chip::NodeId mLocalBridgeNodeId = chip::kUndefinedNodeId;

examples/fabric-admin/device_manager/DeviceSynchronization.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ void DeviceSynchronizer::OnAttributeData(const ConcreteDataAttributePath & path,
7272
VerifyOrDie(path.mEndpointId == kRootEndpointId);
7373
VerifyOrDie(path.mClusterId == Clusters::BasicInformation::Id);
7474

75+
CHIP_ERROR error = status.ToChipError();
76+
if (CHIP_NO_ERROR != error)
77+
{
78+
ChipLogError(NotSpecified, "Response Failure: %" CHIP_ERROR_FORMAT, error.Format());
79+
return;
80+
}
81+
7582
switch (path.mAttributeId)
7683
{
7784
case Clusters::BasicInformation::Attributes::UniqueID::Id:

integrations/docker/images/base/chip-build/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ RUN set -x \
123123
ruff \
124124
&& : # last line
125125

126+
#TODO Issue #35280: this is only added as a workaround to bloaty build failures, remove it once bloaty fixes issue
127+
# Clone and install abseil-cpp
128+
RUN git clone https://github.com/abseil/abseil-cpp.git /tmp/abseil-cpp \
129+
&& cd /tmp/abseil-cpp \
130+
&& cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
131+
&& cmake --build build --target install \
132+
&& rm -rf /tmp/abseil-cpp
133+
126134
# Install bloat comparison tools
127135
RUN set -x \
128136
&& git clone https://github.com/google/bloaty.git \

integrations/docker/images/chip-cert-bins/Dockerfile

+16-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ RUN case ${TARGETPLATFORM} in \
193193
--target linux-x64-energy-management-ipv6only \
194194
--target linux-x64-microwave-oven-ipv6only \
195195
--target linux-x64-rvc-ipv6only \
196+
--target linux-x64-fabric-bridge-rpc-ipv6only \
197+
--target linux-x64-fabric-admin-rpc-ipv6only \
198+
--target linux-x64-network-manager-ipv6only \
196199
build \
197200
&& mv out/linux-x64-chip-tool-ipv6only-platform-mdns/chip-tool out/chip-tool \
198201
&& mv out/linux-x64-shell-ipv6only-platform-mdns/chip-shell out/chip-shell \
@@ -213,6 +216,9 @@ RUN case ${TARGETPLATFORM} in \
213216
&& mv out/linux-x64-energy-management-ipv6only/chip-energy-management-app out/chip-energy-management-app \
214217
&& mv out/linux-x64-microwave-oven-ipv6only/chip-microwave-oven-app out/chip-microwave-oven-app \
215218
&& mv out/linux-x64-rvc-ipv6only/chip-rvc-app out/chip-rvc-app \
219+
&& mv out/linux-x64-fabric-bridge-rpc-ipv6only/fabric-bridge-app out/fabric-bridge-app \
220+
&& mv out/linux-x64-fabric-admin-rpc-ipv6only/fabric-admin out/fabric-admin \
221+
&& mv out/linux-x64-network-manager-ipv6only/matter-network-manager-app out/matter-network-manager-app \
216222
;; \
217223
"linux/arm64")\
218224
set -x \
@@ -237,6 +243,9 @@ RUN case ${TARGETPLATFORM} in \
237243
--target linux-arm64-energy-management-ipv6only \
238244
--target linux-arm64-microwave-oven-ipv6only \
239245
--target linux-arm64-rvc-ipv6only \
246+
--target linux-arm64-fabric-bridge-rpc-ipv6only \
247+
--target linux-arm64-fabric-admin-rpc-ipv6only \
248+
--target linux-arm64-network-manager-ipv6only \
240249
build \
241250
&& mv out/linux-arm64-chip-tool-ipv6only-platform-mdns/chip-tool out/chip-tool \
242251
&& mv out/linux-arm64-shell-ipv6only-platform-mdns/chip-shell out/chip-shell \
@@ -257,6 +266,9 @@ RUN case ${TARGETPLATFORM} in \
257266
&& mv out/linux-arm64-energy-management-ipv6only/chip-energy-management-app out/chip-energy-management-app \
258267
&& mv out/linux-arm64-microwave-oven-ipv6only/chip-microwave-oven-app out/chip-microwave-oven-app \
259268
&& mv out/linux-arm64-rvc-ipv6only/chip-rvc-app out/chip-rvc-app \
269+
&& mv out/linux-arm64-fabric-bridge-rpc-ipv6only/fabric-bridge-app out/fabric-bridge-app \
270+
&& mv out/linux-arm64-fabric-admin-rpc-ipv6only/fabric-admin out/fabric-admin \
271+
&& mv out/linux-arm64-network-manager-ipv6only/matter-network-manager-app out/matter-network-manager-app \
260272
;; \
261273
*) ;; \
262274
esac
@@ -290,6 +302,9 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/out/lit-icd-app lit-icd-a
290302
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-energy-management-app chip-energy-management-app
291303
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-microwave-oven-app chip-microwave-oven-app
292304
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-rvc-app chip-rvc-app
305+
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/fabric-bridge-app fabric-bridge-app
306+
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/fabric-admin fabric-admin
307+
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/matter-network-manager-app matter-network-manager-app
293308

294309
# Stage 3.1: Setup the Matter Python environment
295310
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/python_lib python_lib
@@ -304,6 +319,6 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/src/python_testing/requir
304319
RUN pip install --break-system-packages -r /tmp/requirements.txt && rm /tmp/requirements.txt
305320

306321
# PIP requires MASON package compilation, which seems to require a JDK
307-
RUN set -x && DEBIAN_FRONTEND=noninteractive apt-get install -fy openjdk-8-jdk
322+
RUN set -x && DEBIAN_FRONTEND=noninteractive apt-get update; apt-get install -fy openjdk-8-jdk
308323

309324
RUN pip install --break-system-packages --no-cache-dir python_lib/controller/python/chip*.whl

scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -2217,6 +2217,7 @@
22172217
}; \
22182218
const EmberAfGenericClusterFunction chipFuncArrayThermostatServer[] = { \
22192219
(EmberAfGenericClusterFunction) emberAfThermostatClusterServerInitCallback, \
2220+
(EmberAfGenericClusterFunction) MatterThermostatClusterServerAttributeChangedCallback, \
22202221
(EmberAfGenericClusterFunction) MatterThermostatClusterServerShutdownCallback, \
22212222
(EmberAfGenericClusterFunction) MatterThermostatClusterServerPreAttributeChangedCallback, \
22222223
}; \
@@ -3756,7 +3757,7 @@
37563757
.attributes = ZAP_ATTRIBUTE_INDEX(616), \
37573758
.attributeCount = 26, \
37583759
.clusterSize = 72, \
3759-
.mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \
3760+
.mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \
37603761
.functions = chipFuncArrayThermostatServer, \
37613762
.acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ), \
37623763
.generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 246 ), \

src/access/AccessControl.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,7 @@ CHIP_ERROR AccessControl::CheckARL(const SubjectDescriptor & subjectDescriptor,
538538
if (result != CHIP_NO_ERROR)
539539
{
540540
ChipLogProgress(DataManagement, "AccessControl: %s",
541-
#if 0
542-
// TODO(#35177): new error code coming when access check plumbing are fixed in callers
543541
(result == CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL) ? "denied (restricted)" : "denied (restriction error)");
544-
#else
545-
(result == CHIP_ERROR_ACCESS_DENIED) ? "denied (restricted)" : "denied (restriction error)");
546-
#endif
547542
return result;
548543
}
549544

src/access/AccessRestrictionProvider.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -197,45 +197,25 @@ CHIP_ERROR AccessRestrictionProvider::DoCheck(const std::vector<Entry> & entries
197197
if (requestPath.requestType == RequestType::kAttributeReadRequest ||
198198
requestPath.requestType == RequestType::kAttributeWriteRequest)
199199
{
200-
#if 0
201-
// TODO(#35177): use new ARL error code when access checks are fixed
202200
return CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL;
203-
#else
204-
return CHIP_ERROR_ACCESS_DENIED;
205-
#endif
206201
}
207202
break;
208203
case Type::kAttributeWriteForbidden:
209204
if (requestPath.requestType == RequestType::kAttributeWriteRequest)
210205
{
211-
#if 0
212-
// TODO(#35177): use new ARL error code when access checks are fixed
213206
return CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL;
214-
#else
215-
return CHIP_ERROR_ACCESS_DENIED;
216-
#endif
217207
}
218208
break;
219209
case Type::kCommandForbidden:
220210
if (requestPath.requestType == RequestType::kCommandInvokeRequest)
221211
{
222-
#if 0
223-
// TODO(#35177): use new ARL error code when access checks are fixed
224212
return CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL;
225-
#else
226-
return CHIP_ERROR_ACCESS_DENIED;
227-
#endif
228213
}
229214
break;
230215
case Type::kEventForbidden:
231216
if (requestPath.requestType == RequestType::kEventReadRequest)
232217
{
233-
#if 0
234-
// TODO(#35177): use new ARL error code when access checks are fixed
235218
return CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL;
236-
#else
237-
return CHIP_ERROR_ACCESS_DENIED;
238-
#endif
239219
}
240220
break;
241221
}

src/access/tests/TestAccessRestrictionProvider.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void RunChecks(const CheckData * checkData, size_t count)
174174
{
175175
for (size_t i = 0; i < count; i++)
176176
{
177-
CHIP_ERROR expectedResult = checkData[i].allow ? CHIP_NO_ERROR : CHIP_ERROR_ACCESS_DENIED;
177+
CHIP_ERROR expectedResult = checkData[i].allow ? CHIP_NO_ERROR : CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL;
178178
EXPECT_EQ(accessControl.Check(checkData[i].subjectDescriptor, checkData[i].requestPath, checkData[i].privilege),
179179
expectedResult);
180180
}

src/app/CommandHandlerImpl.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,13 @@ Status CommandHandlerImpl::ProcessCommandDataIB(CommandDataIB::Parser & aCommand
410410
err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege);
411411
if (err != CHIP_NO_ERROR)
412412
{
413-
if (err != CHIP_ERROR_ACCESS_DENIED)
413+
if ((err != CHIP_ERROR_ACCESS_DENIED) && (err != CHIP_ERROR_ACCESS_RESTRICTED_BY_ARL))
414414
{
415415
return FallibleAddStatus(concretePath, Status::Failure) != CHIP_NO_ERROR ? Status::Failure : Status::Success;
416416
}
417417
// TODO: when wildcard invokes are supported, handle them to discard rather than fail with status
418-
return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success;
418+
Status status = err == CHIP_ERROR_ACCESS_DENIED ? Status::UnsupportedAccess : Status::AccessRestricted;
419+
return FallibleAddStatus(concretePath, status) != CHIP_NO_ERROR ? Status::Failure : Status::Success;
419420
}
420421
}
421422

src/app/CommandHandlerImpl.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,12 @@ class CommandHandlerImpl : public CommandHandler
294294
{
295295
return CHIP_NO_ERROR;
296296
}
297-
ReturnErrorOnFailure(RollbackResponse());
297+
// The error value of RollbackResponse is not important if it fails, we prioritize
298+
// conveying the error generated by addResponseFunction to the caller.
299+
if (RollbackResponse() != CHIP_NO_ERROR)
300+
{
301+
return err;
302+
}
298303
// If we failed to add a command due to lack of space in the
299304
// packet, we will make another attempt to add the response using
300305
// an additional InvokeResponseMessage.

0 commit comments

Comments
 (0)