Commit Graph

104 Commits

Author SHA1 Message Date
Andrzej Kaczmarek
1a4cb1a207 emulator/bthost: Add support to set auth_req for bthost
This patch makes possible to set Authentication_Requirements to be used
in io_capa_request_reply when replying for io_capa_request_evt.
2014-05-19 14:14:14 +03:00
Johan Hedberg
01095e7774 emulator/bthost: Set advertising parameters before enabling advertising 2014-03-14 12:51:12 +02:00
Marcel Holtmann
d1c6a543c7 monitor: Use 64-bit unsigned integer for random number 2014-02-27 14:37:41 -08:00
Marcin Kraglak
f79a9e3b44 emulator/bthost: Fix command queue
Now new commands will be pushed to tail. Queue will be consumed
from head, firstly added commands will be sent. It repairs this
warning from android-tester:
==20561== 1,904 bytes in 7 blocks are definitely
lost in loss record 30 of 31
==20561==    at 0x4006AB1: malloc (in /usr/lib/valgrind/
vgpreload_memcheck-x86-linux.so)
==20561==    by 0x8050293: send_command (bthost.c:389)
==20561==    by 0x80543E1: start_stack (hciemu.c:299)
==20561==    by 0x41043D00: ??? (in /usr/lib/libglib-2.0.so.0.3600.4)
==20561==    by 0x410470E5: g_main_context_dispatch (in
/usr/lib/libglib-2.0.so.0.3600.4)
==20561==    by 0x41047497: ??? (in
/usr/lib/libglib-2.0.so.0.3600.4)
==20561==    by 0x41047912: g_main_loop_run (in
/usr/lib/libglib-2.0.so.0.3600.4)
==20561==    by 0x8055870: tester_run (tester.c:798)
==20561==    by 0x804B980: main (android-tester.c:3984)
2014-02-19 17:22:05 +02:00
Johan Hedberg
dd78814e7f tools/bthost: Fix RFCOMM channel variable type 2014-02-19 15:11:08 +02:00
Johan Hedberg
4ead1cb1ec emulator/bthost: Rename rfcomm_channel to rfcomm_chan for shorter symbol names 2014-02-19 15:09:34 +02:00
Marcin Kraglak
e157b7f28e emulator/bthost: Add function to send RFCOMM UIH frames from bthost
This will make RFCOMM UIH frame and fill with data passed by user.
It also adds bthost internal tracking of RFCOMM connections to store
cid and channel - user have to pass only conenction handle and channel.
2014-02-19 15:03:27 +02:00
Marcin Kraglak
f5e82813af emulator/bthost: Add api to handle RFCOMM data on bthost
With this change user can handle data received on RFCOMM connection.
2014-02-19 15:00:20 +02:00
Marcin Kraglak
68e94df753 emulator/bthost: Check length of received RFCOMM UIH frames
Add correct calculation of frame length. If frame is too short, ignore it.
2014-02-17 15:49:22 +02:00
Marcin Kraglak
8e9e005aa0 emulator/bthost: Check length of received RFCOMM UA frames
Check length of RFCOMM UA frames and ignore if frame is too short.
2014-02-17 14:31:20 +02:00
Marcin Kraglak
be3841b10d emulator/bthost: Check length of received RFCOMM DM frames
Ignore too short received RFCOMM DM frames.
2014-02-17 14:31:18 +02:00
Marcin Kraglak
fba18071c6 emulator/bthost: Check length of received RFCOMM DISC frame
Don't access rfcomm_hdr struct and ignore if frame is too short.
2014-02-17 14:31:16 +02:00
Marcin Kraglak
b2b4716b3c emulator/bthost: Check length of received RFCOMM SABM frame
This will check length of received SABM frame. Ignore frame if
it is too short.
2014-02-17 14:31:14 +02:00
Anderson Lizardo
64bc96534b emulator: Fix crash if socket(AF_ALG) is not supported by the kernel
In this situation, smp_stop() was being called with NULL pointer.

Crash detected by valgrind:

==7925== Invalid read of size 4
==7925==    at 0x8052F18: smp_stop (smp.c:480)
==7925==    by 0x8052542: bthost_stop (bthost.c:2073)
==7925==    by 0x805521D: hciemu_unref (hciemu.c:372)
==7925==    by 0x8058C65: test_post_teardown (android-tester.c:464)
==7925==    by 0x8055DE7: tester_teardown_complete (tester.c:533)
==7925==    by 0x8055501: teardown_callback (tester.c:312)
==7925==    by 0x408348F: g_idle_dispatch (gmain.c:5250)
==7925==    by 0x4086A75: g_main_context_dispatch (gmain.c:3065)
==7925==    by 0x4086E14: g_main_context_iterate.isra.23 (gmain.c:3712)
==7925==    by 0x40872FA: g_main_loop_run (gmain.c:3906)
==7925==    by 0x41744D2: (below main) (libc-start.c:226)
==7925==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
2014-01-27 09:59:28 -08:00
Johan Hedberg
35b50f0f34 emulator/bthost: Add dummy entries for LTK reply completion 2014-01-20 16:28:03 +02:00
Johan Hedberg
f3db25a05b emulator/bthost: Add SMP callback to fetch LTK 2014-01-20 16:28:03 +02:00
Johan Hedberg
741d28de64 emulator/bthost: Add warning for unsupported LE Meta events 2014-01-20 16:27:57 +02:00
Johan Hedberg
fb922ee610 emulator/bthost: Add SMP support 2014-01-20 16:26:33 +02:00
Johan Hedberg
2688bf5c6e emulator/bthost: Add dummy handler for User Confirm Request Reply completion 2014-01-20 13:14:28 +02:00
Johan Hedberg
23b2191c07 emulator/bthost: Remove unnecessary printf 2014-01-17 15:29:31 +02:00
Johan Hedberg
dee79b4635 emulator/bthost: More RFCOMM code cleanups 2014-01-16 12:23:16 +02:00
Johan Hedberg
d11ac83a18 emulator/bthost: Further cleanups to the RFCOMM code 2014-01-16 12:23:15 +02:00
Johan Hedberg
bce8cc0159 emulator/bthost: Clean up RFCOMM related code 2014-01-16 12:23:15 +02:00
Johan Hedberg
a48b49121f tools/bthost: Remove useless channel parameter from RFCOMM callback 2014-01-16 12:23:15 +02:00
Marcin Kraglak
c64b9baa99 emulator/bthost: Call rfcomm_connect_cb when connected
This will call connect callback when connected or failed to connect.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
37a1b0fa3d emulator/bthost: Add implementation to PN RSP
This will send sabm command if PN_RSP will be received.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
287c075913 emulator/bthost: Ad implementation of rfcomm_ua_recv
This will handle ua responses in bthost.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
90fd2a2f98 emulator/bthost: Implement bthost_connect_rfcomm
This method will start L2CAP connection on RFCOMM PSM and continue
connecting to rfcomm server. User can specify callback to be called
after connection.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
3fbe314714 emulator/bthost: Implement recv_disc rfcomm frame in bthost 2014-01-16 12:23:15 +02:00
Marcin Kraglak
662c19903f emulator/bthost: Service msc frames 2014-01-16 12:23:15 +02:00
Marcin Kraglak
f167df0e3a emulator/bthost: Add recv_pn implementation 2014-01-16 12:23:15 +02:00
Marcin Kraglak
cbc1720d4f emulator/bthost: Add rfcomm_mcc_recv stub
It will handle mcc frames in bthost.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
983ecc30e4 emulator/bthost: Add recv_sabm imnplementation
This will handle sabm frames and send ua or dm frame.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
75c7ab2d99 emulator/bthost: Add method to create rfcomm server
It allows user to create rfcomm server on bthost.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
0c27ca7f45 emulator/bthost: Add initial rfcomm handling
This is initial rfcomm handling in bthost.
2014-01-16 12:23:15 +02:00
Johan Hedberg
3c08f44715 emulator/bthost: Fix requesting encryption if authentication failed 2014-01-15 14:38:04 +02:00
Johan Hedberg
f072c7573b emulator/bthost: Add API to request authentication 2014-01-15 14:34:01 +02:00
Johan Hedberg
7dfc7e9614 emulator/bthost: Add basic support for link key requests 2014-01-15 14:33:38 +02:00
Johan Hedberg
27d79b3a73 emulator/bthost: Add API to reject SSP User Confirmation 2014-01-13 14:29:06 +02:00
Johan Hedberg
0903fa12a5 emulator/bthost: Add support for specifying custom IO capability 2014-01-13 13:23:45 +02:00
Marcin Kraglak
62041e0a4d emulator/bthost: Fix sending L2CAP config req
Send L2CAP config request with correct dcid field. It worked
well only if scid and dcid of L2CAP connection were the same.
2014-01-13 13:05:44 +02:00
Johan Hedberg
f881e165ec emulator/bthost: Request encryption when authentication completes 2014-01-13 12:58:16 +02:00
Marcel Holtmann
e90a074333 emulator: Make use of generic endian conversion macros 2014-01-10 13:05:23 -08:00
Johan Hedberg
cee10685ae emulator/bthost: Add basic handling of user confirm request and SSP complete events 2014-01-10 16:05:08 +02:00
Johan Hedberg
0143a51c32 emulator: Add dummy cmd complete handler for IO Capability Request Reply 2014-01-10 16:05:07 +02:00
Johan Hedberg
9980744cd4 emulator/bthost: Add basic IO Capability Request & Response handling 2014-01-10 16:05:07 +02:00
Johan Hedberg
bc3b7427cf tools/bthost: Add dummy handler for HCI_Write_SSP_Mode completion 2014-01-10 16:05:06 +02:00
Johan Hedberg
262ee6bd02 emulator/bthost: Track remote address in btconn 2014-01-10 16:05:06 +02:00
Johan Hedberg
12d51b2ed1 emulator/bthost: Add support for enabling SSP mode 2014-01-10 16:05:05 +02:00
Johan Hedberg
4cd914bd4f emulator/bthost: Add dummy handler for Authentication Complete HCI event 2014-01-08 16:37:34 +02:00