diff mbox series

[BlueZ,1/3] mesh: Add interface output filter

Message ID VI1PR09MB4239AE3033F3ACDF7CFFDAAFE34F9@VI1PR09MB4239.eurprd09.prod.outlook.com (mailing list archive)
State Accepted
Commit a76ff5879b755b97043a30682c97788d162bb229
Headers show
Series Mesh model publication fixes according to mesh profile | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makecheckvalgrind success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS
tedd_an/incremental_build success Pass
tedd_an/scan_build success Pass

Commit Message

Isak Westin Sept. 21, 2022, 8:39 a.m. UTC
According to the mesh profile (3.4.5.2), if TTL is set to 1 for an
outgoing message, that message shall be dropped.
---
 mesh/net.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

bluez.test.bot@gmail.com Sept. 21, 2022, 9:47 a.m. UTC | #1
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=678944

---Test result---

Test Summary:
CheckPatch                    FAIL      1.97 seconds
GitLint                       PASS      1.36 seconds
Prep - Setup ELL              PASS      30.85 seconds
Build - Prep                  PASS      0.64 seconds
Build - Configure             PASS      9.68 seconds
Build - Make                  PASS      968.03 seconds
Make Check                    PASS      12.57 seconds
Make Check w/Valgrind         PASS      349.55 seconds
Make Distcheck                PASS      293.12 seconds
Build w/ext ELL - Configure   PASS      10.20 seconds
Build w/ext ELL - Make        PASS      102.21 seconds
Incremental Build w/ patches  PASS      361.13 seconds
Scan Build                    PASS      614.81 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,2/3] mesh: Do not accept publication for unbound appkey
WARNING:LONG_LINE: line length of 121 exceeds 80 columns
#112: FILE: mesh/model.c:1067:
+											!has_binding(mod->bindings, idx))

/github/workspace/src/12983376.patch total: 0 errors, 1 warnings, 9 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12983376.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/mesh/net.c b/mesh/net.c
index e8e6d3a61..699469284 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -3067,6 +3067,13 @@  void mesh_net_send_seg(struct mesh_net *net, uint32_t net_key_id,
 	uint8_t segO = (hdr >> SEGO_HDR_SHIFT) & SEG_MASK;
 	uint8_t segN = (hdr >> SEGN_HDR_SHIFT) & SEG_MASK;
 
+	/*
+	 * MshPRFv1.0.1 section 3.4.5.2, Interface output filter:
+	 * If TTL is set to 1, message shall be dropped.
+	 */
+	if (ttl == 1)
+		return;
+
 	/* TODO: Only used for current POLLed segments to LPNs */
 
 	l_debug("SEQ: %6.6x", seq + segO);
@@ -3135,6 +3142,13 @@  bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src,
 			(dst >= net->src_addr && dst <= net->last_addr))
 		return true;
 
+	/*
+	 * MshPRFv1.0.1 section 3.4.5.2, Interface output filter:
+	 * If TTL is set to 1, message shall be dropped.
+	 */
+	if (ttl == 1)
+		return true;
+
 	/* Setup OTA Network send */
 	payload = mesh_sar_new(msg_len);
 	memcpy(payload->buf, msg, msg_len);
@@ -3206,6 +3220,13 @@  void mesh_net_ack_send(struct mesh_net *net, uint32_t net_key_id,
 	uint8_t pkt_len;
 	uint8_t pkt[30];
 
+	/*
+	 * MshPRFv1.0.1 section 3.4.5.2, Interface output filter:
+	 * If TTL is set to 1, message shall be dropped.
+	 */
+	if (ttl == 1)
+		return;
+
 	hdr = NET_OP_SEG_ACKNOWLEDGE << OPCODE_HDR_SHIFT;
 	hdr |= rly << RELAY_HDR_SHIFT;
 	hdr |= (seqZero & SEQ_ZERO_MASK) << SEQ_ZERO_HDR_SHIFT;
@@ -3264,6 +3285,13 @@  void mesh_net_transport_send(struct mesh_net *net, uint32_t net_key_id,
 	if (*msg & 0xc0 || (9 + msg_len + 8 > 29))
 		return;
 
+	/*
+	 * MshPRFv1.0.1 section 3.4.5.2, Interface output filter:
+	 * If TTL is set to 1, message shall be dropped.
+	 */
+	if (ttl == 1)
+		return;
+
 	/* Enqueue for Friend if forwardable and from us */
 	if (!net_key_id && src >= net->src_addr && src <= net->last_addr) {
 		uint32_t hdr = msg[0] << OPCODE_HDR_SHIFT;