Commit Graph

26485 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
25dd5613d5 monitor: Stop spamming logs when GATT db cannot be loaded
This stops calling hci_devba everytime the GATT db needs to be loaded
since that causes a raw socket to be open to read back the address
pointed by the index, instead this is done only once at assign_handle
and store in packet_conn_data.
2022-06-13 10:20:33 -07:00
Marcel Holtmann
60f18a6894 mesh: Fix issue with snprintf return value check and format-truncation error 2022-06-10 19:55:13 +02:00
Michael Brudevold
3c7413f49c doc/coding-style: Update URL to kernel coding style 2022-06-09 21:12:11 -07:00
Tedd Ho-Jeong An
5ebc2b5a3e device: Fix not deleting the folder after removing the device
This patch fixes the issue not deleting the device folder when the
device is removed.
2022-06-09 20:49:36 -07:00
Luiz Augusto von Dentz
ab31e2f7e8 mgmt-tester: Fix build error
This fixes the following build error:

CC    tools/mgmt-tester.o
tools/mgmt-tester.c: In function ‘setup_command_generic’:
tools/mgmt-tester.c:7503:16: error: the comparison will always evaluate
as ‘true’ for the pointer operand in
‘(const struct setup_mgmt_cmd *)test->setup_mgmt_cmd_arr +
(sizetype)(i * 24)’ must not be NULL [-Werror=address]
 7503 |     for (; test->setup_mgmt_cmd_arr + i; ++i) {
   |        ^~~~
2022-06-02 12:00:28 -07:00
Luiz Augusto von Dentz
67b325c614 test-runner: Enable BT_HCIUART and BT_HCIUART_H4
These options are required when running with -u option since that uses
H4 headers to serialize the communication of host and guest.
2022-06-02 12:00:28 -07:00
Luiz Augusto von Dentz
7bcd32e67e test-runner: Fix not waiting for system_bus_socket
This makes test-runner wait for system_bus_socket to be available before
continuing otherwise the likes of bluetoothd would likely fail to start.
2022-06-02 12:00:28 -07:00
Joseph Hwang
93850c827d doc: Introduce the quality report command and event
Add the MGMT quality report command and event in doc/mgmt-api.txt.
2022-06-02 17:53:20 +02:00
Gopal Tiwari
5cdaeaefc3 mesh-gatt: Fix use_after_free
Following scenario happens when prov is false and we have double free as
mentioned in the below

bluez-5.64/tools/mesh-gatt/prov-db.c:847: freed_arg: "g_free" frees
"in_str".

bluez-5.64/tools/mesh-gatt/prov-db.c:867: double_free: Calling "g_free"
frees pointer "in_str" which has already been freed.
2022-05-31 13:08:58 -07:00
Gopal Tiwari
56bda20ce9 meshctl: Fix possible use_after_free
Reported by coverity tool as follows :

bluez-5.64/tools/meshctl.c:1968: freed_arg: "g_free" frees "mesh_dir".

bluez-5.64/tools/meshctl.c:2018: double_free: Calling "g_free" frees
pointer "mesh_dir" which has already been freed.
2022-05-31 13:08:57 -07:00
Gopal Tiwari
06d3c7429a pbap: Fix memory leak
Reported by coverity tool as follows:

bluez-5.64/obexd/client/pbap.c:929: leaked_storage: Variable "apparam"
going out of scope leaks the storage it points to.
2022-05-31 13:08:57 -07:00
Gopal Tiwari
39b638526d obex-client: Fix leaked_handle
While performing static tool analysis using coverity found following
reports for resouse leak

bluez-5.64/tools/obex-client-tool.c:315: leaked_handle: Handle variable
"sk" going out of scope leaks the handle.
2022-05-31 12:53:02 -07:00
Gopal Tiwari
35cbfd9660 mesh/mesh-db: Fix resource leaks
While performing static tool analysis using coverity found following
reports for resouse leak

bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_handle: Handle variable
"fd" going out of scope leaks the handle.

bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_storage: Variable "str"
going out of scope leaks the storage it points to.
2022-05-31 12:52:28 -07:00
Gopal Tiwari
4334be027a l2cap-tester: Fix leaked_handle
While performing static tool analysis using coverity found following
reports for resouse leak

bluez-5.64/tools/l2cap-tester.c:1712: leaked_handle: Handle variable
"new_sk" going out of scope leaks the handle.
2022-05-31 12:52:08 -07:00
Gopal Tiwari
4ae130455b create-image: Fix leaked_handle
While performing static tool analysis using coverity found following
reports for resouse leak

bluez-5.64/tools/create-image.c:124: leaked_storage: Variable "map"
going out of scope leaks the storage it points to.
2022-05-31 12:51:45 -07:00
Gopal Tiwari
f4743109f3 cltest: Fix leaked_handle
While performing static tool analysis using coverity found
following reports for resouse leak

bluez-5.64/tools/cltest.c:75: leaked_handle: Handle variable "fd"
going out of scope leaks the handle.
2022-05-31 12:51:19 -07:00
Gopal Tiwari
fc57aa92a4 sixaxis: Fix memory leaks
While performing static tool analysis using coverity
found following reports for resouse leak

bluez-5.64/plugins/sixaxis.c:425: alloc_arg:
"get_pairing_type_for_device" allocates memory that is
stored into "sysfs_path".

bluez-5.64/plugins/sixaxis.c:428: leaked_storage: Variable "sysfs_path"
going out of scope leaks the storage it points to.
2022-05-31 12:50:38 -07:00
Gopal Tiwari
6f02010ce0 monitor: Fix memory leaks
While performing static tool analysis using coverity
found following reports for resouse leak

bluez-5.64/monitor/jlink.c:111: leaked_storage: Variable "so"
going out of scope leaks the storage it points to.

bluez-5.64/monitor/jlink.c:113: leaked_storage: Variable "so"
going out of scope leaks the storage it points to.
2022-05-31 12:50:08 -07:00
Gopal Tiwari
5eb96b3ec8 mesh/appkey: Fix memory leaks
While performing the static analysis using the coverity tool found
following memory leak reports

bluez-5.64/mesh/appkey.c:143: leaked_storage: Variable "key" going
out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/mesh/appkey.c:146: leaked_storage: Variable "key" going
out of scope leaks the storage it points to.
2022-05-31 12:49:29 -07:00
Gopal Tiwari
b4233bca18 client/gatt: Fix memory leak issues
While performing the static tool analysis using coverity tool
found following reports

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:1531: leaked_storage: Variable "service"
going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:2626: leaked_storage: Variable "chrc"
going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:2906: leaked_storage: Variable "desc"
going out of scope leaks the storage it points to.
2022-05-31 12:48:33 -07:00
Luiz Augusto von Dentz
21f65f7b2f monitor/att: Add decoding support for ASE Control Point
This adds decoding support for ASE Control Point attribute:

> ACL Data RX: Handle 42 flags 0x02 dlen 30
      Channel: 64 len 26 sdu 24 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
      ATT: Write Command (0x52) len 23
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 010103020206000000000a02010302020103042800
            Opcode: Codec Configuration (0x01)
            Number of ASE(s): 1
            ASE: #0
            ASE ID: 0x03
            Target Latency: Balance Latency/Reliability (0x02)
            PHY: 0x02
            LE 2M PHY (0x02)
            Codec: LC3 (0x06)
            Codec Specific Configuration #0: len 0x02 type 0x01
            Codec Specific Configuration: 03
            Codec Specific Configuration #1: len 0x02 type 0x02
            Codec Specific Configuration: 01
            Codec Specific Configuration #2: len 0x03 type 0x04
            Codec Specific Configuration: 2800
< ACL Data TX: Handle 42 flags 0x00 dlen 55
      Channel: 64 len 51 sdu 49 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 48
        Length: 0x0005
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 0101030000
            Opcode: Codec Configuration (0x01)
            Number of ASE(s): 1
            ASE: #0
            ASE ID: 0x03
            ASE Response Code: Success (0x00)
            ASE Response Reason: None (0x00)
> ACL Data RX: Handle 42 flags 0x02 dlen 27
      Channel: 64 len 23 sdu 21 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
      ATT: Write Command (0x52) len 20
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 020103000010270000022800020a00409c00
            Opcode: QoS Configuration (0x02)
            Number of ASE(s): 1
            ASE: #0
            ASE ID: 0x03
            CIG ID: 0x00
            CIS ID: 0x00
            SDU Interval: 10000 usec
            Framing: Unframed (0x00)
            PHY: 0x02
            LE 2M PHY (0x02)
            Max SDU: 40
            RTN: 2
            Max Transport Latency: 10
            Presentation Delay: 40000 us
< ACL Data TX: Handle 42 flags 0x00 dlen 37
      Channel: 64 len 33 sdu 31 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 30
        Length: 0x0005
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 0201030000
            Opcode: QoS Configuration (0x02)
            Number of ASE(s): 1
            ASE: #0
            ASE ID: 0x03
            ASE Response Code: Success (0x00)
            ASE Response Reason: None (0x00)
> ACL Data RX: Handle 42 flags 0x02 dlen 17
      Channel: 64 len 13 sdu 11 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
      ATT: Write Command (0x52) len 10
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 0301030403020200
            Opcode: Enable (0x03)
            Number of ASE(s): 1
            ASE: #0
            ASE ID: 0x03
            Metadata #0: len 0x03 type 0x02
            Metadata: 0200
< ACL Data TX: Handle 42 flags 0x00 dlen 33
      Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 26
        Length: 0x0005
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 0301030000
            Opcode: Enable (0x03)
            Number of ASE(s): 1
            ASE: #0
            ASE ID: 0x03
            ASE Response Code: Success (0x00)
            ASE Response Reason: None (0x00)
> ACL Data RX: Handle 42 flags 0x02 dlen 12
      Channel: 64 len 8 sdu 6 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Write Command (0x52) len 5
        Handle: 0x0030 Type: ASE Control Point (0x2bc6)
          Data: 050101
            Opcode: Disable (0x05)
            Number of ASE(s): 1
2022-05-26 13:57:51 -07:00
Luiz Augusto von Dentz
ba32b25a61 monitor/att: Add decoding support for ASE Sink/Source
This adds decoding support for ASE Sink/Source attributes:

> ACL Data RX: Handle 42 flags 0x02 dlen 9
      Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Read Request (0x0a) len 2
        Handle: 0x002a Type: Sink ASE (0x2bc4)
< ACL Data TX: Handle 42 flags 0x00 dlen 9
      Channel: 64 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Read Response (0x0b) len 2
        Value: 0300
            ASE ID: 1
            State: Idle (0x00)
< ACL Data TX: Handle 42 flags 0x00 dlen 55
      Channel: 64 len 51 sdu 49 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 48
        Length: 0x0023
        Handle: 0x0024 Type: Sink ASE (0x2bc4)
          Data: 01010000000a00204e00409c00204e00409c0006000000000a02010302020103042800
            ASE ID: 1
            State: Codec Configured (0x01)
            Framing: Unframed PDUs supported (0x00)
            PHY: 0x00
            RTN: 0
            Max Transport Latency: 10
            Presentation Delay Min: 20000 us
            Presentation Delay Max: 40000 us
            Preferred Presentation Delay Min: 20000 us
            Preferred Presentation Delay Max: 40000 us
            Codec: LC3 (0x06)
            Codec Specific Configuration #0: len 0x02 type 0x01
            Codec Specific Configuration: 03
            Codec Specific Configuration #1: len 0x02 type 0x02
            Codec Specific Configuration: 01
            Codec Specific Configuration #2: len 0x03 type 0x04
            Codec Specific Configuration: 2800
< ACL Data TX: Handle 42 flags 0x00 dlen 37
      Channel: 64 len 33 sdu 31 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 30
        Length: 0x0011
        Handle: 0x0024 Type: Sink ASE (0x2bc4)
          Data: 0102000010270000022800020a00409c00
            ASE ID: 1
            State: QoS Configured (0x02)
            CIG ID: 0x00
            CIS ID: 0x00
            SDU Interval: 10000 usec
            Framing: Unframed (0x00)
            PHY: 0x02
            LE 2M PHY (0x02)
            Max SDU: 40
            RTN: 2
            Max Transport Latency: 10
            Presentation Delay: 40000 us
< ACL Data TX: Handle 42 flags 0x00 dlen 33
      Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 26
        Length: 0x000d
        Handle: 0x002a Type: Source ASE (0x2bc5)
          Data: 03030000060304030202000000
            ASE ID: 3
            State: Enabling (0x03)
            CIG ID: 0x00
            CIS ID: 0x00
            Metadata #0: len 0x03 type 0x04
            Metadata: 0302
            Metadata #1: len 0x02 type 0x00
< ACL Data TX: Handle 42 flags 0x00 dlen 39
      Channel: 64 len 35 sdu 33 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 32
        Length: 0x000d
        Handle: 0x002a Type: Source ASE (0x2bc5)
          Data: 03040000060304030202000000
            ASE ID: 3
            State: Streaming (0x04)
            CIG ID: 0x00
            CIS ID: 0x00
            Metadata #0: len 0x03 type 0x04
            Metadata: 0302
            Metadata #1: len 0x02 type 0x00
< ACL Data TX: Handle 42 flags 0x00 dlen 33
      Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 26
        Length: 0x000d
        Handle: 0x002a Type: Source ASE (0x2bc5)
          Data: 03050000060304030202000000
            ASE ID: 3
            State: Disabling (0x05)
            CIG ID: 0x00
            CIS ID: 0x00
            Metadata #0: len 0x03 type 0x04
            Metadata: 0302
            Metadata #1: len 0x02 type 0x00
2022-05-26 13:57:50 -07:00
Luiz Augusto von Dentz
13bdb9f3be monitor/att: Add decoding support for PAC Sink/Source
This adds decoding support for PAC Sink/Source attributes:

 < ACL Data TX: Handle 42 flags 0x00 dlen 9
      Channel: 64 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)]
      {chan 0}
      ATT: Read Request (0x0a) len 2
        Handle: 0x0017 Type: Sink PAC (0x2bc9)
> ACL Data RX: Handle 42 flags 0x02 dlen 31
      Channel: 65 len 27 sdu 25 [PSM 39 mode Enhanced Credit (0x81)]
      {chan 0}
        Value: 010600000000100301ff0002020302030305041e00f00000
          Number of PAC(s): 1
          PAC #0:
            Codec: LC3 (0x06)
            Codec Specific Configuration #0: len 0x03 type 0x01
            Codec Specific Configuration: ff00
            Codec Specific Configuration #1: len 0x02 type 0x02
            Codec Specific Configuration: 03
            Codec Specific Configuration #2: len 0x02 type 0x03
            Codec Specific Configuration: 03
            Codec Specific Configuration #3: len 0x05 type 0x04
            Codec Specific Configuration: 1e00f000
2022-05-26 13:57:48 -07:00
Luiz Augusto von Dentz
53c28e3d86 monitor/att: Simplify CCC decoders
This simplify callbacks moving the decoding of the value to
print_ccc_value.
2022-05-26 13:57:48 -07:00
Luiz Augusto von Dentz
1ffd74a6d4 monitor/att: Fix parsing of notifications
If there are multiple notifications in the same frame the callback may
alter it when using l2cap_frame_pull helpers, so instead this passes a
cloned frame with just the expected length so callbacks cannot alter
original frame.
2022-05-25 12:52:19 -07:00
Luiz Augusto von Dentz
2894f1392f monitor/att: Attempt to reload if database is empty
If database is empty attempt to reload since the daemon may have
updated its cache in the meantime.
2022-05-25 12:47:10 -07:00
Inga Stotland
79fe529d64 client: Fix setting of advertisement interval
This fixes incorrect argument read when using "interval" command
in "advertisement" submenu
2022-05-23 13:47:15 -07:00
Luiz Augusto von Dentz
bbdd18089b monitor/att: Fix parsing of Notify Mutiple
Notify Multiple was parsing handle multiple times causing the length to
be assumed to be a handle.
2022-05-20 17:23:09 -07:00
Luiz Augusto von Dentz
8e1fd164a7 monitor/att: Fix not matching read frame direction
There could be read frames pending on both direction so this ensures
the direction is matched properly.
2022-05-20 17:23:09 -07:00
Luiz Augusto von Dentz
20e944ece7 monitor/att: Fix treating Notification/Indication as a request
Notification/Indication shall be treated as response so the correct
database is used.
2022-05-20 17:23:08 -07:00
Luiz Augusto von Dentz
eb47cb5a04 monitor/att: Fix not removing read from queue
The code was using queue_find instead of queue_remove_if so follow up
read wouldn't match the attribute properly.
2022-05-20 17:23:08 -07:00
Luiz Augusto von Dentz
f1069c4fe1 gatt-server: Fix crash while disconnecting
If there is a pending notify multiple the code was not removing before
freeing the object causing the following crash:

Invalid read of size 8
   at 0x4A3D10: notify_multiple (gatt-server.c:1703)
   by 0x4D05F0: timeout_callback (timeout-glib.c:25)
   by 0x4956900: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49560AE: g_main_context_dispatch
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49AB307: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49557C2: g_main_loop_run
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x4D0A34: mainloop_run (mainloop-glib.c:66)
   by 0x4D0F2B: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x2B0CD1: main (main.c:1276)
 Address 0x6ca35c8 is 136 bytes inside a block of size 144 free'd
   at 0x48470E4: free (vg_replace_malloc.c:872)
   by 0x415E73: gatt_server_cleanup (device.c:698)
   by 0x415E73: attio_cleanup (device.c:715)
   by 0x47745B: queue_foreach (queue.c:207)
   by 0x490C54: disconnect_cb (att.c:701)
   by 0x4CF4AF: watch_callback (io-glib.c:157)
   by 0x49560AE: g_main_context_dispatch
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49AB307: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x49557C2: g_main_loop_run
   (in /usr/lib64/libglib-2.0.so.0.7000.5)
   by 0x4D0A34: mainloop_run (mainloop-glib.c:66)
   by 0x4D0F2B: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x2B0CD1: main (main.c:1276)
2022-05-20 14:14:24 -07:00
Luiz Augusto von Dentz
bd6b90595e monitor/att: Add decoding support for CCC
This adds decoding support for CCC so its value can be decoded:

< ACL Data TX: Handle 3585 flags 0x00 dlen 7
      ATT: Read Request (0x0a) len 2
        Handle: 0x002c Type: Client Characteristic Configuration (0x2902)
> ACL Data RX: Handle 3585 flags 0x02 dlen 6
      ATT: Read Response (0x0b) len 1
        Value: 01
            Notification (0x01)
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
      ATT: Write Request (0x12) len 4
        Handle: 0x002c Type: Client Characteristic Configuration (0x2902)
          Data: 0100
            Notification (0x01)
2022-05-19 17:54:16 -07:00
Luiz Augusto von Dentz
0bd5350459 monitor/att: Decode attribute type
This attempt to decode the attribute type if its gatt_db can be loaded:

< ACL Data TX: Handle 3585 flags 0x00 dlen 9
      ATT: Write Request (0x12) len 4
        Handle: 0x000b Type: Client Characteristic Configuration (0x2902)
          Data: 0200
2022-05-18 15:35:49 -07:00
Luiz Augusto von Dentz
1cf5ceeef3 monitor: Cache connection information
This caches connection information including the device addres so it can
be printed alongside the handle:

> HCI Event: Disconnect Complete (0x05) plen 4
        Status: Success (0x00)
        Handle: 3585 Address: 68:79:12:XX:XX:XX (OUI 68-79-12)
        Reason: Connection Terminated By Local Host (0x16)
2022-05-18 15:35:49 -07:00
Luiz Augusto von Dentz
5efc737f49 monitor: Move ATT decoding function into its own file
This moves ATT decoding function from l2cap.c to att.c.
2022-05-18 15:35:47 -07:00
Luiz Augusto von Dentz
0247ed333e monitor: Move print_hex_field to display.h
This moves print_hex_field to display.h and removes the duplicated code
from packet.c and l2cap.c.
2022-05-18 15:35:46 -07:00
Luiz Augusto von Dentz
f66673878a gatt: Store local GATT database
This enables storing the local (adapter) GATT database which later will
be used by btmon to decode GATT handles.
2022-05-18 15:35:46 -07:00
Luiz Augusto von Dentz
02017e320b settings: Add btd_settings_gatt_db_{store,load}
This adds helper functions to store and load from/to file so they can
get reused by the likes of gatt-database.c and btmon.
2022-05-18 15:35:45 -07:00
Archie Pusaka
c159d790e8 input/device: Notify failure if ctrl disconnect when waiting intr
On some rare occasions, the peer HID device might disconnect the ctrl
channel when we are trying to connect the intr channel. If this
happens, interrupt_connect_cb() will not be called by btio, and we
will be stuck in "connecting" state. Any future connection attempt to
the peer device will fail because of "busy".

This patch prevents that by checking if we need to report connection
failure when the ctrl channel is disconnected.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
2022-05-18 15:19:43 -07:00
Luiz Augusto von Dentz
c7955b2099 hog-lib: Fix not reading report_map of instances
If there is multiple instances the gatt_db of the instances was not
initialized causing the report_map_attr to be NULL which prevents the
report_map to be read and uhid device to be created.

Fixes: https://github.com/bluez/bluez/issues/298
2022-05-12 18:04:20 -07:00
Luiz Augusto von Dentz
7a4b67f9ca device: Fix enabling wake support without RPA Resolution
If device uses RPA it shall only enable wakeup if RPA Resolution has
been enabled otherwise it cannot be programmed in the acceptlist which
can cause suspend to fail.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215768
2022-05-12 16:58:52 -07:00
Luiz Augusto von Dentz
83497bbb30 gatt-db: Allow passing Characteristic Value to gatt_db_attribute_get_char_data
This makes gatt_db_attribute_get_char_data work with Characteristic
Value rather than only with Characteristic Declaration.
2022-05-12 16:56:25 -07:00
Luiz Augusto von Dentz
cd24715bb2 service: Add initiator argument to service_accept
This adds initiator argument to service_accept so profiles accepting
the connection can use btd_service_is_initiator to determine if the
connection was initiated locally (central) or remotely (peripheral).
2022-05-12 16:56:18 -07:00
wangyouwan
4423d63a96 device: Fix pairing has failed due to the error of Already Paired (0x13)
After connect the Bluetooth mouse, open two Bluetoothctl at the same time,
when remove the mouse, quickly go to power off,
try to paired the mouse again when I was power on,
found that the error 0x13 was always reported.
try to connect directly,can connect successfully.
but use the info command to query the information of the mouse
and find that the pairing status of the mouse is No.
so I try to delete the paired information in the kernel
through the "* cancel_pairing()" interface.
2022-05-11 14:34:53 -07:00
Ildar Kamaletdinov
42e9b8db92 device: Fix uninitialized value usage
Definitely `dbus_bool_t b;` must be initialized before comparing it
with current value.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
2022-05-09 13:05:39 -07:00
Ildar Kamaletdinov
e9ec1cf871 tools: Fix handle leak in rfcomm
Some branches of execution can make handle (socket) leakage.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
2022-05-09 13:05:38 -07:00
Ildar Kamaletdinov
a4741ef4bf tools: Fix memory leaks in btgatt-server/client
According to man buffer allocated by getline() should be freed by
the user program even if getline() failed.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
2022-05-09 13:05:38 -07:00
Ildar Kamaletdinov
efa9005093 tools: Fix memory leak in hciconfig
printf() was using function that return dynamic allocated memory as
a parameter.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
2022-05-09 13:05:38 -07:00
Luiz Augusto von Dentz
f0106d92a1 advertising: Treat empty LocalName the same as omitting it
This treats empty LocalName ("") the same as omitting it so not name is
set in the advertising data since some D-Bus binding seems to have
problems to omit properties at runtime.

Fixes: https://github.com/bluez/bluez/issues/337
2022-05-06 16:05:14 -07:00