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

[er5] Could not process mesh packet...

I am currently working on a project based on the light_switch mesh example and am running into an issue where I'm receiving several of the following error throughout operation:

[er5] Could not process mesh packet...

er5 refers to NRF_ERROR_NOT_FOUND

It would appear that it comes about from the following function in net_packet.c

uint32_t net_packet_decrypt(network_packet_metadata_t * p_net_metadata,
                            uint32_t net_packet_len,
                            const packet_mesh_net_packet_t * p_net_encrypted_packet,
                            packet_mesh_net_packet_t * p_net_decrypted_packet,
                            net_packet_kind_t packet_kind)
{
    NRF_MESH_ASSERT(p_net_metadata != NULL && p_net_encrypted_packet != NULL &&
                    p_net_decrypted_packet != NULL &&
                    p_net_decrypted_packet != p_net_encrypted_packet);

    if (net_packet_len < PACKET_MESH_NET_PDU_OFFSET || net_packet_len > PACKET_MESH_NET_MAX_SIZE)
    {
        return NRF_ERROR_INVALID_LENGTH;
    }

    p_net_metadata->internal.iv_index = net_state_rx_iv_index_get(packet_mesh_net_ivi_get(p_net_encrypted_packet));
    p_net_metadata->p_security_material = NULL;
    uint8_t nid = packet_mesh_net_nid_get(p_net_encrypted_packet);

    const nrf_mesh_network_secmat_t * p_secmat[2] = { NULL, NULL };
    do {
        nrf_mesh_net_secmat_next_get(nid, &p_secmat[0], &p_secmat[1]);

        for (uint32_t i = 0; i < ARRAY_SIZE(p_secmat) && p_secmat[i] != NULL; i++)
        {
            if (try_decrypt(p_net_metadata,
                            net_packet_len,
                            p_net_encrypted_packet,
                            p_net_decrypted_packet,
                            p_secmat[i],
                            packet_kind))
            {
                return NRF_SUCCESS;
            }
        }
    } while (p_secmat[0] != NULL);

    return NRF_ERROR_NOT_FOUND;
}

Any idea what would be causing this to happen?

Related