All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v3] mesh: Keep cancelled SAR data for at least 10 sec
@ 2022-10-11 14:06 Isak Westin
  2022-10-11 15:22 ` [BlueZ,v3] " bluez.test.bot
  2022-10-12 21:30 ` [PATCH BlueZ v3] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Isak Westin @ 2022-10-11 14:06 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Isak Westin

When a SAR transmission has been completed or cancelled, the recipent
should store the block authentication values for at least 10 seconds
and ignore new segments with the same values during this period. See
MshPRFv1.0.1 section 3.5.3.4.
---
 mesh/net.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/mesh/net.c b/mesh/net.c
index 3f42d962c..1d27289bf 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -46,6 +46,7 @@
 
 #define SEG_TO	2
 #define MSG_TO	60
+#define SAR_DEL	10
 
 #define DEFAULT_TRANSMIT_COUNT		1
 #define DEFAULT_TRANSMIT_INTERVAL	100
@@ -166,6 +167,7 @@ struct mesh_sar {
 	bool segmented;
 	bool frnd;
 	bool frnd_cred;
+	bool delete;
 	uint8_t ttl;
 	uint8_t last_seg;
 	uint8_t key_aid;
@@ -1492,14 +1494,27 @@ static void inseg_to(struct l_timeout *seg_timeout, void *user_data)
 static void inmsg_to(struct l_timeout *msg_timeout, void *user_data)
 {
 	struct mesh_net *net = user_data;
-	struct mesh_sar *sar = l_queue_remove_if(net->sar_in,
+	struct mesh_sar *sar = l_queue_find(net->sar_in,
 			match_msg_timeout, msg_timeout);
 
-	l_timeout_remove(msg_timeout);
-	if (!sar)
+	if (!sar) {
+		l_timeout_remove(msg_timeout);
 		return;
+	}
 
-	sar->msg_timeout = NULL;
+	if (!sar->delete) {
+		/*
+		 * Incomplete timer expired, cancel SAR and start
+		 * delete timer
+		 */
+		l_timeout_remove(sar->seg_timeout);
+		sar->seg_timeout = NULL;
+		sar->delete = true;
+		l_timeout_modify(sar->msg_timeout, SAR_DEL);
+		return;
+	}
+
+	l_queue_remove(net->sar_in, sar);
 	mesh_sar_free(sar);
 }
 
@@ -1963,7 +1978,9 @@ static bool seg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
 			/* Re-Send ACK for full msg */
 			send_net_ack(net, sar_in, expected);
 			return true;
-		}
+		} else if (sar_in->delete)
+			/* Ignore cancelled */
+			return false;
 	} else {
 		uint16_t len = MAX_SEG_TO_LEN(segN);
 
@@ -2013,6 +2030,10 @@ static bool seg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
 		/* Kill Inter-Seg timeout */
 		l_timeout_remove(sar_in->seg_timeout);
 		sar_in->seg_timeout = NULL;
+
+		/* Start delete timer */
+		sar_in->delete = true;
+		l_timeout_modify(sar_in->msg_timeout, SAR_DEL);
 		return true;
 	}
 
-- 
2.20.1






^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ,v3] mesh: Keep cancelled SAR data for at least 10 sec
  2022-10-11 14:06 [PATCH BlueZ v3] mesh: Keep cancelled SAR data for at least 10 sec Isak Westin
@ 2022-10-11 15:22 ` bluez.test.bot
  2022-10-12 21:30 ` [PATCH BlueZ v3] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-10-11 15:22 UTC (permalink / raw)
  To: linux-bluetooth, isak.westin

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=684527

---Test result---

Test Summary:
CheckPatch                    PASS      0.73 seconds
GitLint                       PASS      0.52 seconds
Prep - Setup ELL              PASS      35.00 seconds
Build - Prep                  PASS      0.73 seconds
Build - Configure             PASS      11.49 seconds
Build - Make                  PASS      1046.65 seconds
Make Check                    PASS      12.63 seconds
Make Check w/Valgrind         PASS      375.77 seconds
Make Distcheck                PASS      322.10 seconds
Build w/ext ELL - Configure   PASS      11.91 seconds
Build w/ext ELL - Make        PASS      108.72 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    PASS      661.18 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v3] mesh: Keep cancelled SAR data for at least 10 sec
  2022-10-11 14:06 [PATCH BlueZ v3] mesh: Keep cancelled SAR data for at least 10 sec Isak Westin
  2022-10-11 15:22 ` [BlueZ,v3] " bluez.test.bot
@ 2022-10-12 21:30 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-10-12 21:30 UTC (permalink / raw)
  To: Isak Westin; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Brian Gix <brian.gix@intel.com>:

On Tue, 11 Oct 2022 16:06:12 +0200 you wrote:
> When a SAR transmission has been completed or cancelled, the recipent
> should store the block authentication values for at least 10 seconds
> and ignore new segments with the same values during this period. See
> MshPRFv1.0.1 section 3.5.3.4.
> ---
>  mesh/net.c | 31 ++++++++++++++++++++++++++-----
>  1 file changed, 26 insertions(+), 5 deletions(-)

Here is the summary with links:
  - [BlueZ,v3] mesh: Keep cancelled SAR data for at least 10 sec
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5f06473908d9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-12 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 14:06 [PATCH BlueZ v3] mesh: Keep cancelled SAR data for at least 10 sec Isak Westin
2022-10-11 15:22 ` [BlueZ,v3] " bluez.test.bot
2022-10-12 21:30 ` [PATCH BlueZ v3] " patchwork-bot+bluetooth

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.