diff mbox series

[v2] BNEP: Fix the BNEP Unknown Control Message in PTS testing

Message ID 20241128074558.3195554-1-quic_shuaz@quicinc.com (mailing list archive)
State New
Headers show
Series [v2] BNEP: Fix the BNEP Unknown Control Message in PTS testing | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Shuai Zhang Nov. 28, 2024, 7:45 a.m. UTC
This change is required for passing below PTS testcase:
1. BNEP/CTRL/BV-01-C

PTS sends an Unknown Control Message with only two bytes,
which is considered incorrect data. Therefore, add
responses to error control commands.

Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
 profiles/network/bnep.c   |  6 ++++++
 profiles/network/bnep.h   |  2 ++
 profiles/network/server.c | 11 +++++++++++
 3 files changed, 19 insertions(+)

Comments

bluez.test.bot@gmail.com Nov. 28, 2024, 9:16 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=913009

---Test result---

Test Summary:
CheckPatch                    PENDING   0.21 seconds
GitLint                       PENDING   0.22 seconds
BuildEll                      PASS      20.61 seconds
BluezMake                     PASS      1573.75 seconds
MakeCheck                     PASS      13.03 seconds
MakeDistcheck                 PASS      159.69 seconds
CheckValgrind                 PASS      215.72 seconds
CheckSmatch                   PASS      276.17 seconds
bluezmakeextell               PASS      100.87 seconds
IncrementalBuild              PENDING   0.30 seconds
ScanBuild                     PASS      850.99 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 54b950058..8d4786d45 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -726,3 +726,9 @@  void bnep_server_delete(char *bridge, char *iface, const bdaddr_t *addr)
 	bnep_if_down(iface);
 	bnep_conndel(addr);
 }
+
+int bnep_send_unkown_rsp(int sk, uint16_t resp)
+{
+	return bnep_send_ctrl_rsp(sk, BNEP_CMD_NOT_UNDERSTOOD,
+							  resp);
+}
diff --git a/profiles/network/bnep.h b/profiles/network/bnep.h
index 493a2b036..61971ae0b 100644
--- a/profiles/network/bnep.h
+++ b/profiles/network/bnep.h
@@ -27,3 +27,5 @@  void bnep_disconnect(struct bnep *session);
 int bnep_server_add(int sk, char *bridge, char *iface, const bdaddr_t *addr,
 						uint8_t *setup_data, int len);
 void bnep_server_delete(char *bridge, char *iface, const bdaddr_t *addr);
+int bnep_send_unkown_rsp(int sk, uint16_t resp);
+
diff --git a/profiles/network/server.c b/profiles/network/server.c
index 96738f26c..7d84b6a1a 100644
--- a/profiles/network/server.c
+++ b/profiles/network/server.c
@@ -331,6 +331,17 @@  static gboolean bnep_setup(GIOChannel *chan,
 	 * 1 byte of BNEP Control Type + 1 byte of BNEP services UUID size.
 	 */
 	if (n < 3) {
+
+		/* Added a response to the error control command
+		 * This packet reply to any control message received,
+		 * which contains an unknown BNEP control type value.
+		 */
+		if (req->ctrl == BNEP_CONTROL) {
+			if (bnep_send_unkown_rsp(sk, req->ctrl) < 0)
+				error("send not understood ctrl rsp error: %s (%d)",
+								strerror(errno), errno);
+		}
+
 		error("To few setup connection request data received");
 		return FALSE;
 	}