Commit graph

41120 commits

Author SHA1 Message Date
Szymon Janc
3f8e289402 Bluetooth: SMP: Handle security request from slave
If sufficently strong key exists enable encryption. If no key is
present or key doesn't meet auth requirements start pairing.

Change-Id: I50be66f895d02dbbce49290c21bbc445ab734b4b
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:32 -05:00
Szymon Janc
18c1b9d0a9 Bluetooth: Add suport for enabling encryption
If LTK for connection is stored use it to start encryption instead
of initiating pairing.

Change-Id: Ia1322b028c1ed132c3678c4ff1b4cba1ada7f50d
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:32 -05:00
Szymon Janc
a3dabad67b Bluetooth: SMP: Handle pairing master identification request
Store EDIV and Rand received in pairing master identification request.

Change-Id: Id495934a04470f098da7d36e933e74fb4f052415
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
64426dbbdd Bluetooth: SMP: Handle pairing encrypt request
Store LTK received in pairing ecnrypt request.

Change-Id: I8e19addae67d310905d262df0fc44ff415839560
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
fd79c5f913 Bluetooth: Add support for storing LTK
This allows to store LTK used in further connections encryption
when acting as a master.

Change-Id: I5711d7a9ec5f36add66fbf07e546ebd64ecb3c8b
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
f145d3384d Bluetooth: SMP: Start encryption with STK
If received confirm is valid and we are master start encryption with
generated STK.

Change-Id: I874b3081b6e4b0b9711ba20ee4b99ff5bfcb5bd4
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg
87a5eacdf6 Bluetooth: Fix coding style (indentation)
Change-Id: I25597decd6c44c5c26617b40eeec0f4319645cf8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:31 -05:00
Mariusz Skamra
30b50a3227 Bluetooth: Cancel pending connection
Adds HCI routine to cancel creation of outgoing connection.
bt_disconnect is called to cancel connection or disconnect based on current
connection state.

Change-Id: I462a61308a580bb24aa9a6c398eb7e443b995655
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg
a2241a55fd Bluetooth: Add config option for security keys handling
This makes sure that keys.c doesn't always have its BT_DBG logs
enabled.

Change-Id: Ia97149f08a448f55a15c3282f72afb23c495b715
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg
0fdf33c734 Bluetooth: Move L2CAP connection notification earlier
We need to notify and initialize internal code before going ahead and
notifying external code of a new connection. Also, in principle the
L2ACP APIs for a connection should only be used after L2CAP has been
told the connection exists.

Change-Id: I0c8386b39ca86290da03ed68ad01c007b1c41c10
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg
4bfbbce870 Bluetooth: Remove unnecessary comment
Change-Id: I80827d4692da5e3b0ac4fcc1b75146746c8bf987
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg
44fa50b975 Bluetooth: Fix minor coding style issue
Change-Id: I54e952c10d51bb322daae053889dcfdb188223e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:31 -05:00
Arkadiusz Lichwa
b62f778664 Bluetooth: Start outgoing connection with tracking
Enables make outgoing connection with error handling.
Free connection objects maintained in polls are assigned to active
connection by result of lookup on the polls based on input
peer LE address.
Updates shell application to reflect above changes in stack.

Change-Id: Ibc71343c0d122cc78c48bac2ff1e50533369b7d2
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:31 -05:00
Luiz Augusto von Dentz
8fe7db3e17 Bluetooth: Add bt_att_send API
This adds bt_att_send which will be used by GATT client API to send
requests.

Note: bt_att_send can only handle one request at time but once the
requirements are clarified it will probably be extended to support
more requests to attend multiple applications probably using a fifo.

Change-Id: If9e89f7f6f0d3827a7f11c8feb4f1f1045d800be
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:31 -05:00
Mariusz Skamra
949106ceea Bluetooth: Notify about connection events in tester app
Notifications will be sent on connected/disconnected events.

Change-Id: Iaac6851a987a630ce41c5836de49dccc6ee5d385
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:31 -05:00
Mariusz Skamra
ee20dd0a10 Bluetooth: Handle advertising in tester app
This patch adds support for enabling advertising on DUT. For now
setting custom advertising data or scan response is not supported.

Change-Id: I506d944565e524eb2103949df6cf003347d4c117
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:31 -05:00
Mariusz Skamra
648a4923ed Bluetooth: Add bt_conn_lookup_state function
bt_conn_lookup_state looks up for connection with "peer" in specific
state "state". Returns NULL if there is no connection with peer or
connection state differs from the given one.

Passing BT_ADDR_LE_ANY will return the first connection with the
specific state.

Change-Id: Iaa3bb22c9aa31192b8782adb6b11c5051b403758
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
a14314e913 Bluetooth: Move security related code to bluetooth.h
Also rename bt_conn_security function to bt_security and
bt_conn_security_t to bt__security_t.

Change-Id: I543c7b97241c4389ef0eb491b6869f93105ae533
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
3e1023cdcd Bluetooth: Remove 'none' security level
This was same as low security and is not needed. This also match
security levels with LE Mode 1 security level from Core Specification.

Change-Id: Ia82e1f4d94c281d7e7f88f03a16a1e34eb49f710
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
a6a0e54ec9 Bluetooth: Do nothing if required no encryption
Until full security level tracking is added just ignore BT_CONN_SEC_LOW
security level.

Change-Id: I38ccf7dca261dc0a2a3d6e58b7398946d8f17771
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
bd0642958b Bluetooth: Add doxygen for bt_conn_security
Change-Id: I8d2f609e803931bc5cd4c8cd60a017b1956eb726
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Arkadiusz Lichwa
caadf61a54 Bluetooth: Adjust debug logs for connection ref
Move debug log for connection object lifecycle's reference counter
after such ref is modified.
It then prints the exact value for all changes.

Change-Id: I36855c7f5b70d2b6f3e328a0298b869a7b582fa4
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
1fc691ed42 Bluetooth: Add support for sending HCI LE Start Encryption command
This command will be used to enable encryption when acting as master.

Change-Id: Iaaf1d5b98bfcfcf17a5cc7006a6c40d0905011fd
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
10a2f86bef Bluetooth: Add security command to shell application
This allows to elevate security of a connection.

Change-Id: I492a92026c8db6feccffb96334be4557a5c73b48
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
81a4dbcf8f Bluetooth: Allow to set required security for connection
This adds bt_conn_security function that can be used to elevate
security on connection. If device is not paired it will trigger
pairing first.

For now only JustWorks pairing is supported so full security level
tracking is not needed as only medium level is supported.

Change-Id: I6d344f55286a79bd989bd18f852a6859dc8ea96a
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
c979fc25ca Bluetooth: SMP: Require encryption keys distribution from slave
Change-Id: Iee52d1cfe52f779f6993a0063836d466361d673d
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
04b731df03 Bluetooth: SMP: Send random on confirmation
As initiator send pairing random after confirmation was received.

Change-Id: I0ab901a40a0b2118ce69ab8410952766ff2dcd0d
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
aef53f9cde Bluetooth: SMP: Send confirm on pairing response
When piaring response is received move on to sending confirmation.

Change-Id: Ifae84f7ea6f5a9fe26ca2a5e5b1e1cdde0d388ed
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
b3d94667a2 Bluetooth: SMP: Add initial support for sending pairing request
This allows to send pairing request and receive pairing response.

Change-Id: Ic7ad120a2d32896c4edd20b0020c5727bcc30f37
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
f59ed9e729 Bluetooth: SMP: Pass ia and ra based on connection role
This make confirm and random use proper addresses depending based on
connection role.

Change-Id: I7b2117b330a6f9cc5c2c781e9c736fadcd52df31
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Arkadiusz Lichwa
e57984e3be Bluetooth: Make ref on connection object atomic
This makes it possible to perform these operations without
locking once per-conn locking is added in the future.

Change-Id: I342d55856116d9c87daeda4088b65e78e8ef0768
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:31 -05:00
Jukka Rissanen
ca2c662fc0 net: apps: Set the mac address in the stack
This way the stack will generate a proper IPv6 link local
address.

Change-Id: I149d82cf5623f3073b9edc64fe4e426460eb793b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:31 -05:00
Jukka Rissanen
ba40f4ff31 net: apps: Set the mac address in listener app
The mac address length needs to be 6 bytes because this
test app has no 802.15.4 support. The uIP stack checks
this and expects only 6 bytes mac address in this case.

Change-Id: I1edd340491b4690b5a2cf285c63f90950bbc3ff3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:31 -05:00
Jukka Rissanen
4eb70872fc net: Fix the loopback driver function parameters
Wrong number of parameters in net_driver.send registration.

Change-Id: I39eda44f0dbc9a5a1d980da3a625ef36946aef19
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:31 -05:00
Ravi kumar Veeramally
89c83d0162 net: 6lowpan: Adapt compression functions to net_mbuf buffers
6lowpan HC06 and HC01 compression/uncompression functions are
adapted to net_mbuf buffers. HC06 compression and uncompression
works properly. HC01 adapted to net_mbuf but functionality is
failing due to inproper IPv6 link local addresses. buf pointers
from net_mbuf and couple of net_mbuf calls are removed (which
are not used at the moment and saves memory from net_mbuf).

Change-Id: I2711b71b1b8df2eaac67d69275baf4b62b03f9f6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
540980e243 net: ip: Makefile re-structuring
Set the compiled files unambiguously so that we are always able
to see what object files are compiled from networking sub-system.

Change-Id: Ia763778e954195502281d63438b7e756adadd8a5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
e0509c5e6f net: rpl: Fix compile errors
This fixes RPL compile errors if CONFIG_NETWORKING_WITH_RPL is
enabled. The end result is not tested atm so RPL might not yet
work as expected.

Change-Id: I458c20f8f8c7c750cc17f24acf425f244399699d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
5d11691aa6 net: Add source mac address to net_buf
This is needed for enabling RPL and 6lowpan support.

Change-Id: I87f95a08db2cc874bbe841d9b1456803ab16d75d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
19fe2ff93d net: uip: Avoid unused label compile warning
The process: label is only used if we are a router so add
ifdef guard.

Change-Id: Ib88d4e4d70b049541480a6e9dd9d68911543ff50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
6869b1ace6 net: Make 6lowpan config depend on 802.15.4 config
As we do not have Bluetooth IPSP support yet, then assume
that user needs 802.15.4 if 6lowpan needs to be activated
in Kconfig. This needs tweaking later.

Change-Id: I02ab6ebea51fdcacf8d23960e4ca70e777c0da88
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
1af5132250 net: Do not compile slip if UART support is missing
Saves some memory if unnecessary slip functions are not
compiled into kernel.

Change-Id: If2316909b36b12cb4d163a5ca966e2e54f4e1159
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
015b52f55c net: 15.4: Make it possible to disable 802.15.4 networking
It is now possible to fully remove 802.15.4 radio support
from generated kernel.

Change-Id: Ib7cf8f4bb400ae7e298bdc62e3b50b787a2ef06d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
cae2483f18 net: 15.4: Tweak the stack size of Rx and Tx fibers
One kb for Rx is enough, Tx needs bigger stack (4 kb) as it
needs to fragment bigger messages and needs more buffers.

Change-Id: Ib0a77dbd627bb3bd2806fa13a24a5869c64b31b2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
0e8524ca2e net: Tweak the stack size of Rx and Tx fibers
One kb seems to be enough for the stack.

Change-Id: Ib1e3a7e97bf7d69ddd4b3028fe7dd6413a0098d4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
904c5a0cf0 net: Tweak the number of network buffers to use
Use correct number of network buffers when sending and receiving
maximum size IPv6 frames (1280 bytes).

Change-Id: Iec4978fc97fb16f279a409f4f04d8a679d7cadc7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
46b534009d net: conf: Set the max number of internal buffers
The queuebuf count defines how many fragments we are able to
receive. Value 13 means that we can receive full IPv6 data
(1280 bytes), we need also some extra buffers for temp use.

Change-Id: Ie16d37ae61e15ded4355b5f54136722fc6317022
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
19983ee89f net: apps: Send always the max data size to test the stack
Stress test the IP stack by always sending max number of bytes.

Change-Id: I830a92cca4efbc2aa00dd1bec75972884359621c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
442554615f net: 15.4: Add code to analyze stack usage
To make it easy to periodically verify that we have sane stack sizes
it's helpful to have some code to evaluate how much of the stacks are
used. There's already a CONFIG_INIT_STACKS option which pre-fills the
stacks with 0xaa bytes, so we make use of it and in case the option is
enabled run the extra code to evaluate how much of each stack was
used. The trigger for the evaluation is a disconnection event.

Copied from Bluetooth sub-system.

Change-Id: I5539156d98abd361254088f775765f7a72890ed5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
e4505927a3 net: 15.4: Rename rx and tx fibers
Easier to debug the beast if the IP fibers are not called
the same as 15.4 fibers.

Change-Id: Iaa15b5e359c7dc2fd9af298445d6abe59a26ddd0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
29d0e5b74a net: 6lowpan: Free net_buf if receiving wrong fragments
If we receive wrong fragments, then we start all over. In this
case we also need to release the net_buf that is used to collect
the earlier fragments.

Change-Id: I121d6a4031a375a0208441e110ebede58320c153
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00