Commit graph

18591 commits

Author SHA1 Message Date
Johan Hedberg
b748f87243 Bluetooth: Simplify duplicate filtering tracking
Change-Id: If797c382eed87fc2c2a54a94bc1fa6ec5dad1914
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
8b5bb4dbf9 Bluetooth: Split implicit (background) and explicit scan functions
For background/implicit/reconnection scanning we have fixed internal
parameters that we want to use. For explicit scanning on the other
hand the parameters come from the application. It makes therefore
sense to split the functions responsible for starting each scanning
type.

Change-Id: I0e89a1ce89aca61870f789c7f1e5ad81f97cd00e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
9862a25584 Bluetooth: Disallow outgoing LE connections during explicit scan
The explicit scan API should be thought of as the user taking control
of the scanning policy. In this case the stack shouldn't try to
second-guess and create connections in between.

Change-Id: I47cc5d70660706d6657deac50aa0619cbe4bf727
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
6df50d474e Bluetooth: Create dedicated flag for explicit scanning
Change-Id: I0d7548c755a277e7741cf0b3a1b97e127ea1d382
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
93af450977 Bluetooth: Group bt_dev flags more sensibly
Change-Id: I03399604fb95d4856d8e4b4141bce508d6b2558f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
dd353487c4 Bluetooth: Create active scanning helper macro
All current user just want basic active scanning so a corresponding
macro makes more sense than something based on duplicate filtering.

Change-Id: I97787be24b89fad66f2a952c5d53ab76f4e062fb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Mariusz Skamra
59719970cc Bluetooth: tester: Increase BTP_MTU size
Current MTU size was not sufficient to test GATT Client, where lower
tester requires to send data of length 512 +opcode +BT address.
This exceeds current BTP_MTU size.

Change-Id: I090c47975ecfe9a657d6ff1158b5dc764c8a78a1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
38b5be06a7 Bluetooth: samples/central: Use consistent scan type
Both places in the central app that enable scanning should do
duplicate filtering.

Change-Id: If7086667c78878355dc246aa3d0b5ebcbdd0ac7b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz
095da440cd Bluetooth: GATT: Make use of BT_UUID_DECLARE_16
This uses BT_UUID_DECLARE_16 in macros that can only be of 16 bits
format.

Change-Id: I45d4bcca9859a2e279b1199546891df75a039589
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz
2cd5f53d86 Bluetooth: UUID: Add macros to declare 16 and 128 bits UUIDS
This makes it easier to declare 16 and 128 bits UUIDS and also save space
in case of 16 bits.

Change-Id: I5790afd9504ee0cca4a951be6bc542685d0a35fb
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
f5a238b665 Bluetooth: Add ability to specify dedicated LE advertising parameters
We'll need to have a much more flexible LE advertising API. This is a
first step in that direction. A convenience BT_LE_ADV() macro is
provided to ease converting application code.

Change-Id: I74854487bbdfb4b1cf1bee0b6351d1750a56ff86
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
6f470dcbce Bluetooth: Add ability to specify dedicated LE scan parameters
We'll need to have a much more flexible LE scanning API. This is a
first step towards it. The existing BT_LE_SCAN_FILTER_DUP_* enum
values are converted to macros to avoid having to update application
code at this point.

Change-Id: I0c8d29dc156bad67cddc9401c0d72aee8ec6d8de
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
52989aeecc Bluetooth: Move bt_le_scan_cb_t definition to better place
Change-Id: I9b17d2237654e651465d054f60f6c4e44576250b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
055cc491c9 Bluetooth: Add missing check for advertising in bt_le_adv_start()
The function cannot do what it's intended to do if we're already
advertising.

Change-Id: I3dabb24591f655c5faf48da9395e826b2b61cfe9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Szymon Janc
70ed77861e Bluetooth: SMP: Fix LE SC JustWorks pairing as slave
In JustWorks/PasskeyConfirmation pairing slave doesn't check remote
confirmation value (as it doesn't receive one). Factor out confirmation
check to helper and use it only when needed. This keeps code easy to
understand.

Change-Id: Ifb31bc3f2b53586a9c92b29b01e9832c124b0951
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:00 -05:00
Szymon Janc
d9322c58d5 Bluetooth: SMP: Fix LE SC Passkey Confirmation on Big Endian
Issue causing crash is already fixed so now proper BE to cpu convertion
can be used.

Change-Id: If07ed6f3b342b9e6a58e62c9a6f5fee9bc11133a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
f1d4b686b6 Bluetooth: Rename bt_bredr_* prefix to bt_br_*
bt_br_* is equally understandable and the same length as the
corresponding bt_le_* prefix on the LE side.

Change-Id: I1820f9b9fab6363b696072f6b70d57c0bc780078
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg
5619d1114b Bluetooth: Rename LE scan & advertising APIs for consistency
To have a clear split between LE & BR/EDR rename these APIs with the
appropriate prefixes.

Change-Id: I983df2b5880947d96f0ad289d12f3383f44894be
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Mariusz Skamra
65e917c9ab Bluetooth: GATT: Fix calculation of max data allowed in write req
This patch fixes the calculation of maximum data that can be sent
by Write Request.
Maximum data is MTU reduced by size of handle and command opcode.

Change-Id: I2abeef9adffd65e24a2489ad084bfa3b810e4acf
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:00 -05:00
Mariusz Skamra
6e28748e3e Bluetooth: GATT: Minor fix in warning message
This patch fixes warning that ATT MTU exceeded. An opcode size should
be taken into account.

Change-Id: Ia69c9514a59767542cca0ef36fc77d896d20db28
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz
962462629e Bluetooth: Fix scan data of IPSP Application
The data length was incorrect which caused the name to be truncated.

Change-Id: Ieaca7745fff89f0f5689b6d15bfc0386f59add47
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz
c3fde0020d Bluetooth: Make IPSP Application use blocking version of bt_enable
For test purpose pass NULL to bt_enable so it blocks until init
sequence is complete.

Change-Id: I875ff9a59bb3d1d2e799db6fc967da3aee3ac77a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz
21fc28e8f8 Bluetooth: Add IPSP application to sanitycheck
Change-Id: Ib64f9e4d3f1d6a7f6d1cd1e18f88303b70e0dd91
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz
e6784925bd net: Fix include path of fragmentation.h in null_fragmentation.h
This is a left over of 41edeffb721b4b00321ee5ff1777adc69009fe6d which
attempted to fix the include path of contiki sources but apparently
missed null_fragmentation.h.

Change-Id: I42bf1ee2e8b4809c1bb623c73279ea1146ddeeae
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Szymon Janc
798227dfa0 Bluetooth: SMP: Add support for Passkey Entry in LE SC
This allows to request user to input passkey displayed on remote
device when LE SC connection are used. Since similar method was
already present in legacy pairing no new public API is required.

Change-Id: I331647d5442e65162d25bbdd37ceb8b1ed841fc6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:00 -05:00
Szymon Janc
ebdb834a6a Bluetooth: SMP: Add support for Passkey Display in LE SC
When Passkey Entry protocol is used for LE SC and device has
display capabilities random passkey is generated and displayed
to user.

Passkey Entry is different that Passkey Confirm due to common
secret (entered passkey) being injected at begining of pairing.
After that 20 passkey rounds are performed to disclose passkey.
This "gradual disclosure" prevents leakage of more than 1 bit of
un-guessed Passkey information in the case of a MITM attack.
Due to 20 rounds of confirm-random PDU exchange this pairing
method takes more time comparing to JustWorks or Passkey Comparison.

Since similar method was already present in legacy pairing no new
public API is required.

Change-Id: Ibb36320dc751e4fae43aa8c08ca57a2a984bf491
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:00 -05:00
Szymon Janc
637695a476 Bluetooth: SMP: Reduce number of used flags
SMP_FLAG_TK_VALID and SMP_FLAG_USER_CONFIRM flags can be replaced
by single flag that express 'waiting for user input'. This makes
code simpler and easier to follow. Same flag will be used for
passkey entry pairing.

Change-Id: Icb857b07e3f5db1ef870cb4bc09a5f5d9efbca6a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:00 -05:00
Szymon Janc
5e3eea6b0e Bluetooth: SMP: Refactor to prepare for LE SC Passkey Entry
This prepares code for introducing more pairing methods for LE SC.
Changes in following patches will be easier to review.

Change-Id: I59ea283c4dcf8537808ddf71a63df7c6ca34a5f6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:00 -05:00
Arkadiusz Lichwa
66f9b8dc22 Bluetooth: BR/EDR: Add SCAN functionality to shell app
Enables in bt shell commands to verify available SCAN API.

Change-Id: Ie5a50ee6ecb875b56260bec7c5bbaa0482bd69e0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:00 -05:00
Arkadiusz Lichwa
a8d187d5aa Bluetooth: BR/EDR: Enable BLUETOOTH_BREDR option in shell app
Enables CONFIG_BLUETOOTH_BREDR option by default for bt shell app.

Change-Id: I94bca76f4c55ccccb61a3c868cbc6922f553f1f0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:00 -05:00
Arkadiusz Lichwa
1b66376a61 Bluetooth: Fix misused forward declaration
Instead of struct forward declaration there should be used
struct type with at least empty body.
Otherwise compiler doesn't know the size of variable of that type
used later and emits error.

Change-Id: Ie0643ed92b8eb95c1d55c9295117a2a9b8cc95cc
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:59 -05:00
Arkadiusz Lichwa
2ebf636fe2 Bluetooth: BR/EDR: Add basic SCAN support
Adds capability to stack to make controller discoverable and
connectable.

Change-Id: Iffe380d2bde0c193f806b76cce3933914c9a4796
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:59 -05:00
Szymon Janc
216938ca2b Bluetooth: Print leading zeros for passkey in shell app
Passkey should be entered with leading zeros so print them to avoid
user confusion. Due to printk limitation (no support for padding or
precision operators for decimal numbers) snprintf is used for
convertion.

Change-Id: I6e01f577c935147ec91038b6dce115fcd893ac99
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
b2beefc0b3 net: 6LowPAN: Add length check when decompressing headers
Even though the buffer sice should be the same as the MTU it may actually
not be enough in case the headers are compressed so this adds a check if
there is enough space left to receive the decompressed data.

Change-Id: If8b4b5c2d7351b11a595a4b5f5364c78a19791f3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
ddc617efad Bluetooth: Update README with instructions for IPSP application
For testing IPSP application against a Linux host it currently need some
extra steps since 6LowPAN is not enabled by default.

Change-Id: Id491e31ef9ad6eebca7497705e874c01a5493589
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
6be8a35d05 Bluetooth: Add IPSP sample application
This application uses Bluetooth IP driver to listen to UPD port and
echo back the data received.

Change-Id: Id8e58f5f8bf58ff5947441cbcb3131c0da27081c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Jukka Rissanen
64662703af net: Network driver for Bluetooth 6LoWPAN connections
This driver handles IPv6 traffic over Bluetooth LE connection.
The packet fragmentation is done inside BT stack, so this
driver only calls compression function.

Change-Id: Ib7f2356a1e88e78502239e54ef6e41f1f24ccd67
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
c05ea4c21c Bluetooth: Add bt_conn_get_info
Change-Id: I32fd5b1c159623c59a353e1084f47f3cc9f704e6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
2f275c86b9 Bluetooth: UUID: Add IPSS UUID definition
Change-Id: Iff14213b734a3eb10c1c386c0b638849e9232465
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
0af650f145 Bluetooth: L2CAP: Make bt_l2cap_chan_send return the bytes sent
This is useful to detect if everything was sent properly.

Change-Id: If5ec891dc394d46b5ce8e011759ced4f3ecb5fb5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
40aaff5779 Bluetooth: L2CAP: Allocate buffer from channel if supported
Some channels may required specific user data (e.g. IPSP) so even if
data is not segmented use alloc_buf callback to allocate a buffer if
supported.

Change-Id: Iecca4a6979da8bc6745ad5b3b214506d3dd71437
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz
1725d14b31 Bluetooth: L2CAP: Fix check of SDU buffer
Change-Id: I7522a8988b4b458d2f92813f12c10b1a54f3c88c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Johan Hedberg
045bac2d4c Bluetooth: Fix zero-byte coding style for memset()
Change-Id: If2e657b855c142c04f206d3bc9e3c0bdf4057243
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:59 -05:00
Johan Hedberg
5e607f93b9 Bluetooth: Use continuous scanning when initiating LE connections
Since we always do passive scanning and wait for a connectable
advertising event it makes sense to request continous scanning when we
issue the HCI_LE_Create_Connection. This way we minimize the risk of
loosing any advertising packets.

Change-Id: Ie314e15243aede00d1fb3be9532efb74518b293d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:59 -05:00
Jukka Rissanen
3949ef16ea net: contiki: IPv6 packet handling had debugging activated
By default all debugging should be off and only activated if
user really wants so.

Change-Id: I280748b7852052892c309d5f0ada611cb2bc08b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:59 -05:00
Jukka Rissanen
d0ac5c7cf0 net: buf: Enable IP and L2 buf debugging properly
The IP and L2 buffer debugging is now activated if one enables
CONFIG_NETWORKING_WITH_LOGGING option.

Change-Id: Idad4978cfd6bd705bdde6e21f1edcd3c7d280c75
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:59 -05:00
Grzegorz Kolodziejczyk
ce4a34181f Bluetooth: Add SM related struct defs to bttester
This patch adds structure definitions for SM related commands and
events. Structs are mapped with btp specification and will be used
within commands and events implementation.

Change-Id: I82231cdab62d170b86c548acc14ffdcbd888473a
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:59 -05:00
Szymon Janc
3aad102874 Bluetooth: SMP: Fix missing new line
Change-Id: I732ec7884997d6f21ef18387927c62d9b54edee6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00
Szymon Janc
2046a2d606 Bluetooth: Simplify preprocessor checks for BR/EDR samphores
There is no need for #if #else as BR/EDR enabled path is only special
case for LE connection. Also if there is return in if block else is not
needed.

Change-Id: Ie1a57a0e4dae6c4b79f64c14971b7e8ef009fca3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00
Szymon Janc
b63a04fb51 Bluetooth: Remove extra semicolons
Change-Id: Ifa2934bf07cb39ab73c47a55ae469d89bc84a8f4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00