This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[Zigbee] ZED Missed Network Key Update

Hello,

We've encountered an issue where if the ZED missed a network key update, it will not do  trust center rejoin and continue to do secure rejoin

Using nRF5 SDK for Thread and Zigbee 4.2.0 and ZED on nrf52840.

I saw this ticket where this user had the same problem and a solution was provided and reported to be working for sdk 4.1.0. I have tried adding

case ZB_BDB_SIGNAL_DEVICE_REBOOT:
        /* Checking ZB_BDB_STATUS_NO_NETWORK status is necessary to exclude situations, when reboot
         * is failed by some other reason. The same status may occur in case of the failed steering
         * procedure, failed join procedure and failed touchlink join/rejoin, but it is expected
         * to be passed with the different signal */
        if ((status == (zb_uint8_t)RET_ERROR) && (ZB_BDB().bdb_commissioning_status == ZB_BDB_STATUS_NO_NETWORK))
        {
            /* Forced TC rejoin */
            ZB_BDB().bdb_commissioning_step = ZB_BDB_INITIALIZATION;
            ZB_BDB().bdb_commissioning_status = ZB_BDB_STATUS_IN_PROGRESS;
            bdb_commissioning_signal(BDB_COMM_SIGNAL_INIT_TC_REJOIN, 0);
            ZB_BDB().bdb_application_signal = ZB_BDB_SIGNAL_DEVICE_REBOOT;
            break; /* ZB_BDB_SIGNAL_DEVICE_REBOOT */
        }

to our signal handler but did not overwrite the header files. When testing with a key switch, ZED does not act any different.

Is this work around still correct for SDK4.2.0? or is there a more correct way now?

Regards,
Chris

Parents
  • Hi, 

    You mentioned that you added `TC_REJOIN_DONE` case and modified `rejoin_the_network` function to change Secure Rejoin to TC Rejoin. Did you modify also `ZB_ZDO_SIGNAL_DEVICE_UPDATE` case as well? 

        case ZB_ZDO_SIGNAL_DEVICE_UPDATE: {
            /* This signal notifies the Zigbee Trust center (usually
             * implemented on the coordinator node) or parent router
             * application once a device joined, rejoined,
             * or left the network.
             *
             * For more information see table 4.14
             * of the Zigbee Specification (R21).
             */
            zb_zdo_signal_device_update_params_t *update_params =
                ZB_ZDO_SIGNAL_GET_PARAMS(
                    sig_hndler,
                    zb_zdo_signal_device_update_params_t);
            char ieee_addr_buf[IEEE_ADDR_BUF_SIZE] = { 0 };
            int addr_len;
            zb_address_ieee_ref_t addr_ref;
     
            addr_len = ieee_addr_to_str(ieee_addr_buf,
                            sizeof(ieee_addr_buf),
                            update_params->long_addr);
            if (addr_len < 0) {
                strcpy(ieee_addr_buf, "unknown");
            }
            LOG_INF("Device update received (short: 0x%04hx, long: %s, status: %d)",
                update_params->short_addr,
                log_strdup(ieee_addr_buf),
                update_params->status);
     
            if ((zb_address_by_ieee(update_params->long_addr, ZB_FALSE, ZB_FALSE, &addr_ref) == RET_OK)
                && (zb_secur_get_link_key_by_address(update_params->long_addr, ZB_SECUR_PROVISIONAL_KEY) != NULL)) {
                ZB_SCHEDULE_APP_ALARM_CANCEL(zb_nwk_forget_device, addr_ref);
            }
            break;
        }

    This is crucial for the network coordinator to perform TC Rejoin. Unless the `zb_nwk_forget_device` alarm is canceled, Trust Center will delete the link key of the joiner trying to rejoin with the old key.

    -Amanda

Reply
  • Hi, 

    You mentioned that you added `TC_REJOIN_DONE` case and modified `rejoin_the_network` function to change Secure Rejoin to TC Rejoin. Did you modify also `ZB_ZDO_SIGNAL_DEVICE_UPDATE` case as well? 

        case ZB_ZDO_SIGNAL_DEVICE_UPDATE: {
            /* This signal notifies the Zigbee Trust center (usually
             * implemented on the coordinator node) or parent router
             * application once a device joined, rejoined,
             * or left the network.
             *
             * For more information see table 4.14
             * of the Zigbee Specification (R21).
             */
            zb_zdo_signal_device_update_params_t *update_params =
                ZB_ZDO_SIGNAL_GET_PARAMS(
                    sig_hndler,
                    zb_zdo_signal_device_update_params_t);
            char ieee_addr_buf[IEEE_ADDR_BUF_SIZE] = { 0 };
            int addr_len;
            zb_address_ieee_ref_t addr_ref;
     
            addr_len = ieee_addr_to_str(ieee_addr_buf,
                            sizeof(ieee_addr_buf),
                            update_params->long_addr);
            if (addr_len < 0) {
                strcpy(ieee_addr_buf, "unknown");
            }
            LOG_INF("Device update received (short: 0x%04hx, long: %s, status: %d)",
                update_params->short_addr,
                log_strdup(ieee_addr_buf),
                update_params->status);
     
            if ((zb_address_by_ieee(update_params->long_addr, ZB_FALSE, ZB_FALSE, &addr_ref) == RET_OK)
                && (zb_secur_get_link_key_by_address(update_params->long_addr, ZB_SECUR_PROVISIONAL_KEY) != NULL)) {
                ZB_SCHEDULE_APP_ALARM_CANCEL(zb_nwk_forget_device, addr_ref);
            }
            break;
        }

    This is crucial for the network coordinator to perform TC Rejoin. Unless the `zb_nwk_forget_device` alarm is canceled, Trust Center will delete the link key of the joiner trying to rejoin with the old key.

    -Amanda

Children
No Data
Related