diff mbox series

[v5] obex: Fix PBAP GET request in PTS testing

Message ID 20241104091944.411353-1-quic_amisjain@quicinc.com (mailing list archive)
State New
Headers show
Series [v5] obex: Fix PBAP GET request in PTS testing | 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/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/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Amisha Jain Nov. 4, 2024, 9:19 a.m. UTC
This change is required for passing below PTS testcases:
1. PBAP/PSE/PBD/BV-02-C
2. PBAP/PSE/PBD/BV-03-C
3. PBAP/PSE/PBD/BI-01-C
4. PBAP/PSE/PBD/BV-13-C
5. PBAP/PSE/PBD/BV-14-C
6. PBAP/PSE/PBD/BV-17-C

PTS sends all the GET phonebook requests without extra params.
Therefore, the PBAP server is rejecting the requests with a
'Bad Request' response.
So append few default params in GET request to avoid
testcase failure.
These params are already added for Vcardlisting and Vcardentry
operations.

---
 obexd/plugins/pbap.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com Nov. 4, 2024, 11:06 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=905963

---Test result---

Test Summary:
CheckPatch                    PASS      0.50 seconds
GitLint                       PASS      0.34 seconds
BuildEll                      PASS      25.49 seconds
BluezMake                     PASS      1670.41 seconds
MakeCheck                     PASS      13.44 seconds
MakeDistcheck                 PASS      183.22 seconds
CheckValgrind                 PASS      256.54 seconds
CheckSmatch                   PASS      363.63 seconds
bluezmakeextell               PASS      123.18 seconds
IncrementalBuild              PASS      1442.80 seconds
ScanBuild                     PASS      1047.46 seconds



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Nov. 4, 2024, 4:14 p.m. UTC | #2
Hi Amisha,

On Mon, Nov 4, 2024 at 4:26 AM Amisha Jain <quic_amisjain@quicinc.com> wrote:
>
> This change is required for passing below PTS testcases:
> 1. PBAP/PSE/PBD/BV-02-C
> 2. PBAP/PSE/PBD/BV-03-C
> 3. PBAP/PSE/PBD/BI-01-C
> 4. PBAP/PSE/PBD/BV-13-C
> 5. PBAP/PSE/PBD/BV-14-C
> 6. PBAP/PSE/PBD/BV-17-C
>
> PTS sends all the GET phonebook requests without extra params.
> Therefore, the PBAP server is rejecting the requests with a
> 'Bad Request' response.
> So append few default params in GET request to avoid
> testcase failure.
> These params are already added for Vcardlisting and Vcardentry
> operations.

Didn't I give feedback to have this fix move up to parse_aparam:

https://gist.github.com/Vudentz/4fd0ec9cff098a0470869bc99264d7c0

We don't need to keep doing this fabrication of the tags, which is
rather hackish, if we do something like the above.

> ---
>  obexd/plugins/pbap.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
> index 4175f9de8..fb5b6b696 100644
> --- a/obexd/plugins/pbap.c
> +++ b/obexd/plugins/pbap.c
> @@ -511,7 +511,23 @@ static int pbap_get(struct obex_session *os, void *user_data)
>                 rsize = 0;
>         }
>
> -       /* Workaround for PTS client not sending mandatory apparams */
> +       /*
> +        * Workaround for PTS client not sending mandatory apparams
> +        *
> +        * Add MaxListCount attribute, description as per PBAP spec
> +        *
> +        * 5.1.4.3 MaxListCount :
> +        * This header is used to indicate the maximum number of
> +        * entries of the <x-bt/phonebook> object that the PCE
> +        * can handle. The value 65535 means that the number of
> +        * entries is not restricted. The maximum number of entries
> +        * shall be 65,535 if this header is not specified.
> +        *
> +        * 0x04 - Tag id
> +        * 0x02 - length
> +        * next 2 bytes are value - 0xffff
> +        */
> +
>         if (!rsize && g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
>                 static const uint8_t default_apparams[] = {
>                         0x04, 0x02, 0xff, 0xff
> @@ -524,6 +540,12 @@ static int pbap_get(struct obex_session *os, void *user_data)
>                 };
>                 buffer = default_apparams;
>                 rsize = sizeof(default_apparams);
> +       } else if (!rsize && g_ascii_strcasecmp(type, PHONEBOOK_TYPE) == 0) {
> +               static const uint8_t default_apparams[] = {
> +                       0x04, 0x02, 0xff, 0xff
> +               };
> +               buffer = default_apparams;
> +               rsize = sizeof(default_apparams);
>         }
>
>         params = parse_aparam(buffer, rsize);
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index 4175f9de8..fb5b6b696 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -511,7 +511,23 @@  static int pbap_get(struct obex_session *os, void *user_data)
 		rsize = 0;
 	}
 
-	/* Workaround for PTS client not sending mandatory apparams */
+	/*
+	 * Workaround for PTS client not sending mandatory apparams
+	 *
+	 * Add MaxListCount attribute, description as per PBAP spec
+	 *
+	 * 5.1.4.3 MaxListCount :
+	 * This header is used to indicate the maximum number of
+	 * entries of the <x-bt/phonebook> object that the PCE
+	 * can handle. The value 65535 means that the number of
+	 * entries is not restricted. The maximum number of entries
+	 * shall be 65,535 if this header is not specified.
+	 *
+	 * 0x04 - Tag id
+	 * 0x02 - length
+	 * next 2 bytes are value - 0xffff
+	 */
+
 	if (!rsize && g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
 		static const uint8_t default_apparams[] = {
 			0x04, 0x02, 0xff, 0xff
@@ -524,6 +540,12 @@  static int pbap_get(struct obex_session *os, void *user_data)
 		};
 		buffer = default_apparams;
 		rsize = sizeof(default_apparams);
+	} else if (!rsize && g_ascii_strcasecmp(type, PHONEBOOK_TYPE) == 0) {
+		static const uint8_t default_apparams[] = {
+			0x04, 0x02, 0xff, 0xff
+		};
+		buffer = default_apparams;
+		rsize = sizeof(default_apparams);
 	}
 
 	params = parse_aparam(buffer, rsize);