Message ID | 20241126082003.2178783-1-quic_shuaz@quicinc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v1] BNEP: Fix the BNEP Unknown Control Message in PTS testing | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/BuildEll | success | Build ELL PASS |
tedd_an/BluezMake | fail | BluezMake FAIL: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4693: all] Error 2 |
tedd_an/MakeCheck | fail | BlueZ Make Check FAIL: |
tedd_an/MakeDistcheck | success | Make Distcheck PASS |
tedd_an/CheckValgrind | fail | Check Valgrind FAIL: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:12358: check] Error 2 |
tedd_an/CheckSmatch | fail | CheckSparse: FAIL: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:296:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:296:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:219:15: warning: array of flexible structures ./lib/bluetooth.h:224:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' android/avctp.c:505:34: warning: Variable length array is used. android/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. android/avrcp-lib.c:1085:34: warning: Variable length array is used. android/avrcp-lib.c:1583:34: warning: Variable length array is used. android/avrcp-lib.c:1612:34: warning: Variable length array is used. android/avrcp-lib.c:1638:34: warning: Variable length array is used. profiles/network/server.c:338:17: warning: mixing declarations and code profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4693: all] Error 2 |
tedd_an/bluezmakeextell | fail | Make External ELL FAIL: profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4693: all] Error 2 |
tedd_an/ScanBuild | success | Scan Build PASS |
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=912438 ---Test result--- Test Summary: CheckPatch PENDING 0.33 seconds GitLint PENDING 0.30 seconds BuildEll PASS 23.21 seconds BluezMake FAIL 68.51 seconds MakeCheck FAIL 1983.09 seconds MakeDistcheck PASS 178.38 seconds CheckValgrind FAIL 52.20 seconds CheckSmatch FAIL 135.21 seconds bluezmakeextell FAIL 65.93 seconds IncrementalBuild PENDING 0.36 seconds ScanBuild PASS 869.45 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: BluezMake - FAIL Desc: Build BlueZ Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4693: all] Error 2 ############################## Test: MakeCheck - FAIL Desc: Run Bluez Make Check Output: unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make: *** [Makefile:12358: check] Error 2 ############################## Test: CheckValgrind - FAIL Desc: Run Bluez Make Check with Valgrind Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:12358: check] Error 2 ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:296:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:296:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:219:15: warning: array of flexible structures ./lib/bluetooth.h:224:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' android/avctp.c:505:34: warning: Variable length array is used. android/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. android/avrcp-lib.c:1085:34: warning: Variable length array is used. android/avrcp-lib.c:1583:34: warning: Variable length array is used. android/avrcp-lib.c:1612:34: warning: Variable length array is used. android/avrcp-lib.c:1638:34: warning: Variable length array is used. profiles/network/server.c:338:17: warning: mixing declarations and code profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4693: all] Error 2 ############################## Test: bluezmakeextell - FAIL Desc: Build Bluez with External ELL Output: profiles/network/server.c: In function ‘bnep_setup’: profiles/network/server.c:338:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 338 | int err; | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:10377: profiles/network/bluetoothd-server.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4693: all] Error 2 ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth
Hi Shuai, On Tue, Nov 26, 2024 at 3:20 AM Shuai Zhang <quic_shuaz@quicinc.com> wrote: > > 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, the handling of > the Unknown Control Message is added before validating the data. > > Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com> > --- > profiles/network/server.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/profiles/network/server.c b/profiles/network/server.c > index 96738f26c..c1d96cd1c 100644 > --- a/profiles/network/server.c > +++ b/profiles/network/server.c > @@ -325,6 +325,32 @@ static gboolean bnep_setup(GIOChannel *chan, > return FALSE; > } > > + /* > + * When benp_control_type is between 0x07 and 0xFF, > + * a reply is also required. > + * However, since the command size is only 2 bytes, > + * it needs to be processed before determining > + * if it is a valid command. > + */ > + if (req->type == BNEP_CONTROL && > + req->ctrl > BNEP_FILTER_MULT_ADDR_RSP) { > + error("bnep: cmd not understood"); > + int err; > + struct bnep_ctrl_cmd_not_understood_cmd rsp; Id probably memset the rsp to 0 to be safe that we don't respond with uninitialized fields. > + rsp.type = BNEP_CONTROL; > + rsp.ctrl = BNEP_CMD_NOT_UNDERSTOOD; > + rsp.unkn_ctrl = (uint8_t) req->ctrl; > + > + err = send(sk, &rsp, sizeof(rsp), 0); > + > + if (err < 0) > + error("send not understood ctrl rsp error: %s (%d)", > + strerror(errno), errno); > + > + return FALSE; Move this code to its own function so it is easier to reuse. > + } > + > /* > * Initial received data packet is BNEP_SETUP_CONNECTION_REQUEST_MSG > * minimal size of this frame is 3 octets: 1 byte of BNEP Type + > -- > 2.25.1 > >
diff --git a/profiles/network/server.c b/profiles/network/server.c index 96738f26c..c1d96cd1c 100644 --- a/profiles/network/server.c +++ b/profiles/network/server.c @@ -325,6 +325,32 @@ static gboolean bnep_setup(GIOChannel *chan, return FALSE; } + /* + * When benp_control_type is between 0x07 and 0xFF, + * a reply is also required. + * However, since the command size is only 2 bytes, + * it needs to be processed before determining + * if it is a valid command. + */ + if (req->type == BNEP_CONTROL && + req->ctrl > BNEP_FILTER_MULT_ADDR_RSP) { + error("bnep: cmd not understood"); + int err; + struct bnep_ctrl_cmd_not_understood_cmd rsp; + + rsp.type = BNEP_CONTROL; + rsp.ctrl = BNEP_CMD_NOT_UNDERSTOOD; + rsp.unkn_ctrl = (uint8_t) req->ctrl; + + err = send(sk, &rsp, sizeof(rsp), 0); + + if (err < 0) + error("send not understood ctrl rsp error: %s (%d)", + strerror(errno), errno); + + return FALSE; + } + /* * Initial received data packet is BNEP_SETUP_CONNECTION_REQUEST_MSG * minimal size of this frame is 3 octets: 1 byte of BNEP Type +
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, the handling of the Unknown Control Message is added before validating the data. Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com> --- profiles/network/server.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)