From 76276e2bd3ddb698a081ecfec79fc2c36b9450b4 Mon Sep 17 00:00:00 2001 From: Alexander Vasiliev Date: Thu, 2 Nov 2023 16:38:12 +0000 Subject: [PATCH] net: mqtt-sn: Remember incoming registered topic name When a client uses wildcard subscription and a new message is published to the matching topic for the first time, the gateway sends REGISTER message to the client, containing the exact topic name and a new topic ID. This change fixes adding these topic ID and name to the internal topics list. Signed-off-by: Alexander Vasiliev --- subsys/net/lib/mqtt_sn/mqtt_sn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/lib/mqtt_sn/mqtt_sn.c b/subsys/net/lib/mqtt_sn/mqtt_sn.c index 4c0be807c21..2a7b71ae055 100644 --- a/subsys/net/lib/mqtt_sn/mqtt_sn.c +++ b/subsys/net/lib/mqtt_sn/mqtt_sn.c @@ -949,6 +949,8 @@ static void handle_register(struct mqtt_sn_client *client, struct mqtt_sn_param_ topic->topic_id = p->topic_id; topic->type = MQTT_SN_TOPIC_TYPE_NORMAL; + sys_slist_append(&client->topic, &topic->next); + response.params.regack.ret_code = MQTT_SN_CODE_ACCEPTED; response.params.regack.topic_id = p->topic_id; response.params.regack.msg_id = p->msg_id;