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

Mesh proxy re connection and sequence number

Hi

I re open an old ticket to know about changes in the Android Mesh Library

https://devzone.nordicsemi.com/f/nordic-q-a/45553/is-sequence-number-and-transaction-id-equal

I see that, now, the Mesh SDK for nrf52 keep a good track of sequence number and IV index. But we are still facing issues when a phone re connect to a proxy node.

To get the sequence number, we send a message to set a new proxy filter type (here blacklist 0x0000) and receive a new sequence number.

But sometime the board is not accepting the filter messages.

Also, the board is not accepting any message after the app came to foreground. when the app is in background, it is connected to the board all the time. so here we need to restarting the board before being able to send any new message.

Is there any way to get the board's sequence number without sending filter messages?

thank you very much.

  • Hi. 

    Forwarding this to our developers. Will get back to you with more information. 

    Best regards, 
    Joakim Jakobsen

  • Hi Joakim,

    Any news from the Devs?

    If it can helps, we noticed one news strange behaviour,

    indeed, when nrf mesh app try to reconnect some times after the provisionning, the board did not accept any messages.

    turn off and on the board appear to 'fix' the problem.

    Did someone have an idea?

    thanks, best regards.

    B

  • Hi Joakim,

    Do you have any news about this question ? 

    Thank you in advance,

  • Hi I'm trying to understand the issue you aer facing here, why do you need the sequence number here? The sequence number is automatically incremented from the library for every message that's sent out? Have you made changes to the sample application?

    The sample android app will try to connect after the provisioning completes, it will try to scan and connect for a duration of 30 seconds and if it fails the app will let the user connect manually.

  • Hi Roshan

    First, we didn't change the library. We are using it as it is.

    We need a sequence number to send messages to the mesh network, obviously.

    regarding that one

    The sequence number is automatically incremented from the library for every message that's sent out?

    Is a question or an affirmation?

    The original question is : how do we get the sequence number from the proxy server to initiate the communication?

    For the moment, the App send a command that don't requiere a sequence number (proxy config command) to retrieve it, like it is done in the exemples. But it is not working for reconnections, when the App is disconnected for a while.

    When the app reconnect, it sends messages to the node that can't be decrypt until the phone seq num didn't reach a sufficient value.

    In the board SDK, the symptoma is that the packet cannot be decrypted.

    the error we are facing on board side is:

    proxy.c:547        {
    proxy.c:548            __LOG(LOG_SRC_BEARER, LOG_LEVEL_INFO, "Decryption failed\n");
    proxy.c:549        }

    This come from the function 

    net_packet.c:231 uint32_t net_packet_decrypt(network_packet_metadata_t * p_net_metadata,
    net_packet.c:232                             uint32_t net_packet_len,
    net_packet.c:233                             const packet_mesh_net_packet_t * p_net_encrypted_packet,
    net_packet.c:234                             packet_mesh_net_packet_t * p_net_decrypted_packet,
    net_packet.c:235                             net_packet_kind_t packet_kind)
    net_packet.c:236 {
    net_packet.c:237     NRF_MESH_ASSERT(p_net_metadata != NULL && p_net_encrypted_packet != NULL &&
    net_packet.c:238                     p_net_decrypted_packet != NULL &&
    net_packet.c:239                     p_net_decrypted_packet != p_net_encrypted_packet);
    net_packet.c:240 
    net_packet.c:241     if (net_packet_len < PACKET_MESH_NET_PDU_OFFSET || net_packet_len > PACKET_MESH_NET_MAX_SIZE)
    net_packet.c:242     {
    net_packet.c:243         return NRF_ERROR_INVALID_LENGTH;
    net_packet.c:244     }
    net_packet.c:245 
    net_packet.c:246     p_net_metadata->internal.iv_index = net_state_rx_iv_index_get(packet_mesh_net_ivi_get(p_net_encrypted_packet));
    net_packet.c:247     p_net_metadata->p_security_material = NULL;
    net_packet.c:248     uint8_t nid = packet_mesh_net_nid_get(p_net_encrypted_packet);
    net_packet.c:249 
    net_packet.c:250     const nrf_mesh_network_secmat_t * p_secmat[2] = { NULL, NULL };
    net_packet.c:251     do {
    net_packet.c:252         nrf_mesh_net_secmat_next_get(nid, &p_secmat[0], &p_secmat[1]);
    net_packet.c:253 
    net_packet.c:254         for (uint32_t i = 0; i < ARRAY_SIZE(p_secmat) && p_secmat[i] != NULL; i++)
    net_packet.c:255         {
    net_packet.c:256             if (try_decrypt(p_net_metadata,
    net_packet.c:257                             net_packet_len,
    net_packet.c:258                             p_net_encrypted_packet,
    net_packet.c:259                             p_net_decrypted_packet,
    net_packet.c:260                             p_secmat[i],
    net_packet.c:261                             packet_kind))
    net_packet.c:262             {
    net_packet.c:263                 return NRF_SUCCESS;
    net_packet.c:264             }
    net_packet.c:265         }
    net_packet.c:266     } while (p_secmat[0] != NULL);
    net_packet.c:267 
    net_packet.c:268     return NRF_ERROR_NOT_FOUND;
    net_packet.c:269 }

    that give 268: NRF_ERROR_NOT_FOUND

    so how do we get the sequence number from the proxy server to initiate the communication?

    is it still the better solution to send a proxy config command to retreive it?

Related