All of lore.kernel.org
 help / color / mirror / Atom feed
From: Isak Westin <isak.westin@loytec.com>
To: linux-bluetooth@vger.kernel.org
Cc: Isak Westin <isak.westin@loytec.com>
Subject: [PATCH BlueZ 2/4] mesh: Reply to HB pub set with same fields
Date: Mon, 26 Sep 2022 15:01:08 +0200	[thread overview]
Message-ID: <20220926130110.2146-3-isak.westin@loytec.com> (raw)
In-Reply-To: <20220926130110.2146-1-isak.westin@loytec.com>

If a Config Heartbeat Publication Set message is unsuccessfully
processed, the fields in the status reply should be the same as in the
original message. See MshPRFv1.0.1 section 4.4.1.2.15.
---
 mesh/cfgmod-server.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index 33796d05a..9c5edf551 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -575,7 +575,17 @@ static uint16_t hb_publication_set(struct mesh_node *node, const uint8_t *pkt)
 	status = mesh_net_set_heartbeat_pub(net, dst, features, net_idx, ttl,
 						count_log, period_log);
 
-	return hb_publication_get(node, status);
+	if (status != MESH_STATUS_SUCCESS) {
+		uint16_t n;
+
+		n = mesh_model_opcode_set(OP_CONFIG_HEARTBEAT_PUB_STATUS, msg);
+		msg[n++] = status;
+		memcpy(msg + n, pkt, 9);
+		n += 9;
+
+		return n;
+	} else
+		return hb_publication_get(node, status);
 }
 
 static void node_reset(void *user_data)
-- 
2.20.1






  parent reply	other threads:[~2022-09-26 14:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 13:01 [PATCH BlueZ 0/4] Mesh: Fix heartbeat publication/subscription Isak Westin
2022-09-26 13:01 ` [PATCH BlueZ 1/4] mesh: Correct u32 to u8 log transformation Isak Westin
2022-09-26 15:54   ` Mesh: Fix heartbeat publication/subscription bluez.test.bot
2022-09-26 13:01 ` Isak Westin [this message]
2022-09-26 13:01 ` [PATCH BlueZ 3/4] mesh: Correct HB sub state updates Isak Westin
2022-09-26 13:01 ` [PATCH BlueZ 4/4] mesh: Clear HB sub status field if disabled Isak Westin
2022-09-26 20:20 ` [PATCH BlueZ 0/4] Mesh: Fix heartbeat publication/subscription patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926130110.2146-3-isak.westin@loytec.com \
    --to=isak.westin@loytec.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.