Detecting mesh retransmitted packets at the application layer in Zephyr

I have a custom model that subscribes to messages from other devices. I'd like to detect if a  mesh message that is received, is the original or a retransmission so I can filter out duplicates
I saw in the log that this info is available at the mesh stack level  but is it possible to access it at the application level?
Thanks

Parents
  • Hi,

    Filtering out duplicates should be an already implemented. To avoid messages being repeatedly forwarded by the same relays, all mesh devices maintain a message cache. This cache is used for filtering out packets that the device has already handled. 

  • That's not what I'm seeing

    The custom model has an opcode defined as follows

    const struct bt_mesh_model_op _vnd_model_ops[] = {
        {BT_MESH_MODEL_OP_3(0x11, COMPANY_CID), BT_MESH_LEN_EXACT(8),  vnd_set_unack},
        BT_MESH_MODEL_OP_END,
    };
    int vnd_set_unack(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,struct net_buf_simple *buf)
    {
       
        LOG_DBG("Got packet from %x",ctx->addr);
     
        return 0;
    }
    ------------------------
    I provision 1 device and configure it to publish to a certain address with the publish period of 10 seconds, TTL 300 and retransmit count 3
    Provision the second device to subscribe to the same address
    On the second device the function vnd_set_unack is invoked  every 10 seconds 3 times and  I see 3 debug messages in the log. I'm working on setting up the test to provide the log. 
    In the meantime question
    Are there any hooks into the message cache at the application level?
    Thanks
Reply
  • That's not what I'm seeing

    The custom model has an opcode defined as follows

    const struct bt_mesh_model_op _vnd_model_ops[] = {
        {BT_MESH_MODEL_OP_3(0x11, COMPANY_CID), BT_MESH_LEN_EXACT(8),  vnd_set_unack},
        BT_MESH_MODEL_OP_END,
    };
    int vnd_set_unack(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,struct net_buf_simple *buf)
    {
       
        LOG_DBG("Got packet from %x",ctx->addr);
     
        return 0;
    }
    ------------------------
    I provision 1 device and configure it to publish to a certain address with the publish period of 10 seconds, TTL 300 and retransmit count 3
    Provision the second device to subscribe to the same address
    On the second device the function vnd_set_unack is invoked  every 10 seconds 3 times and  I see 3 debug messages in the log. I'm working on setting up the test to provide the log. 
    In the meantime question
    Are there any hooks into the message cache at the application level?
    Thanks
Children
No Data
Related