This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problems changing Network-Key

In the light switch example, I try to change the network-key and then get some new unprovisioned servers provisioned.

The servers seem to get provisioned, but the client logs "Configuration of device 1 failed" and there is no communication.

I use the following code, to change the network-key on the client:


ERROR_CHECK(dsm_subnet_update(m_netkey_handle,m_netkey));
ERROR_CHECK(dsm_subnet_update_swap_keys(m_netkey_handle));
ERROR_CHECK(dsm_subnet_update_commit(m_netkey_handle));


Client messages while provisioning:

0> <t: 3321384>, provisioner.c, 278, Local provisioning link established
0> <t: 3323420>, provisioner.c, 264, Using static authentication
0> <t: 3333395>, provisioner.c, 273, Static authentication data provided
0> <t: 3344788>, main.c, 363, Provisioning complete. Adding address 0x0101.
0> <t: 3344796>, provisioner.c, 111, Getting composition data
0> <t: 3348461>, provisioner.c, 234, Local provisioning link closed
0> <t: 4327847>, main.c, 349, Configuration of device 1 failed

Server messages:

 0> <t:    1138783>, main.c,  117, Successfully provisioned

Is this the correct way to change the network-key? Would a key-refresh also be possible, if the servers

are already porvisioned? I read here, that this was not implemented in the SDK a few month ago.

Parents
  • Hi Seger, 

     

    It most likely was because we hard coded the Network Key in our provisioner in the light switch example. In start_provisioning() you can find that we use NETKEY which is the original one. You would need to edit the code and pass your new netkey to the provisioner. 

     

    Key refresh is supported from SDK v1.0.x. The way you call dsm_subnet_update_* () to do key refresh seems to be correct.

    But if you want to do key refresh for already provisioned nodes, you would need to use configuration client to talk to all configuration servers on all node and update the new key to them before you call dsm_subnet_update_swap_keys() on the provisioner to start swapping keys. 

Reply
  • Hi Seger, 

     

    It most likely was because we hard coded the Network Key in our provisioner in the light switch example. In start_provisioning() you can find that we use NETKEY which is the original one. You would need to edit the code and pass your new netkey to the provisioner. 

     

    Key refresh is supported from SDK v1.0.x. The way you call dsm_subnet_update_* () to do key refresh seems to be correct.

    But if you want to do key refresh for already provisioned nodes, you would need to use configuration client to talk to all configuration servers on all node and update the new key to them before you call dsm_subnet_update_swap_keys() on the provisioner to start swapping keys. 

Children
Related