-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZNP Adapter Manager/Backup Refactor #303
Conversation
…-herdsman into znp-provisioning-refactor
You can contact me on telegram (@Koenkk) |
It's stored in different places for each Z-Stack version but I believe the only way to reset the counter is to rotate the network key. You can't rotate the EPID. This also matched the structure of the SiLabs EZSP backup format.
You'll need those for APS encryption, which uses unique keys for each device. They're derived from the "TCLK_SEED", the device's IEEE, and a shift, to save space, so you'll have to actually "export" them before use. I haven't had time to investigate if Z-Stack can re-import them in their expanded form, since each stack handles hashed keys differently. It you want to discuss the backup stuff further (it's not set in stone but diverging from the unified backup format this soon won't make it very unified :) ) or find anything interesting within Z-Stack, you can contact me over Discord: |
yes, should be fine |
@nurikk thinking more about this, there are 3 things to backup: |
we can keep backup file as simple json with key-value pairs, key - path, value - data uri like: {
"meta": {
"date": "2021-05-28T00:36:24.604Z",
"some_random_stats": "here",
"z2m_version": "0.15.5"
},
"files": {
"./database.db": "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==",
"./configuration.yaml": "data:text/plain;base64,......"
}
}
|
The ability for an end-user to get a such full backup package as zip file from the frontend would be awesome and make it very user-friendly to perform manual backups and restores when for example migrating between different computers/installations/setups. |
@nurikk but how would the user restore it? (since it cannot restore a json file, the files need to be replaced) |
I thought about two ways of restoring this backups.
But I agree that simple zip file works nice as well KISS :) |
If I provide the info like #303 (comment) (as json), could you contstruct a zip from the frontend? |
Yes |
A small note / question ... Some iobroker.zigbee users had their own ExtPanID different from the default ("DDDDDDDDDDDDDDDD").
It can be seen that the "Extended PAN ID" in the settings and in the adapter do not match. 341bd2fe158bdcb5 - correct extpanid from settings. Hence the questions:
|
Another case - wrong values in adapter side:
|
@castorw can you check this? |
EPID configuration wasn't implemented properly before in ZH. This PR fixed that, but it is possible that adapters initialized by pervious version of ZH may not have EPID properly configured. The occurrence of this issue is related to different firmwares in radios.
See above.
I would suggest they set the EPID to the value reported in adapter. This is the easiest way to fix the issue for now. |
This looks like improperly configured adapter - possibly even in Router/EndDevice mode (wonder if this adapter could have worked before at all). This worked before migrating to updated ZH codebase? Was it run with ZH before? |
Of course the adapter and network were initialized in previous versions of ZH (most users will have this case).
it seems to me the simplest way is to indicate DDDDDDDDDDDDDDDD in extpanid. |
this adapter used to work as a coordinator (in the previous version of ZH). this is probably a problem with early firmwares for cc2538, but they worked for users. I'm afraid this problem cannot be solved by re-initializing the network. most likely the settings are saved at different addresses than in other firmware. maybe add the ability to ignore some checks? otherwise some adapters will not be able to work |
|
first version of firmware was https://github.com/antst/CC2538-ZNP-Coordinator-firmware (without sources) |
@kirovilya the diff does not imply NV relocation, it's only NV stretch so larger tables can be included. Anyway its unrelated to the NV item indexes which hasn't changed for a long time. I am positive that NIB location (item this problem is related to) is the same for Z-Stack 1.2 and Z-Stack 3.0.x and Z-Stack 3.x.0+ as well. The reason for the NV being in the state described above is unknown to me and so far the only occurrence of such state. |
I see a lot of problems with the latest update. therefore, I will repeat my proposal to make it possible to disable the check at startup in order to work with the current settings. |
@kirovilya Could you provide me with NV dump from the adapter which caused this issue (with PANID being 65535)? Possibly using https://github.com/zigpy/zigpy-znp/blob/dev/zigpy_znp/tools/nvram_read.py. |
@castorw I can't do it quickly. this is not my stick, and the user is not an expert. will have to figure out a way for him to execute the code |
@kirovilya Thank you, this would be essential for further diagnostics. I am trying to think about the ability to disable the checks, but most of the updated code-base loses sense in such way. The goal was to stabilize the way ZH handles network provisioning and not create another cracks allowing improperly configured adapters to run. @Koenkk any thoughts on this? |
@kirovilya @castorw let's continue in #376 |
This PR addresses issues discussed in #286. Although quite large - it is a complex refactor of ZNP adapter startup, backup management and commissioning process.
Status:
NWK_SEC_MATERIAL_TABLE
,NWK_TCLK_TABLE
)any
- WIP)Research: Ability to use- may be good for real-time updates - not for cold restoreAPP_CNF_SET_NWK_FRAME_COUNTER
to restore frame counter instead of restoring security material table/ZCD_NW_NWKKEY
Research: Network update instead of full re-commissioning on parameter change- out of scope of this PRZCD_NV_APS_USE_EXT_PANID
as wellDD:DD:DD:DD:DD:DD:DD:DD
@puddly - you are linking frame counter with network key in your proposal (zigpy/zigpy#557 (comment)), however from what I see the frame counters are bound to extended PAN IDs in
NWK_SEC_MATERIAL
table. Or am I doing this wrong?@Koenkk If you'd like I would be happy to discuss this further, preferably in some more interactive manner - Discord, Teams, ... you name it. Thanks.