Send EZSP v14+ multicasts and broadcasts without a NWK alias - #757
Open
zigpy-review-bot wants to merge 1 commit into
Open
zigpy-review-bot wants to merge 1 commit into
zigpy-review-bot wants to merge 1 commit into
Conversation
`sendMulticast` and `sendBroadcast` were called with `alias=0x0000`. The stack only treats `SL_ZIGBEE_NULL_NODE_ID` (0xFFFF) as "not aliased": any other value makes it overwrite the NWK sequence number of the outgoing frame with the provided one, which was zigpy's TSN. Those counters are kept per group, per device and per application and all start at zero, so unrelated frames left the coordinator with the same NWK source and sequence number and were dropped by routers as broadcast duplicates. Related: #756
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #757 +/- ##
=======================================
Coverage 99.55% 99.55%
=======================================
Files 64 64
Lines 4284 4285 +1
=======================================
+ Hits 4265 4266 +1
Misses 19 19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
EZSP v14+
sendMulticastandsendBroadcastwere called withalias=0x0000andsequence=the caller's APS TSN. The stack treats onlySL_ZIGBEE_NULL_NODE_ID(0xFFFF) as "not an aliased source": for any other value — including the coordinator's own 0x0000 — it overwrites the NWK source and NWK sequence number of the outgoing frame with the supplied ones.zigpy's TSNs are not a single counter:
Group._send_sequenceis per group, and the ZDO/application counters are separate again, all starting at zero. So unrelated frames left the coordinator carrying the same (NWK source, NWK sequence) pair, and routers dropped them as broadcast-transaction-table duplicates for the lifetime of the entry (9 s per the Zigbee PRO stack profile, 20 s on EmberZNet routers). The visible effect is group commands silently doing nothing — see #756 for a full reproduction, and the reporter's confirmation that patching the alias at runtime fixes it on a real network.The fix
This passes
alias=0xFFFFandsequence=0(ignored without an alias source) for both calls, which lets the stack assign the NWK sequence number itself, as it does on EZSP v13 and older.bellows/zigbee/application.pydiscards the sequence these two calls return, so nothing depends on the old behaviour.The stack takes that number from the single per-network NWK counter it also uses for the broadcasts it originates on its own (route requests, link status), so it cannot collide with those — whereas any host-chosen number sent under NWK source 0x0000 can, however it is counted. (From static analysis of the prebuilt EmberZNet 9.0.2 stack library; details in #756.)
Affected versions
Only v14+ is affected: the pre-v14
sendMulticast/sendBroadcastframes have noalias/nwkSequencefields at all (the Gecko SDK exposes aliasing through separateemberSendMulticastWithAlias/emberProxyBroadcastcalls instead). The constant value is stable across both SDK generations —EMBER_NULL_NODE_IDis0xFFFFuin the Gecko SDK andSL_ZIGBEE_NULL_NODE_IDis0xFFFFuin the Simplicity SDK.Fixes #756